QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Base class for line search. More...
#include <linesearch.hpp>
Public Member Functions | |
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 () |
Protected Attributes | |
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... | |
Base class for line search.
Definition at line 38 of file linesearch.hpp.
|
explicit |
Default constructor.
Definition at line 41 of file linesearch.hpp.
|
virtualdefault |
Destructor.
const Array & lastX | ( | ) |
return last x value
Definition at line 46 of file linesearch.hpp.
Real lastFunctionValue | ( | ) | const |
return last cost function value
Definition at line 48 of file linesearch.hpp.
const Array & lastGradient | ( | ) |
return last gradient
Definition at line 50 of file linesearch.hpp.
Real lastGradientNorm2 | ( | ) | const |
return square norm of last gradient
Definition at line 52 of file linesearch.hpp.
bool succeed | ( | ) | const |
Definition at line 54 of file linesearch.hpp.
|
pure virtual |
Perform line search.
Implemented in ArmijoLineSearch, and GoldsteinLineSearch.
Real update | ( | Array & | params, |
const Array & | direction, | ||
Real | beta, | ||
const Constraint & | constraint | ||
) |
Definition at line 26 of file linesearch.cpp.
const Array & searchDirection | ( | ) | const |
current value of the search direction
Definition at line 67 of file linesearch.hpp.
Array & searchDirection | ( | ) |
Definition at line 68 of file linesearch.hpp.
|
protected |
current values of the search direction
Definition at line 71 of file linesearch.hpp.
|
protected |
new x and its gradient
Definition at line 73 of file linesearch.hpp.
|
protected |
Definition at line 73 of file linesearch.hpp.
|
protected |
cost function value and gradient norm corresponding to xtd_
Definition at line 75 of file linesearch.hpp.
|
protected |
Definition at line 75 of file linesearch.hpp.
|
protected |
flag to know if linesearch succeed
Definition at line 77 of file linesearch.hpp.