Constrained optimization problem. More...
#include <qle/math/problem_mt.hpp>
Public Member Functions | |
Problem_MT (const std::vector< QuantLib::ext::shared_ptr< CostFunction > > &costFunctions, Constraint &constraint, const Array &initialValue=Array()) | |
void | reset () |
Real | value (const Size i, const Array &x) |
call cost function i computation and increment evaluation counter More... | |
Array | values (const Size i, const Array &x) |
call cost values i computation and increment evaluation counter More... | |
void | gradient (const Size i, Array &grad_f, const Array &x) |
call cost function i gradient computation and increment More... | |
Real | valueAndGradient (const Size i, Array &grad_f, const Array &x) |
call cost function i computation and it gradient More... | |
Constraint & | constraint () const |
Constraint. More... | |
Integer | availableCostFunctions () const |
number of available independent cost functions More... | |
QuantLib::ext::shared_ptr< CostFunction > | costFunction (const Size i) const |
Cost function. More... | |
const std::vector< QuantLib::ext::shared_ptr< CostFunction > > & | costFunctions () const |
Cost funcionts. More... | |
void | setCurrentValue (const Array ¤tValue) |
const Array & | currentValue () const |
current value of the local minimum More... | |
void | setFunctionValue (Real functionValue) |
Real | functionValue () const |
value of cost function More... | |
void | setGradientNormValue (Real squaredNorm) |
Real | gradientNormValue () const |
value of cost function gradient norm More... | |
Integer | functionEvaluation () const |
number of evaluation of cost function More... | |
Integer | gradientEvaluation () const |
number of evaluation of cost function gradient More... | |
Protected Attributes | |
std::vector< QuantLib::ext::shared_ptr< CostFunction > > | costFunctions_ |
Unconstrained cost function. More... | |
Constraint & | constraint_ |
Constraint. More... | |
Array | currentValue_ |
current value of the local minimum More... | |
Real | functionValue_ |
function and gradient norm values at the curentValue_ (i.e. the last step) More... | |
Real | squaredNorm_ |
std::vector< Integer > | functionEvaluation_ |
number of evaluation of cost function and its gradient More... | |
std::vector< Integer > | gradientEvaluation_ |
Constrained optimization problem.
Definition at line 64 of file problem_mt.hpp.
Problem_MT | ( | const std::vector< QuantLib::ext::shared_ptr< CostFunction > > & | costFunctions, |
Constraint & | constraint, | ||
const Array & | initialValue = Array() |
||
) |
The requirement is that the cost functions can be evaluated from multiple threads without data races, which can e.g. be done by complete separation of the underlying data. Note that some methods in this class are not thread safe, namely reset, setCurrentValue, setFunctionValue, setGradientNormValue, i.e. those can not be used from several threads in a mt optimizer
Definition at line 72 of file problem_mt.hpp.
void reset | ( | ) |
Definition at line 172 of file problem_mt.hpp.
Real value | ( | const Size | i, |
const Array & | x | ||
) |
call cost function i computation and increment evaluation counter
Definition at line 150 of file problem_mt.hpp.
Array values | ( | const Size | i, |
const Array & | x | ||
) |
call cost values i computation and increment evaluation counter
Definition at line 155 of file problem_mt.hpp.
void gradient | ( | const Size | i, |
Array & | grad_f, | ||
const Array & | x | ||
) |
call cost function i gradient computation and increment
Definition at line 160 of file problem_mt.hpp.
Real valueAndGradient | ( | const Size | i, |
Array & | grad_f, | ||
const Array & | x | ||
) |
call cost function i computation and it gradient
Definition at line 165 of file problem_mt.hpp.
Constraint & constraint | ( | ) | const |
Integer availableCostFunctions | ( | ) | const |
QuantLib::ext::shared_ptr< CostFunction > costFunction | ( | const Size | i | ) | const |
const std::vector< QuantLib::ext::shared_ptr< CostFunction > > & costFunctions | ( | ) | const |
Cost funcionts.
Definition at line 108 of file problem_mt.hpp.
void setCurrentValue | ( | const Array & | currentValue | ) |
Definition at line 110 of file problem_mt.hpp.
const Array & currentValue | ( | ) | const |
current value of the local minimum
Definition at line 115 of file problem_mt.hpp.
void setFunctionValue | ( | Real | functionValue | ) |
Definition at line 117 of file problem_mt.hpp.
Real functionValue | ( | ) | const |
value of cost function
Definition at line 122 of file problem_mt.hpp.
void setGradientNormValue | ( | Real | squaredNorm | ) |
Definition at line 124 of file problem_mt.hpp.
Real gradientNormValue | ( | ) | const |
Integer functionEvaluation | ( | ) | const |
number of evaluation of cost function
Definition at line 179 of file problem_mt.hpp.
Integer gradientEvaluation | ( | ) | const |
number of evaluation of cost function gradient
Definition at line 186 of file problem_mt.hpp.
|
protected |
Unconstrained cost function.
Definition at line 138 of file problem_mt.hpp.
|
protected |
Definition at line 140 of file problem_mt.hpp.
|
protected |
current value of the local minimum
Definition at line 142 of file problem_mt.hpp.
|
protected |
function and gradient norm values at the curentValue_ (i.e. the last step)
Definition at line 144 of file problem_mt.hpp.
|
protected |
Definition at line 144 of file problem_mt.hpp.
|
protected |
number of evaluation of cost function and its gradient
Definition at line 146 of file problem_mt.hpp.
|
protected |
Definition at line 146 of file problem_mt.hpp.