QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
CostFunction Class Referenceabstract

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

#include <ql/math/optimization/costfunction.hpp>

Inheritance diagram for CostFunction:

Public Member Functions

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

Detailed Description

Cost function abstract class for optimization problem.

Examples
GlobalOptimizer.cpp.

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 LeastSquareFunction, PenaltyFunction< Curve >, and ProjectedCostFunction.

◆ values()

virtual Array values ( const Array & x) const
pure virtual

method to overload to compute the cost function values in x

Implemented in LeastSquareFunction, PenaltyFunction< Curve >, and ProjectedCostFunction.

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

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