|
openGPMP
Open Source Mathematics Package
|
Class implementing Quasi-Newton optimization methods. More...
#include <quasi.hpp>
Public Member Functions | |
| std::vector< double > | bhhh_optimize (const std::function< double(const std::vector< double > &)> &func, const std::vector< double > &initial_point, double tolerance, size_t max_iterations) |
| Optimize a function using the Berndt–Hall–Hall–Hausman (BHHH) algorithm. More... | |
| std::vector< double > | calculate_gradient (const std::function< double(const std::vector< double > &)> &func, const std::vector< double > &point, double epsilon) |
| Calculate the gradient of a function at a given point. More... | |
| std::vector< std::vector< double > > | calculate_bhhh_matrix (const std::vector< double > &gradient) |
| Calculate the BHHH matrix from the gradient. More... | |
| std::vector< double > | update_point (const std::vector< double > ¤t_point, const std::vector< double > &gradient, const std::vector< std::vector< double >> &bhhh_matrix) |
| Update the current point using the BHHH matrix. More... | |
| std::vector< double > | bfgs_optimize (const std::function< double(const std::vector< double > &)> &func, const std::vector< double > &initial_point, double tolerance, size_t max_iterations) |
| Optimize a function using the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm. More... | |
| std::vector< double > | calculate_search_direction (const std::vector< double > &gradient, const std::vector< std::vector< double >> &hessian_inverse) |
| Calculate the search direction using the BFGS method. More... | |
| double | line_search (const std::function< double(const std::vector< double > &)> &func, const std::vector< double > ¤t_point, const std::vector< double > &search_direction) |
| Perform line search to find an appropriate step size. More... | |
| std::vector< double > | update_point (const std::vector< double > ¤t_point, const std::vector< double > &search_direction, double step_size) |
| Update the current point using the line search and step size. More... | |
| std::vector< double > | calculate_gradient_difference (const std::vector< double > &next_point, const std::vector< double > ¤t_point, const std::vector< double > &gradient) |
| Calculate the gradient difference between two points. More... | |
| std::vector< std::vector< double > > | update_hessian_inverse (const std::vector< std::vector< double >> &hessian_inverse, const std::vector< double > &gradient_difference, const std::vector< double > &search_direction) |
| Update the inverse of the Hessian matrix using the BFGS method. More... | |
| double | dot_product (const std::vector< double > &a, const std::vector< double > &b) |
| Calculate the dot product of two vectors. More... | |
| std::vector< double > | vector_subtraction (const std::vector< double > &a, const std::vector< double > &b) const |
| Subtract two vectors element-wise. More... | |
| std::tuple< std::vector< double >, double > | lbfgs_optimize (const std::function< double(const std::vector< double > &)> &f, const std::vector< double > &initial_point, double tolerance=1e-4, size_t max_iterations=100, size_t memory_size=5) |
| Optimize a function using the Limited-Memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) algorithm. More... | |
| std::vector< double > gpmp::optim::QuasiNewton::bfgs_optimize | ( | const std::function< double(const std::vector< double > &)> & | func, |
| const std::vector< double > & | initial_point, | ||
| double | tolerance, | ||
| size_t | max_iterations | ||
| ) |
Optimize a function using the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm.
| func | The objective function to minimize |
| initial_point | The initial guess for the optimal parameters |
| tolerance | The tolerance for stopping criterion |
| max_iterations | The maximum number of iterations |
Definition at line 145 of file quasi.cpp.
| std::vector< double > gpmp::optim::QuasiNewton::bhhh_optimize | ( | const std::function< double(const std::vector< double > &)> & | func, |
| const std::vector< double > & | initial_point, | ||
| double | tolerance, | ||
| size_t | max_iterations | ||
| ) |
Optimize a function using the Berndt–Hall–Hall–Hausman (BHHH) algorithm.
| func | The objective function to minimize |
| initial_point | The initial guess for the optimal parameters |
| tolerance | The tolerance for stopping criterion |
| max_iterations | The maximum number of iterations |
Definition at line 58 of file quasi.cpp.
| std::vector< std::vector< double > > gpmp::optim::QuasiNewton::calculate_bhhh_matrix | ( | const std::vector< double > & | gradient | ) |
Calculate the BHHH matrix from the gradient.
| gradient | The gradient vector |
| std::vector< double > gpmp::optim::QuasiNewton::calculate_gradient | ( | const std::function< double(const std::vector< double > &)> & | func, |
| const std::vector< double > & | point, | ||
| double | epsilon | ||
| ) |
| std::vector< double > gpmp::optim::QuasiNewton::calculate_gradient_difference | ( | const std::vector< double > & | next_point, |
| const std::vector< double > & | current_point, | ||
| const std::vector< double > & | gradient | ||
| ) |
Calculate the gradient difference between two points.
| next_point | The next point |
| current_point | The current point |
| gradient | The gradient vector |
| std::vector< double > gpmp::optim::QuasiNewton::calculate_search_direction | ( | const std::vector< double > & | gradient, |
| const std::vector< std::vector< double >> & | hessian_inverse | ||
| ) |
| double gpmp::optim::QuasiNewton::dot_product | ( | const std::vector< double > & | a, |
| const std::vector< double > & | b | ||
| ) |
| std::tuple< std::vector< double >, double > gpmp::optim::QuasiNewton::lbfgs_optimize | ( | const std::function< double(const std::vector< double > &)> & | f, |
| const std::vector< double > & | initial_point, | ||
| double | tolerance = 1e-4, |
||
| size_t | max_iterations = 100, |
||
| size_t | memory_size = 5 |
||
| ) |
Optimize a function using the Limited-Memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) algorithm.
| func | The objective function to optimize |
| initial_point | The initial guess for the optimal point |
| tolerance | The tolerance for stopping criterion |
| max_iterations | The maximum number of iterations |
| memory_size | The size of the limited-memory history (s and y vectors) |
Definition at line 327 of file quasi.cpp.
| double gpmp::optim::QuasiNewton::line_search | ( | const std::function< double(const std::vector< double > &)> & | func, |
| const std::vector< double > & | current_point, | ||
| const std::vector< double > & | search_direction | ||
| ) |
Perform line search to find an appropriate step size.
| func | The objective function |
| current_point | The current point |
| search_direction | The search direction vector |
Definition at line 221 of file quasi.cpp.
References gpmp::linalg::dot_product().
| std::vector< std::vector< double > > gpmp::optim::QuasiNewton::update_hessian_inverse | ( | const std::vector< std::vector< double >> & | hessian_inverse, |
| const std::vector< double > & | gradient_difference, | ||
| const std::vector< double > & | search_direction | ||
| ) |
Update the inverse of the Hessian matrix using the BFGS method.
| hessian_inverse | The current inverse of the Hessian matrix |
| gradient_difference | The gradient difference vector |
| search_direction | The search direction vector |
Definition at line 287 of file quasi.cpp.
References gpmp::linalg::dot_product().
| std::vector< double > gpmp::optim::QuasiNewton::update_point | ( | const std::vector< double > & | current_point, |
| const std::vector< double > & | gradient, | ||
| const std::vector< std::vector< double >> & | bhhh_matrix | ||
| ) |
Update the current point using the BHHH matrix.
| current_point | The current point |
| gradient | The gradient vector |
| bhhh_matrix | The BHHH matrix |
| std::vector< double > gpmp::optim::QuasiNewton::update_point | ( | const std::vector< double > & | current_point, |
| const std::vector< double > & | search_direction, | ||
| double | step_size | ||
| ) |
Update the current point using the line search and step size.
| current_point | The current point |
| search_direction | The search direction vector |
| step_size | The step size from the line search |
| std::vector< double > gpmp::optim::QuasiNewton::vector_subtraction | ( | const std::vector< double > & | a, |
| const std::vector< double > & | b | ||
| ) | const |