Constrained optimization problem. More...
#include <qle/math/problem_mt.hpp>
Public Member Functions | |
Problem_MT (const std::vector< boost::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 | |
Array | values (const Size i, const Array &x) |
call cost values i computation and increment evaluation counter | |
void | gradient (const Size i, Array &grad_f, const Array &x) |
call cost function i gradient computation and increment | |
Real | valueAndGradient (const Size i, Array &grad_f, const Array &x) |
call cost function i computation and it gradient | |
Constraint & | constraint () const |
Constraint. | |
Integer | availableCostFunctions () const |
number of available independent cost functions | |
boost::shared_ptr< CostFunction > | costFunction (const Size i) const |
Cost function. | |
const std::vector< boost::shared_ptr< CostFunction > > & | costFunctions () const |
Cost funcionts. | |
void | setCurrentValue (const Array ¤tValue) |
const Array & | currentValue () 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 | |
std::vector< boost::shared_ptr< CostFunction > > | costFunctions_ |
Unconstrained cost function. | |
Constraint & | constraint_ |
Constraint. | |
Array | currentValue_ |
current value of the local minimum | |
Real | functionValue_ |
function and gradient norm values at the curentValue_ (i.e. the last step) | |
Real | squaredNorm_ |
std::vector< Integer > | functionEvaluation_ |
number of evaluation of cost function and its gradient | |
std::vector< Integer > | gradientEvaluation_ |
Constrained optimization problem.
Problem_MT | ( | const std::vector< boost::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
void reset | ( | ) |