35 #ifndef SHARK_ALGORITHMS_SIMPLEXDOWNHILL_H 36 #define SHARK_ALGORITHMS_SIMPLEXDOWNHILL_H 40 #include <boost/serialization/vector.hpp> 68 {
return "SimplexDownhill"; }
92 size_t dim = startingPoint.size();
96 m_simplex = std::vector<SolutionType>(dim + 1);
97 for (
size_t j=0; j<=dim; j++)
100 for (
size_t i=0; i<dim; i++) p(i) = startingPoint(i) + ((i == j) ? 1.0 : -0.5);
119 RealVector x0(dim, 0.0);
120 for (
size_t j=0; j<dim; j++) x0 +=
m_simplex[j].point;
125 xr.point = 2.0 * x0 - worst.point;
126 xr.value = objectiveFunction(xr.point);
128 if (best.value <= xr.value && xr.value <
m_simplex[dim-1].value)
133 else if (xr.value < best.value)
137 xe.point = 3.0 * x0 - 2.0 * worst.point;
138 xe.value = objectiveFunction(xe.point);
140 if (xe.value < xr.value)
155 xc.point = 0.5 * x0 + 0.5 * worst.point;
156 xc.value = objectiveFunction(xc.point);
158 if (xc.value < worst.value)
166 for (
size_t j=1; j<=dim; j++)