The quasi-Newton BFGS method. More...
#include <QuasiNewton.h>
Public Types | |
typedef base_type::function_type | function_type |
The function type. | |
typedef base_type::number_type | number_type |
The number type. | |
typedef base_type::point_type | point_type |
A point in N dimensions. | |
Public Member Functions | |
Constructors etc. | |
QuasiNewton (const function_type &function, const number_type x_tolerance=4 *std::numeric_limits< number_type >::epsilon(), const number_type gradient_tolerance=4 *std::numeric_limits< number_type >::epsilon(), const int max_function_calls=10000) | |
Construct from the objective function. | |
virtual | ~QuasiNewton () |
Destructor. | |
Minimization. | |
void | find_minimum (point_type &x, number_type &value, int &num_iterations, number_type max_step=0, const number_type x_tolerance=0, const number_type gradient_tolerance=0) |
Find the minimum. | |
void | find_minimum (point_type &x) |
Find the minimum. | |
Manipulators. | |
void | set_max_function_calls (const int max_function_calls) |
Set the maximum number of function call allowed per optimization. | |
void | reset_num_function_calls () |
Reset the number of function calls to zero. | |
void | set_x_tolerance (const number_type x_tolerance) |
Set the x tolerance for convergence. | |
void | set_gradient_tolerance (const number_type gradient_tolerance) |
Set the gradient tolerance for convergence. | |
Protected Member Functions | |
Calling the objective function. | |
Functionality inherited from Opt. | |
number_type | evaluate_function (const point_type &x) |
Evaluate the objective function and return the result. | |
void | evaluate_gradient (const point_type &x, point_type &gradient) |
Evaluate the gradient. | |
void | evaluate_numeric_gradient (const point_type &x, point_type &gradient, const number_type delta=0.0) |
Numerically evaluate the gradient. | |
Accessors. | |
| |
const function_type & | function () const |
Return a constant reference to the objective function. | |
int | num_function_calls () const |
Return the number of function calls required to find the minimum. | |
number_type | x_tolerance () const |
Return the x tolerance for convergence. | |
number_type | gradient_tolerance () const |
Return the gradient tolerance for convergence. | |
static int | dimension () |
Return the dimension, N. |
The quasi-Newton BFGS method.
N | is the problem dimension. | |
Function | is the functor to minimize. | |
T | is the number type. By default it is Function::result_type; | |
Point | is the point type. By default it is Function::argument_type; |
number_type QuasiNewton< N, Function, T, Point >::evaluate_function | ( | const point_type & | x | ) | [inline, protected] |
Evaluate the objective function and return the result.
Increment the count of the number of function calls.
Reimplemented from Opt< N, Function, T, Point >.
void QuasiNewton< N, Function, T, Point >::evaluate_gradient | ( | const point_type & | x, | |
point_type & | gradient | |||
) | [inline, protected] |
Evaluate the gradient.
Increment the count of the number of function calls.
Reimplemented from Opt< N, Function, T, Point >.
void QuasiNewton< N, Function, T, Point >::evaluate_numeric_gradient | ( | const point_type & | x, | |
point_type & | gradient, | |||
const number_type | delta = 0.0 | |||
) | [inline, protected] |
Numerically evaluate the gradient.
Increment the count of the number of function calls.
Reimplemented from Opt< N, Function, T, Point >.
void QuasiNewton< N, Function, T, Point >::find_minimum | ( | point_type & | x | ) | [inline] |
Find the minimum.
x | The input value is the starting point. The output value is the minimum point found. |
void QuasiNewton< N, Function, T, Point >::find_minimum | ( | point_type & | x, | |
number_type & | value, | |||
int & | num_iterations, | |||
number_type | max_step = 0 , |
|||
const number_type | x_tolerance = 0 , |
|||
const number_type | gradient_tolerance = 0 | |||
) |
Find the minimum.
x | The input value is the starting point. The output value is the minimum point found. | |
value | is the value of the objective function at the minimum point. | |
num_iterations | is the number of iterations of the method. | |
max_step | is the maximum step used in the line search. | |
x_tolerance | is the x tolerance for convergence. The function returns if the line search takes a smaller step than this. | |
gradient_tolerance | is the gradient tolerance for convergence. The function returns if the magnitude of the gradient falls below this value. |
Referenced by QuasiNewton< N, function_with_penalty_type, number_type, point_type >::dimension().