5 #include "../VectorTools.h" 25 size_t nbParams = params.
size();
30 function().setParameters(params);
33 for (
size_t i = 0; i < nbParams; ++i)
44 double gg, gam, f, dgg;
62 for (
unsigned j = 0; j < n; j++)
66 dgg += (
xi_[j] + g_[j]) *
xi_[j];
76 if (!(std::isnan(gam) || std::isinf(gam)))
78 for (
unsigned int j = 0; j < n; j++)
92 for (
size_t i = 0; i < gradient.size(); ++i)
virtual void enableFirstOrderDerivatives(bool yn)=0
Tell if derivatives must be computed.
std::shared_ptr< OptimizationStopCondition > getStopCondition() override
Get the stop condition of the optimization algorithm.
void setDefaultStopCondition_(std::shared_ptr< OptimizationStopCondition > osc)
ParameterList & getParameters_()
const ParameterList & getParameters() const override
double doStep()
This function is called by the step() method and contains all calculations.
std::vector< double > xi_
The parameter list object.
bool tolIsReached_
Tell if the tolerance level has been reached.
virtual double getFirstOrderDerivative(const std::string &variable) const =0
Get the derivative of the function at the current point.
unsigned int getVerbose() const override
Get the verbose level.
ConjugateGradientMultiDimensions(std::shared_ptr< FirstOrderDerivable > function)
void doInit(const ParameterList ¶ms)
This function is called by the init() method and contains all calculations.
unsigned int nbEval_
The current number of function evaluations achieved.
Partial implementation of the Optimizer interface.
const FirstOrderDerivable & firstOrderDerivableFunction() const
std::shared_ptr< DirectionFunction > f1dim_
std::shared_ptr< const FunctionInterface > getFunction() const override
Get the current function being optimized.
std::shared_ptr< OptimizationStopCondition > getDefaultStopCondition() override
Get the default stop condition of the optimization algorithm.
void getGradient(std::vector< double > &gradient) const
void setStopCondition(std::shared_ptr< OptimizationStopCondition > stopCondition) override
Set the stop condition of the optimization algorithm.