41 #include "../NumTools.h"
59 AbstractOptimizer(function), simplex_(), y_(), pSum_(), iHighest_(0), iNextHighest_(0), iLowest_(0)
71 size_t nDim = getParameters().size();
75 simplex_.resize(nDim + 1);
78 for(
unsigned int i = 1; i < nDim + 1; i++)
81 simplex_[i] = getParameters();
83 for(
unsigned int j = 0; j < nDim; j++)
87 simplex_[i][j].setValue(getParameters()[j].getValue() + (j == i - 1 ? lambda : 0.));
90 y_[i] = getFunction()->f(simplex_[i]);
94 simplex_[0] = getParameters();
95 y_[0] = getFunction()->f(simplex_[0]);
107 size_t mpts = nDim + 1;
124 for(
unsigned int i = 0; i < mpts; i++)
155 for (
size_t i = 0; i < mpts; i++)
159 for (
size_t j = 0; j < nDim; j++)
168 nbEval_ +=
static_cast<unsigned int>(nDim);
191 size_t mpts = ndim + 1;
196 for (
size_t j = 0; j < ndim; j++)
199 for (
size_t i = 0; i < mpts; i++)
203 pSum[j].setValue(sum);
213 double fac1, fac2, yTry;
215 fac1 = (1.0 - fac) / static_cast<double>(ndim);
221 for (
size_t j = 0; j < ndim; j++)
233 for (
size_t j = 0; j < ndim; j++)
235 pSum_[j].setValue(
pSum_[j].getValue() + pTry[j].getValue() -
simplex_[iHighest_][j].getValue());