Line Search. More...
#include <itpp/optim/newton_search.h>
Public Member Functions | |
Line_Search () | |
Default constructor. More... | |
~Line_Search () | |
Destructor. More... | |
void | set_function (double(*function)(const vec &)) |
Set function pointer. More... | |
void | set_gradient (vec(*gradient)(const vec &)) |
Set gradient function pointer. More... | |
void | set_functions (double(*function)(const vec &), vec(*gradient)(const vec &)) |
Set both function and gradient function pointers. More... | |
void | set_start_point (const vec &x, double F, const vec &g, const vec &h) |
Set start point for search. More... | |
void | get_solution (vec &xn, double &Fn, vec &gn) |
Get solution, function value and gradient at solution point. More... | |
bool | search () |
Do the line search. More... | |
bool | search (vec &xn, double &Fn, vec &gn) |
Do the line search and return solution. More... | |
bool | search (const vec &x, double F, const vec &g, const vec &h, vec &xn, double &Fn, vec &gn) |
Set starting point, do the line search, and return the solution. More... | |
double | get_alpha () |
return alpha at solution point, xn = x + alpha h More... | |
double | get_slope_ratio () |
return the slope ratio at solution poin, xn More... | |
int | get_no_function_evaluations () |
return number of function evaluations used in search More... | |
void | set_stop_values (double rho, double beta) |
Set stop criterion values. More... | |
double | get_rho () |
Return stop value rho. More... | |
double | get_beta () |
Return stop value beta. More... | |
void | set_max_iterations (int value) |
Set max number of iterations. More... | |
int | get_max_iterations () |
Return max number of iterations. More... | |
void | set_max_stepsize (double value) |
Set max stepsize. More... | |
double | get_max_stepsize () |
Return max number of iterations. More... | |
void | set_method (const Line_Search_Method &method) |
Set Line search method. More... | |
void | enable_trace () |
enable trace mode More... | |
void | disable_trace () |
disable trace More... | |
void | get_trace (vec &alphavalues, vec &Fvalues, vec &dFvalues) |
Line Search.
The line search try to minimize the objective function along the direction
from the current position
.
Hence we look at
and try to find an that minimizes
.
Two variants are used. Either the soft line search (default) or the exact line search.
The soft line search stops when a point in the acceptable region is found, i.e.
and
Default vales are and
.
The exact line search
and
where is the current interval for
. Default vales are
and
.
The exact line search can at least in theory give the exact resutl, but it may require many extra function evaluations compared to soft line search.
Definition at line 223 of file newton_search.h.
itpp::Line_Search::Line_Search | ( | ) |
Default constructor.
Definition at line 329 of file newton_search.cpp.
|
inline |
Destructor.
Definition at line 229 of file newton_search.h.
void itpp::Line_Search::set_function | ( | double(*)(const vec &) | function | ) |
Set function pointer.
Definition at line 349 of file newton_search.cpp.
void itpp::Line_Search::set_gradient | ( | vec(*)(const vec &) | gradient | ) |
Set gradient function pointer.
Definition at line 355 of file newton_search.cpp.
|
inline |
Set both function and gradient function pointers.
Definition at line 236 of file newton_search.h.
Referenced by itpp::Newton_Search::search().
void itpp::Line_Search::set_start_point | ( | const vec & | x, |
double | F, | ||
const vec & | g, | ||
const vec & | h | ||
) |
Set start point for search.
Definition at line 370 of file newton_search.cpp.
Referenced by itpp::Newton_Search::search(), and search().
void itpp::Line_Search::get_solution | ( | vec & | xn, |
double & | Fn, | ||
vec & | gn | ||
) |
Get solution, function value and gradient at solution point.
Definition at line 383 of file newton_search.cpp.
References it_assert.
Referenced by search().
bool itpp::Line_Search::search | ( | ) |
Do the line search.
Definition at line 392 of file newton_search.cpp.
References std::abs(), itpp::dot(), itpp::eps, it_assert, itpp::max(), itpp::min(), itpp::norm(), and itpp::sqr().
Referenced by itpp::Newton_Search::search(), and search().
bool itpp::Line_Search::search | ( | vec & | xn, |
double & | Fn, | ||
vec & | gn | ||
) |
Do the line search and return solution.
Definition at line 599 of file newton_search.cpp.
References get_solution(), and search().
bool itpp::Line_Search::search | ( | const vec & | x, |
double | F, | ||
const vec & | g, | ||
const vec & | h, | ||
vec & | xn, | ||
double & | Fn, | ||
vec & | gn | ||
) |
Set starting point, do the line search, and return the solution.
Definition at line 606 of file newton_search.cpp.
References get_solution(), search(), and set_start_point().
double itpp::Line_Search::get_alpha | ( | ) |
return alpha at solution point, xn = x + alpha h
Definition at line 616 of file newton_search.cpp.
References it_warning.
Referenced by itpp::Newton_Search::search().
double itpp::Line_Search::get_slope_ratio | ( | ) |
return the slope ratio at solution poin, xn
Definition at line 626 of file newton_search.cpp.
References it_warning.
Referenced by itpp::Newton_Search::search().
int itpp::Line_Search::get_no_function_evaluations | ( | ) |
return number of function evaluations used in search
Definition at line 636 of file newton_search.cpp.
References it_warning.
Referenced by itpp::Newton_Search::search().
void itpp::Line_Search::set_stop_values | ( | double | rho, |
double | beta | ||
) |
Set stop criterion values.
Definition at line 362 of file newton_search.cpp.
Referenced by itpp::Newton_Search::search().
|
inline |
Return stop value rho.
Definition at line 264 of file newton_search.h.
|
inline |
Return stop value beta.
Definition at line 266 of file newton_search.h.
void itpp::Line_Search::set_max_iterations | ( | int | value | ) |
Set max number of iterations.
Definition at line 647 of file newton_search.cpp.
References it_assert.
Referenced by itpp::Newton_Search::search().
|
inline |
Return max number of iterations.
Definition at line 271 of file newton_search.h.
void itpp::Line_Search::set_max_stepsize | ( | double | value | ) |
Set max stepsize.
Definition at line 653 of file newton_search.cpp.
References it_assert.
Referenced by itpp::Newton_Search::search().
|
inline |
Return max number of iterations.
Definition at line 276 of file newton_search.h.
void itpp::Line_Search::set_method | ( | const Line_Search_Method & | method | ) |
Set Line search method.
Definition at line 659 of file newton_search.cpp.
|
inline |
|
inline |
void itpp::Line_Search::get_trace | ( | vec & | alphavalues, |
vec & | Fvalues, | ||
vec & | dFvalues | ||
) |
get trace outputs alphavalues
are the solutions of every iteration Fvalues
are the function values dFvalues
Definition at line 675 of file newton_search.cpp.
References it_warning.
Generated on Sun Jun 5 2022 21:26:42 for IT++ by Doxygen 1.9.3