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

Constrained optimization problem. More...

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

Public Member Functions

 Problem (CostFunction &costFunction, Constraint &constraint, Array initialValue=Array())
 default constructor
void reset ()
Real value (const Array &x)
 call cost function computation and increment evaluation counter
Array values (const Array &x)
 call cost values computation and increment evaluation counter
void gradient (Array &grad_f, const Array &x)
 call cost function gradient computation and increment
Real valueAndGradient (Array &grad_f, const Array &x)
 call cost function computation and it gradient
Constraintconstraint () const
 Constraint.
CostFunctioncostFunction () const
 Cost function.
void setCurrentValue (Array currentValue)
const ArraycurrentValue () const
 current value of the local minimum
void setFunctionValue (Real functionValue)
Real functionValue () const
 value of cost function
void setGradientNormValue (Real squaredNorm)
Real gradientNormValue () const
 value of cost function gradient norm
Integer functionEvaluation () const
 number of evaluation of cost function
Integer gradientEvaluation () const
 number of evaluation of cost function gradient

Protected Attributes

CostFunctioncostFunction_
 Unconstrained cost function.
Constraintconstraint_
 Constraint.
Array currentValue_
 current value of the local minimum
Real functionValue_
 function and gradient norm values at the currentValue_ (i.e. the last step)
Real squaredNorm_
Integer functionEvaluation_
 number of evaluation of cost function and its gradient
Integer gradientEvaluation_

Detailed Description

Constrained optimization problem.

Warning
The passed CostFunction and Constraint instances are stored by reference. The user of this class must make sure that they are not destroyed before the Problem instance.
Examples
GlobalOptimizer.cpp.

Member Function Documentation

◆ reset()

void reset ( )
Warning
it does not reset the current minumum to any initial value