Nelder-Meade downhill simplex. More...
#include <vnl_amoeba.h>
Public Member Functions | |
void | set_max_iterations (int n) |
Define maximum number of iterations to use. | |
void | set_x_tolerance (double tol) |
Define tolerance on elements of x. | |
void | set_f_tolerance (double tol) |
Define tolerance on function evaluation. | |
void | set_relative_diameter (double r) |
Define scaling used to select starting vertices relative to initial x0. | |
vnl_amoeba (vnl_cost_function &f) | |
Construct and supply function to be minimized. | |
void | minimize (vnl_vector< double > &x) |
Modify x to minimise function supplied in constructor. | |
void | minimize (vnl_vector< double > &x, const vnl_vector< double > &dx) |
Perform optimisation. | |
int | get_num_evaluations () const |
Number of evaluations used in last call to minimize. | |
Static Public Member Functions | |
static void | minimize (vnl_cost_function &f, vnl_vector< double > &x) |
Modify x so as to minimise f(x). | |
static void | minimize (vnl_cost_function &f, vnl_vector< double > &x, const vnl_vector< double > &dx) |
Modify x so as to minimise f(x). | |
static void | minimize (vnl_cost_function &f, vnl_vector< double > &x, double delta) |
Modify x so as to minimise f(x). | |
static void | minimize (vnl_least_squares_function &f, vnl_vector< double > &x) |
Modify x so as to minimise f(x). | |
Public Attributes | |
int | verbose |
int | maxiter |
double | X_tolerance |
double | F_tolerance |
double | relative_diameter |
Scaling used to select starting vertices relative to initial x0. | |
Static Public Attributes | |
static bool | default_verbose = false |
Protected Attributes | |
vnl_cost_function * | fptr |
int | num_evaluations_ |
Nelder-Meade downhill simplex.
vnl_amoeba is an implementation of the Nelder-Meade downhill simplex algorithm. For most problems, it's a few times slower than vnl_levenberg_marquardt, but it can perform much better on noisy error functions.
It works by creating a simplex (n+1 points in n-D space) which then crawls about the space searching for the solution.
By default the set of (n+1) starting points are generated by applying a scaling (relative_diameter) to each element of the supplied starting vector, with a small offset used instead if the value is zero.
Alternatively, if one uses minimize(x,dx), then the starting points are obtained by adding each dx[i] to the elements of x, one at a time. This is useful if you know roughly the scale of your space.
Definition at line 45 of file vnl_amoeba.h.
vnl_amoeba::vnl_amoeba | ( | vnl_cost_function & | f | ) |
Construct and supply function to be minimized.
Definition at line 23 of file vnl_amoeba.cxx.
int vnl_amoeba::get_num_evaluations | ( | ) | const [inline] |
Number of evaluations used in last call to minimize.
Definition at line 82 of file vnl_amoeba.h.
void vnl_amoeba::minimize | ( | vnl_vector< double > & | x | ) |
Modify x to minimise function supplied in constructor.
Start simplex defined by scaling elements of x
Definition at line 366 of file vnl_amoeba.cxx.
void vnl_amoeba::minimize | ( | vnl_vector< double > & | x, |
const vnl_vector< double > & | dx | ||
) |
Perform optimisation.
Perform optimisation. Start simplex defined by adding dx[i] to each x[i].
Start simplex defined by adding dx[i] to each x[i]
Definition at line 374 of file vnl_amoeba.cxx.
void vnl_amoeba::minimize | ( | vnl_cost_function & | f, |
vnl_vector< double > & | x | ||
) | [static] |
void vnl_amoeba::minimize | ( | vnl_cost_function & | f, |
vnl_vector< double > & | x, | ||
const vnl_vector< double > & | dx | ||
) | [static] |
Modify x so as to minimise f(x).
Static method.
Start simplex defined by adding dx[i] to each x[i]
Definition at line 400 of file vnl_amoeba.cxx.
void vnl_amoeba::minimize | ( | vnl_cost_function & | f, |
vnl_vector< double > & | x, | ||
double | delta | ||
) | [static] |
Modify x so as to minimise f(x).
Static method.
delta defines relative size of initial simplex ie the i'th vertex has xi[i] = x[i]*(1+delta)
Definition at line 389 of file vnl_amoeba.cxx.
void vnl_amoeba::minimize | ( | vnl_least_squares_function & | f, |
vnl_vector< double > & | x | ||
) | [static] |
Modify x so as to minimise f(x).
Definition at line 427 of file vnl_amoeba.cxx.
void vnl_amoeba::set_f_tolerance | ( | double | tol | ) | [inline] |
Define tolerance on function evaluation.
Definition at line 60 of file vnl_amoeba.h.
void vnl_amoeba::set_max_iterations | ( | int | n | ) | [inline] |
Define maximum number of iterations to use.
Definition at line 54 of file vnl_amoeba.h.
void vnl_amoeba::set_relative_diameter | ( | double | r | ) | [inline] |
Define scaling used to select starting vertices relative to initial x0.
I.e. the i'th vertex has x[i] = x0[i]*(1+relative_diameter)
Definition at line 64 of file vnl_amoeba.h.
void vnl_amoeba::set_x_tolerance | ( | double | tol | ) | [inline] |
Define tolerance on elements of x.
Definition at line 57 of file vnl_amoeba.h.
bool vnl_amoeba::default_verbose = false [static] |
Definition at line 102 of file vnl_amoeba.h.
double vnl_amoeba::F_tolerance |
Definition at line 51 of file vnl_amoeba.h.
vnl_cost_function* vnl_amoeba::fptr [protected] |
Definition at line 105 of file vnl_amoeba.h.
Definition at line 49 of file vnl_amoeba.h.
int vnl_amoeba::num_evaluations_ [protected] |
Definition at line 106 of file vnl_amoeba.h.
Scaling used to select starting vertices relative to initial x0.
I.e. the i'th vertex has x[i] = x0[i]*(1+relative_diameter)
Definition at line 68 of file vnl_amoeba.h.
Definition at line 48 of file vnl_amoeba.h.
double vnl_amoeba::X_tolerance |
Definition at line 50 of file vnl_amoeba.h.