QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
LineSearch Class Referenceabstract

Base class for line search. More...

#include <linesearch.hpp>

+ Inheritance diagram for LineSearch:
+ Collaboration diagram for LineSearch:

Public Member Functions

 LineSearch (Real=0.0)
 Default constructor. More...
 
virtual ~LineSearch ()=default
 Destructor. More...
 
const ArraylastX ()
 return last x value More...
 
Real lastFunctionValue () const
 return last cost function value More...
 
const ArraylastGradient ()
 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 &params, const Array &direction, Real beta, const Constraint &constraint)
 
const ArraysearchDirection () const
 current value of the search direction More...
 
ArraysearchDirection ()
 

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...
 

Detailed Description

Base class for line search.

Definition at line 38 of file linesearch.hpp.

Constructor & Destructor Documentation

◆ LineSearch()

LineSearch ( Real  = 0.0)
explicit

Default constructor.

Definition at line 41 of file linesearch.hpp.

◆ ~LineSearch()

virtual ~LineSearch ( )
virtualdefault

Destructor.

Member Function Documentation

◆ lastX()

const Array & lastX ( )

return last x value

Definition at line 46 of file linesearch.hpp.

◆ lastFunctionValue()

Real lastFunctionValue ( ) const

return last cost function value

Definition at line 48 of file linesearch.hpp.

◆ lastGradient()

const Array & lastGradient ( )

return last gradient

Definition at line 50 of file linesearch.hpp.

◆ lastGradientNorm2()

Real lastGradientNorm2 ( ) const

return square norm of last gradient

Definition at line 52 of file linesearch.hpp.

◆ succeed()

bool succeed ( ) const

Definition at line 54 of file linesearch.hpp.

◆ operator()()

virtual Real operator() ( Problem P,
EndCriteria::Type ecType,
const EndCriteria ,
Real  t_ini 
)
pure virtual

Perform line search.

Implemented in ArmijoLineSearch, and GoldsteinLineSearch.

◆ update()

Real update ( Array params,
const Array direction,
Real  beta,
const Constraint constraint 
)

Definition at line 26 of file linesearch.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ searchDirection() [1/2]

const Array & searchDirection ( ) const

current value of the search direction

Definition at line 67 of file linesearch.hpp.

◆ searchDirection() [2/2]

Array & searchDirection ( )

Definition at line 68 of file linesearch.hpp.

Member Data Documentation

◆ searchDirection_

Array searchDirection_
protected

current values of the search direction

Definition at line 71 of file linesearch.hpp.

◆ xtd_

Array xtd_
protected

new x and its gradient

Definition at line 73 of file linesearch.hpp.

◆ gradient_

Array gradient_
protected

Definition at line 73 of file linesearch.hpp.

◆ qt_

Real qt_ = 0.0
protected

cost function value and gradient norm corresponding to xtd_

Definition at line 75 of file linesearch.hpp.

◆ qpt_

Real qpt_ = 0.0
protected

Definition at line 75 of file linesearch.hpp.

◆ succeed_

bool succeed_ = true
protected

flag to know if linesearch succeed

Definition at line 77 of file linesearch.hpp.