NuriKit v0.1.0b2
Loading...
Searching...
No Matches
nuri::NelderMead Class Reference

Nelder-Mead simplex algorithm for function minimization. More...

#include <nuri/algo/optim.h>

Public Member Functions

 NelderMead (MutRef< ArrayXXd > data)
 Prepare Nelder-Mead simplex algorithm.
auto n () const
int argmax () const
auto min () const
double minf () const
auto max ()
auto max () const
double maxf () const
double max2f () const
template<class Func>
NMResult minimize (Func f, int maxiter=-1, const double ftol=1e-6, const double alpha=1, const double gamma=2, const double rho=0.5, const double sigma=0.5)
 Minimize a function using Nelder-Mead simplex algorithm.

Static Public Member Functions

static constexpr int argmin ()

Detailed Description

Nelder-Mead simplex algorithm for function minimization.

See also
nelder_mead

References:

Constructor & Destructor Documentation

◆ NelderMead()

nuri::NelderMead::NelderMead ( MutRef< ArrayXXd > data)
explicit

Prepare Nelder-Mead simplex algorithm.

Parameters
dataInitial simplex data. When the problem is N-dimensional, the data should be (N + 1, N + 1) matrix, where the first N rows form the N + 1 simplex vertices of dimension N, which will be modified in-place. The last row need not be initialized, but will be populated on-demand with the function value of each vertex.

Member Function Documentation

◆ argmax()

int nuri::NelderMead::argmax ( ) const
inline

◆ argmin()

constexpr int nuri::NelderMead::argmin ( )
inlinestaticconstexpr

◆ max() [1/2]

auto nuri::NelderMead::max ( )
inline

◆ max() [2/2]

auto nuri::NelderMead::max ( ) const
inline

◆ max2f()

double nuri::NelderMead::max2f ( ) const
inline

◆ maxf()

double nuri::NelderMead::maxf ( ) const
inline

◆ min()

auto nuri::NelderMead::min ( ) const
inline

◆ minf()

double nuri::NelderMead::minf ( ) const
inline

◆ minimize()

template<class Func>
NMResult nuri::NelderMead::minimize ( Func f,
int maxiter = -1,
const double ftol = 1e-6,
const double alpha = 1,
const double gamma = 2,
const double rho = 0.5,
const double sigma = 0.5 )
inline

Minimize a function using Nelder-Mead simplex algorithm.

Template Parameters
FuncFunction object that computes the function value. The function value should be returned.
Parameters
fFunction object.
maxiterMaximum number of iterations. If negative or zero, it will be set to N * 200, where N is the number of dimensions.
ftolTolerance for the absolute change in the function value.
alphaReflection coefficient. Must be > 0.
gammaExpansion coefficient. Must be > 1.
rhoContraction coefficient. Must be in range (0, 1).
sigmaShrink coefficient. Must be in range (0, 1).
Returns
The result of the optimization, including the result code and the index of the best vertex.
Note
The data matrix will be modified in-place, and the last row will be populated with the function values of each vertex.

◆ n()

auto nuri::NelderMead::n ( ) const
inline

The documentation for this class was generated from the following file: