v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::SimplexAlgorithm Class Reference

Simplex algorithm. More...

#include <simplex_algorithm.h>

Static Public Member Functions

template<typename T, typename CostFunc, typename ReportFunc>
static bool simplex_minimize (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &p, Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, T ftol, T stol, CostFunc &&func, int max_eval, int &neval, int report, ReportFunc &&report_func)
template<typename T, typename CostFunc>
static bool simplex_minimize (Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &p, Eigen::Matrix< T, Eigen::Dynamic, 1 > &y, T ftol, T stol, CostFunc &&func, int max_eval, int &neval)

Protected Member Functions

 SimplexAlgorithm ()

Detailed Description

Simplex algorithm.

Simplex algorithm is an optimization method to solve linear optimization problems.

Note
Implements the Strategy pattern — the cost function and report function are injected as callable template parameters (zero-overhead type erasure).

Definition at line 66 of file simplex_algorithm.h.

Constructor & Destructor Documentation

◆ SimplexAlgorithm()

UTILSLIB::SimplexAlgorithm::SimplexAlgorithm ( )
protected

Protected constructor to make class non-instantiable.

Member Function Documentation

◆ simplex_minimize() [1/2]

template<typename T, typename CostFunc>
bool UTILSLIB::SimplexAlgorithm::simplex_minimize ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & p,
Eigen::Matrix< T, Eigen::Dynamic, 1 > & y,
T ftol,
T stol,
CostFunc && func,
int max_eval,
int & neval )
static

Overload without report function (no reporting).

Definition at line 177 of file simplex_algorithm.h.

◆ simplex_minimize() [2/2]

template<typename T, typename CostFunc, typename ReportFunc>
bool UTILSLIB::SimplexAlgorithm::simplex_minimize ( Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & p,
Eigen::Matrix< T, Eigen::Dynamic, 1 > & y,
T ftol,
T stol,
CostFunc && func,
int max_eval,
int & neval,
int report,
ReportFunc && report_func )
static

mne_simplex_fit.c Refactored: mne_simplex_minimize

Minimization with the simplex algorithm. Modified from Numerical Recipes. Supports an optional absolute spatial tolerance (stol) to detect simplex collapse.

Template Parameters
TScalar type (float or double).
CostFuncCallable with signature T(const VectorX<T>&). Evaluates the cost at a simplex vertex.
ReportFuncCallable with signature bool(int loop, const VectorX<T>& fitpar, double fval_lo, double fval_hi, double par_diff).
Parameters
[in,out]pThe initial simplex (npar+1 x npar). On return, row 0 is the best vertex.
[in,out]yFunction values at the vertices.
[in]ftolRelative convergence tolerance.
[in]stolAbsolute spatial convergence tolerance (0 to disable).
[in]funcThe cost function to be evaluated.
[in]max_evalMaximum number of function evaluations.
[out]nevalNumber of function evaluations performed.
[in]reportHow often to report (-1 = no reporting).
[in]report_funcThe function to be called when reporting (may be nullptr).
Returns
True when minimization succeeded, false otherwise.

Definition at line 192 of file simplex_algorithm.h.


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