Gromacs
2021-beta2-UNCHECKED
|
#include <gromacs/math/neldermead.h>
The simplex for the Nelder-Mead algorithm.
Contains the N+1 simplex N-dimensional coordinates and its function values. Allows for simplex manipulations as needed for the Nelder-Mead algorithm.
Public Member Functions | |
NelderMeadSimplex (const std::function< real(ArrayRef< const real >)> &f, ArrayRef< const real > initalGuess) | |
Set up Nelder-Mead simplex from an initial guess. More... | |
const RealFunctionvalueAtCoordinate & | bestVertex () const |
Return the vertex with the lowest function value at any of the simplex vertices. | |
const RealFunctionvalueAtCoordinate & | worstVertex () const |
Return the vertex of the simplex with the highest (worst) function value. | |
real | secondWorstValue () const |
Return the second largest function value at any of the simplex vertices. | |
RealFunctionvalueAtCoordinate | evaluateReflectionPoint (const std::function< real(ArrayRef< const real >)> &f) const |
Return the reflection point and the evaluated function value at this point. | |
RealFunctionvalueAtCoordinate | evaluateExpansionPoint (const std::function< real(ArrayRef< const real >)> &f) const |
Evaluate and return the expansion point and function value. | |
RealFunctionvalueAtCoordinate | evaluateContractionPoint (const std::function< real(ArrayRef< const real >)> &f) const |
Evaluate and return the contraction point and function value. | |
void | swapOutWorst (const RealFunctionvalueAtCoordinate &newVertex) |
Replace the simplex vertex with the largest function value. More... | |
void | shrinkSimplexPointsExceptBest (const std::function< real(ArrayRef< const real >)> &f) |
Shrink the simplex. More... | |
real | orientedLength () const |
The oriented length of the vertex. More... | |
gmx::NelderMeadSimplex::NelderMeadSimplex | ( | const std::function< real(ArrayRef< const real >)> & | f, |
ArrayRef< const real > | initalGuess | ||
) |
Set up Nelder-Mead simplex from an initial guess.
[in] | f | the function to be evaluated |
[in] | initalGuess | initial guess of the coordinates. |
real gmx::NelderMeadSimplex::orientedLength | ( | ) | const |
The oriented length of the vertex.
The oriented length of the simplex is defined as the largest distance between the first simplex vertex coordinate (with the lowest, best function value) and any other simplex coordinate.
The oriented length is used as a computationally fast and simple convergence criterion because it is proven that orientedLegnth < simplex_diameter < 2 * orientedLength
void gmx::NelderMeadSimplex::shrinkSimplexPointsExceptBest | ( | const std::function< real(ArrayRef< const real >)> & | f | ) |
Shrink the simplex.
All points move closer to the best point by a factor .
Replace all point coordinates, except the best, with
void gmx::NelderMeadSimplex::swapOutWorst | ( | const RealFunctionvalueAtCoordinate & | newVertex | ) |
Replace the simplex vertex with the largest function value.
[in] | newVertex | to replace the worst vertex with |