42 #include "../NumTools.h"
61 AbstractOptimizer(function), simplex_(), y_(), pSum_(), iHighest_(0), iNextHighest_(0), iLowest_(0)
80 for (
unsigned int i = 1; i < nDim + 1; i++)
85 for (
unsigned int j = 0; j < nDim; j++)
109 size_t mpts = nDim + 1;
126 for (
unsigned int i = 0; i < mpts; i++)
159 for (
size_t i = 0; i < mpts; i++)
163 for (
size_t j = 0; j < nDim; j++)
172 nbEval_ +=
static_cast<unsigned int>(nDim);
195 size_t mpts = ndim + 1;
200 for (
size_t j = 0; j < ndim; j++)
203 for (
size_t i = 0; i < mpts; i++)
207 pSum[j].setValue(sum);
217 double fac1, fac2, yTry;
219 fac1 = (1.0 - fac) /
static_cast<double>(ndim);
225 for (
size_t j = 0; j < ndim; j++)
237 for (
size_t j = 0; j < ndim; j++)
Partial implementation of the Optimizer interface.
double optimize()
Basic implementation.
OptimizationStopCondition * getDefaultStopCondition()
Get the default stop condition of the optimization algorithm.
unsigned int nbEvalMax_
The maximum number of function evaluations allowed.
unsigned int nbEval_
The current number of function evaluations achieved.
const ParameterList & getParameters() const
void setStopCondition(const OptimizationStopCondition &stopCondition)
Set the stop condition of the optimization algorithm.
ParameterList & getParameters_()
const Function * getFunction() const
Get the current function being optimized.
void setDefaultStopCondition_(OptimizationStopCondition *osc)
double getCurrentTolerance() const
Get the current tolerance.
size_t getDimension() const
This implements the Downhill Simplex method in multidimensions.
double doStep()
This function is called by the step() method and contains all calculations.
friend class DSMStopCondition
DownhillSimplexMethod(Function *function)
Build a new Downhill Simplex optimizer.
unsigned int iNextHighest_
ParameterList getPSum()
Update the pSum_ variable.
void doInit(const ParameterList ¶ms)
This function is called by the init() method and contains all calculations.
double optimize()
Multidimensional minimization of the function function_ by the downhill simplex method of Nelder and ...
double tryExtrapolation(double fac)
Extrapolates by a factor fac through the face of the simplex from the high point. Try the new point a...
This is the function abstract class.
virtual double f(const ParameterList ¶meters)
Get the value of the function according to a given set of parameters.
The parameter list object.