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
CostFunction Class Referenceabstract

Cost function abstract class for optimization problem. More...

#include <costfunction.hpp>

+ Inheritance diagram for CostFunction:
+ Collaboration diagram for CostFunction:

Public Member Functions

virtual ~CostFunction ()=default
 
virtual Real value (const Array &x) const
 method to overload to compute the cost function value in x More...
 
virtual Array values (const Array &x) const =0
 method to overload to compute the cost function values in x More...
 
virtual void gradient (Array &grad, const Array &x) const
 method to overload to compute grad_f, the first derivative of More...
 
virtual Real valueAndGradient (Array &grad, const Array &x) const
 method to overload to compute grad_f, the first derivative of More...
 
virtual void jacobian (Matrix &jac, const Array &x) const
 method to overload to compute J_f, the jacobian of More...
 
virtual Array valuesAndJacobian (Matrix &jac, const Array &x) const
 method to overload to compute J_f, the jacobian of More...
 
virtual Real finiteDifferenceEpsilon () const
 Default epsilon for finite difference method : More...
 

Detailed Description

Cost function abstract class for optimization problem.

Examples
GlobalOptimizer.cpp.

Definition at line 34 of file costfunction.hpp.

Constructor & Destructor Documentation

◆ ~CostFunction()

virtual ~CostFunction ( )
virtualdefault

Member Function Documentation

◆ value()

virtual Real value ( const Array x) const
virtual

method to overload to compute the cost function value in x

Reimplemented in ProjectedCostFunction, BasketGeneratingEngine::MatchHelper, XABRInterpolationImpl< I1, I2, Model >::XABRError, FrobeniusCostFunction, LeastSquareFunction, PenaltyFunction< Curve >, and AbcdCalibration::AbcdError.

Definition at line 38 of file costfunction.hpp.

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

◆ values()

virtual Array values ( const Array x) const
pure virtual

method to overload to compute the cost function values in x

Implemented in LeastSquareFunction, ProjectedCostFunction, BasketGeneratingEngine::MatchHelper, XABRInterpolationImpl< I1, I2, Model >::XABRError, FrobeniusCostFunction, PenaltyFunction< Curve >, and AbcdCalibration::AbcdError.

+ Here is the caller graph for this function:

◆ gradient()

virtual void gradient ( Array grad,
const Array x 
) const
virtual

method to overload to compute grad_f, the first derivative of

Reimplemented in LeastSquareFunction.

Definition at line 49 of file costfunction.hpp.

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

◆ valueAndGradient()

virtual Real valueAndGradient ( Array grad,
const Array x 
) const
virtual

method to overload to compute grad_f, the first derivative of

Reimplemented in LeastSquareFunction.

Definition at line 64 of file costfunction.hpp.

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

◆ jacobian()

virtual void jacobian ( Matrix jac,
const Array x 
) const
virtual

method to overload to compute J_f, the jacobian of

Definition at line 72 of file costfunction.hpp.

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

◆ valuesAndJacobian()

virtual Array valuesAndJacobian ( Matrix jac,
const Array x 
) const
virtual

method to overload to compute J_f, the jacobian of

Definition at line 89 of file costfunction.hpp.

+ Here is the call graph for this function:

◆ finiteDifferenceEpsilon()

virtual Real finiteDifferenceEpsilon ( ) const
virtual

Default epsilon for finite difference method :

Definition at line 96 of file costfunction.hpp.

+ Here is the caller graph for this function: