70 nbParams_ = params.size();
71 if (nbParams_ == 0)
return;
74 unsigned int nbEvalMax = nbEvalMax_ /
static_cast<unsigned int>(nbParams_);
75 optimizer_.setMaximumNumberOfEvaluations(nbEvalMax);
76 optimizer_.setProfiler(getProfiler());
77 optimizer_.setMessageHandler(getMessageHandler());
78 optimizer_.getStopCondition()->setTolerance(getStopCondition()->getTolerance());
79 optimizer_.setConstraintPolicy(getConstraintPolicy());
80 optimizer_.setVerbose(getVerbose() > 0 ? getVerbose() - 1 : 0);
81 optimizer_.setInitialInterval(0., 1.);
82 getFunction()->setParameters(getParameters());
90 for (
unsigned int i = 0; i <
nbParams_; i++)
99 double t = std::max(0.000001, std::min(std::abs(v),
getStopCondition()->getTolerance()));
virtual void init()=0
Initialize the condition.
void setFunction(Function *function)
Set the function to optimize.
unsigned int getNumberOfEvaluations() const
Get the number of function evaluations performed since the call of the init function.
OptimizationStopCondition * getStopCondition()
Get the stop condition of the optimization algorithm.
unsigned int getVerbose() const
Get the verbose level.
This class allows to perform a correspondence analysis.
virtual bool matchParametersValues(const ParameterList ¶ms, std::vector< size_t > *updatedParameters=0)
Update the parameters from params.
This is the function abstract class.
ParameterList & getParameters_()
Stop condition on function value.
double doStep()
This function is called by the step() method and contains all calculations.
The parameter list object.
bool tolIsReached_
Tell if the tolerance level has been reached.
void setOptimizationProgressCharacter(const std::string &c)
Set the character to be displayed during optimization.
void setDefaultStopCondition_(OptimizationStopCondition *osc)
const Function * getFunction() const
Get the current function being optimized.
const ParameterList & getParameters() const
void doInit(const ParameterList ¶ms)
This function is called by the init() method and contains all calculations.
double optimize()
Initialize optimizer.
void setFunction(Function *function)
Set the function to optimize.
unsigned int nbEval_
The current number of function evaluations achieved.
Partial implementation of the Optimizer interface.
void setStopCondition(const OptimizationStopCondition &stopCondition)
Set the stop condition of the optimization algorithm.
BrentOneDimension optimizer_
SimpleMultiDimensions(Function *function)
void setInitialInterval(double inf, double sup)
Set intial search interval.
OptimizationStopCondition * getDefaultStopCondition()
Get the default stop condition of the optimization algorithm.
virtual double getValue() const =0
Get the value of the function at the current point.
void init(const ParameterList ¶ms)
Basic implementation.