Nelder-Mead simplex algorithm for function minimization.
More...
#include <nuri/algo/optim.h>
|
| | 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 constexpr int | argmin () |
Nelder-Mead simplex algorithm for function minimization.
- See also
- nelder_mead
References:
◆ NelderMead()
| nuri::NelderMead::NelderMead |
( |
MutRef< ArrayXXd > | data | ) |
|
|
explicit |
Prepare Nelder-Mead simplex algorithm.
- Parameters
-
| data | Initial 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. |
◆ 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
-
| Func | Function object that computes the function value. The function value should be returned. |
- Parameters
-
| f | Function object. |
| maxiter | Maximum number of iterations. If negative or zero, it will be set to N * 200, where N is the number of dimensions. |
| ftol | Tolerance for the absolute change in the function value. |
| alpha | Reflection coefficient. Must be > 0. |
| gamma | Expansion coefficient. Must be > 1. |
| rho | Contraction coefficient. Must be in range (0, 1). |
| sigma | Shrink 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: