numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of quasi-Newton method with Broyden-Fletcher-Goldfarb-Shanno (BFGS) formula. More...
#include <num_collect/opt/bfgs_optimizer.h>
Public Types | |
using | base_type = descent_method_base<this_type, LineSearcher> |
Type of base class. | |
using | hessian_solver_type = HessianSolver |
Type of solvers of linear equation of Hessian. | |
using | hessian_type = typename hessian_solver_type::MatrixType |
Type of Hessian. | |
using | objective_function_type |
Type of the objective function. | |
using | this_type |
This class. | |
using | value_type |
Type of function values. | |
using | variable_scalar_type = typename variable_type::Scalar |
Type of scalars in variables. | |
using | variable_type |
Type of variables. | |
Public Member Functions | |
bfgs_optimizer (const objective_function_type &obj_fun=objective_function_type()) | |
Constructor. | |
auto | calc_direction () -> variable_type |
Calculate search direction. | |
void | configure_iteration_logger (logging::iterations::iteration_logger< this_type > &iteration_logger) const |
Configure an iteration logger. | |
auto | evaluations () const noexcept -> index_type |
Get the number of function evaluations. | |
auto | gradient () const -> const variable_type & |
Get gradient for current optimal variable. | |
auto | gradient_norm () const -> value_type |
Calculate norm of gradient. | |
void | init (const variable_type &init_variable) |
Initialize. | |
auto | iterations () const noexcept -> index_type |
Get the number of iterations. | |
auto | line_searcher () -> line_searcher_type & |
Access object to perform line search. | |
auto | line_searcher () const -> const line_searcher_type & |
Access object to perform line search. | |
auto | opt_value () const -> const value_type & |
Get current optimal value. | |
auto | opt_variable () const -> const variable_type & |
Get current optimal variable. | |
Private Attributes | |
hessian_type | approx_hessian_ {} |
Approximate Hessian. | |
variable_type | diff_grad_ {} |
Difference of gradient. | |
variable_type | diff_var_ {} |
Difference of variable. | |
bool | has_first_iteration_done_ {false} |
Whether the first iteration has been done. | |
variable_type | hessian_var_ {} |
approx_hessian_ * diff_var_ | |
variable_type | prev_grad_ {} |
Previous gradient. | |
variable_type | prev_var_ {} |
Previous variable. | |
hessian_solver_type | solver_ {} |
Solver of linear equation of Hessian. | |
Class of quasi-Newton method with Broyden-Fletcher-Goldfarb-Shanno (BFGS) formula.
ObjectiveFunction | Type of the objective function. |
LineSearcher | Type of class to perform line search. |
HessianSolver | Type of solvers of linear equation of Hessian. |
Definition at line 60 of file bfgs_optimizer.h.
using num_collect::opt::bfgs_optimizer< ObjectiveFunction, LineSearcher, HessianSolver >::base_type = descent_method_base<this_type, LineSearcher> |
Type of base class.
Definition at line 70 of file bfgs_optimizer.h.
using num_collect::opt::bfgs_optimizer< ObjectiveFunction, LineSearcher, HessianSolver >::hessian_solver_type = HessianSolver |
Type of solvers of linear equation of Hessian.
Definition at line 79 of file bfgs_optimizer.h.
using num_collect::opt::bfgs_optimizer< ObjectiveFunction, LineSearcher, HessianSolver >::hessian_type = typename hessian_solver_type::MatrixType |
Type of Hessian.
Definition at line 82 of file bfgs_optimizer.h.
using num_collect::opt::descent_method_base< Derived, LineSearcher >::objective_function_type |
Type of the objective function.
Definition at line 42 of file descent_method_base.h.
using num_collect::opt::bfgs_optimizer< ObjectiveFunction, LineSearcher, HessianSolver >::this_type |
This class.
Definition at line 66 of file bfgs_optimizer.h.
using num_collect::opt::descent_method_base< Derived, LineSearcher >::value_type |
Type of function values.
Definition at line 49 of file descent_method_base.h.
using num_collect::opt::bfgs_optimizer< ObjectiveFunction, LineSearcher, HessianSolver >::variable_scalar_type = typename variable_type::Scalar |
Type of scalars in variables.
Definition at line 76 of file bfgs_optimizer.h.
using num_collect::opt::descent_method_base< Derived, LineSearcher >::variable_type |
Type of variables.
Definition at line 46 of file descent_method_base.h.
|
inlineexplicit |
Constructor.
[in] | obj_fun | Objective function. |
Definition at line 89 of file bfgs_optimizer.h.
|
inlinenodiscard |
Calculate search direction.
Definition at line 117 of file bfgs_optimizer.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 139 of file bfgs_optimizer.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 127 of file descent_method_base.h.
|
inlinenodiscard |
Get gradient for current optimal variable.
Definition at line 136 of file descent_method_base.h.
|
inlinenodiscard |
Calculate norm of gradient.
Definition at line 145 of file descent_method_base.h.
|
inline |
Initialize.
[in] | init_variable | Initial variable. |
Definition at line 107 of file bfgs_optimizer.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 120 of file descent_method_base.h.
|
inlinenodiscard |
Access object to perform line search.
Definition at line 90 of file descent_method_base.h.
|
inlinenodiscard |
Access object to perform line search.
Definition at line 99 of file descent_method_base.h.
|
inlinenodiscard |
Get current optimal value.
Definition at line 113 of file descent_method_base.h.
|
inlinenodiscard |
Get current optimal variable.
Definition at line 106 of file descent_method_base.h.
|
private |
Approximate Hessian.
Definition at line 154 of file bfgs_optimizer.h.
|
private |
Difference of gradient.
Definition at line 166 of file bfgs_optimizer.h.
|
private |
Difference of variable.
Definition at line 163 of file bfgs_optimizer.h.
|
private |
Whether the first iteration has been done.
Definition at line 172 of file bfgs_optimizer.h.
|
private |
approx_hessian_ * diff_var_
Definition at line 169 of file bfgs_optimizer.h.
|
private |
Previous gradient.
Definition at line 160 of file bfgs_optimizer.h.
|
private |
Previous variable.
Definition at line 157 of file bfgs_optimizer.h.
|
private |
Solver of linear equation of Hessian.
Definition at line 175 of file bfgs_optimizer.h.