QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Armijo line search. More...
#include <armijo.hpp>
Public Member Functions | |
ArmijoLineSearch (Real eps=1e-8, Real alpha=0.05, Real beta=0.65) | |
Default constructor. More... | |
Real | operator() (Problem &P, EndCriteria::Type &ecType, const EndCriteria &, Real t_ini) override |
Perform line search. More... | |
Public Member Functions inherited from LineSearch | |
LineSearch (Real=0.0) | |
Default constructor. More... | |
virtual | ~LineSearch ()=default |
Destructor. More... | |
const Array & | lastX () |
return last x value More... | |
Real | lastFunctionValue () const |
return last cost function value More... | |
const Array & | lastGradient () |
return last gradient More... | |
Real | lastGradientNorm2 () const |
return square norm of last gradient More... | |
bool | succeed () const |
virtual Real | operator() (Problem &P, EndCriteria::Type &ecType, const EndCriteria &, Real t_ini)=0 |
Perform line search. More... | |
Real | update (Array ¶ms, const Array &direction, Real beta, const Constraint &constraint) |
const Array & | searchDirection () const |
current value of the search direction More... | |
Array & | searchDirection () |
Private Attributes | |
Real | alpha_ |
Real | beta_ |
Additional Inherited Members | |
Protected Attributes inherited from LineSearch | |
Array | searchDirection_ |
current values of the search direction More... | |
Array | xtd_ |
new x and its gradient More... | |
Array | gradient_ |
Real | qt_ = 0.0 |
cost function value and gradient norm corresponding to xtd_ More... | |
Real | qpt_ = 0.0 |
bool | succeed_ = true |
flag to know if linesearch succeed More... | |
Armijo line search.
Let \( \alpha \) and \( \beta \) be 2 scalars in \( [0,1] \). Let \( x \) be the current value of the unknown, \( d \) the search direction and \( t \) the step. Let \( f \) be the function to minimize. The line search stops when \( t \) verifies
\[ f(x + t \cdot d) - f(x) \leq -\alpha t f'(x+t \cdot d) \]
and
\[ f(x+\frac{t}{\beta} \cdot d) - f(x) > -\frac{\alpha}{\beta} t f'(x+t \cdot d) \]
(see Polak, Algorithms and consistent approximations, Optimization, volume 124 of Applied Mathematical Sciences, Springer-Verlag, NY, 1997)
Definition at line 48 of file armijo.hpp.
ArmijoLineSearch | ( | Real | eps = 1e-8 , |
Real | alpha = 0.05 , |
||
Real | beta = 0.65 |
||
) |
Default constructor.
Definition at line 51 of file armijo.hpp.
|
overridevirtual |
Perform line search.
Implements LineSearch.
Definition at line 26 of file armijo.cpp.
|
private |
Definition at line 62 of file armijo.hpp.
|
private |
Definition at line 62 of file armijo.hpp.