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

Multi-dimensional Conjugate Gradient class. More...

#include <conjugategradient.hpp>

+ Inheritance diagram for ConjugateGradient:
+ Collaboration diagram for ConjugateGradient:

Public Member Functions

 ConjugateGradient (const ext::shared_ptr< LineSearch > &lineSearch=ext::shared_ptr< LineSearch >())
 
- Public Member Functions inherited from LineSearchBasedMethod
 LineSearchBasedMethod (ext::shared_ptr< LineSearch > lSearch=ext::shared_ptr< LineSearch >())
 
 ~LineSearchBasedMethod () override=default
 
EndCriteria::Type minimize (Problem &P, const EndCriteria &endCriteria) override
 minimize the optimization problem P More...
 
- Public Member Functions inherited from OptimizationMethod
virtual ~OptimizationMethod ()=default
 
virtual EndCriteria::Type minimize (Problem &P, const EndCriteria &endCriteria)=0
 minimize the optimization problem P More...
 

Private Member Functions

LineSearchBasedMethod interface
Array getUpdatedDirection (const Problem &P, Real gold2, const Array &oldGradient) override
 computes the new search direction More...
 

Additional Inherited Members

virtual Array getUpdatedDirection (const Problem &P, Real gold2, const Array &gradient)=0
 computes the new search direction More...
 
- Protected Attributes inherited from LineSearchBasedMethod
ext::shared_ptr< LineSearchlineSearch_
 line search More...
 

Detailed Description

Multi-dimensional Conjugate Gradient class.

Fletcher-Reeves-Polak-Ribiere algorithm adapted from Numerical Recipes in C, 2nd edition.

User has to provide line-search method and optimization end criteria. Search direction \( d_i = - f'(x_i) + c_i*d_{i-1} \) where \( c_i = ||f'(x_i)||^2/||f'(x_{i-1})||^2 \) and \( d_1 = - f'(x_1) \)

This optimization method requires the knowledge of the gradient of the cost function.

Definition at line 47 of file conjugategradient.hpp.

Constructor & Destructor Documentation

◆ ConjugateGradient()

ConjugateGradient ( const ext::shared_ptr< LineSearch > &  lineSearch = ext::shared_ptr<LineSearch>())

Definition at line 49 of file conjugategradient.hpp.

Member Function Documentation

◆ getUpdatedDirection()

Array getUpdatedDirection ( const Problem P,
Real  gold2,
const Array gradient 
)
overrideprivatevirtual

computes the new search direction

Implements LineSearchBasedMethod.

Definition at line 30 of file conjugategradient.cpp.

+ Here is the call graph for this function: