Overload List
Overload 1: int Simplex(TRealFunction Func, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision = TMtxFloatPrecision::mvDouble, int MaxIter = 500, double Tolerance = 1.0E-8, tStrings *Verbose = null);
Minimizes the function of several variables by using the Nelder-Mead (Simplex) optimization method.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Func | TRealFunction | Real function (must be of TRealFunction type) to be minimized. |
| 2 | Pars | DewArray<double> & | Stores the initial estimates for parameters (minimum estimate). After the call to routine returns adjusted calculated values (minimum position). |
| 3 | Consts | const DewArray<double> & | Additional Fun constant parameteres (can be/is usually nil). |
| 4 | ObjConst | const DewArray<tObject *> & | Additional Fun constant parameteres (can be/is usually nil). |
| 5 | FMin | double & | Returns function value at minimum. |
| 6 | StopReason | TOptStopReason & | Returns reason why minimum search stopped (see TOptStopReason). |
| 7 | FloatPrecision = TMtxFloatPrecision::mvDouble | const TMtxFloatPrecision | Specifies the floating point precision to be used by the routine. |
| 8 | MaxIter = 500 | int | Maximum allowed numer of minimum search iterations. |
| 9 | Tolerance = 1.0E-8 | double | Desired Pars - minimum position tolerance. |
| 10 | Verbose = null | tStrings * | If assigned, stores Fun, evaluated at each iteration step. Optionally, you can also pass TOptControl object to the Verbose parameter. This allows the optimization procedure to be interrupted from another thread and optionally also allows logging and iteration count monitoring. |
Returns: the number of iterations required to reach the solution(minimum) within given tolerance.
What it computes. Minimizes a real function of several
variables with the gradient-free Nelder-Mead (downhill simplex) method - reflection, expansion, contraction and shrink steps on a simplex of n+1 vertices. No gradient or Hessian is required. The standard test ('Banana'/Rosenbrock) objective is
f(x_0,x_1) = 100 (x_1 - x_0^2)^2 + (1 - x_0)^2
with the global minimum f=0 at (x_0,x_1)=(1,1).
Domain. Pars holds the n starting coordinates (any
finite reals); MaxIter > 0; Tolerance ≥ 0 is the simplex-size convergence threshold.
Defined behaviour. On return Pars holds the best vertex,
FMin its objective value, and StopReason is TOptStopReason::OptResConverged when the simplex shrank below Tolerance, TOptStopReason::OptResMaxIter when the iteration cap was hit, or TOptStopReason::optNANValue if the objective returned NaN. The bounded overload (with LB/UB) maps each parameter through a smooth transform so the returned point always satisfies LB_i <= Pars_i <= UB_i; use +/-inf for a one-sided or absent bound.
Minimizes the function of several variables by using the Nelder-Mead (Simplex) optimization method. The advantage of Simplex method is it does not require gradient or Hessian.
Overload 2: int Simplex(TRealFunction Func, double &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, int MaxIter, double Tolerance);
Minimizes function of several variables by using Simplex optimization method with no algorithm step log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Func | TRealFunction | |
| 2 | Pars | double & | |
| 3 | Consts | const DewArray<double> & | |
| 4 | ObjConst | const DewArray<tObject *> & | |
| 5 | FMin | double & | |
| 6 | StopReason | TOptStopReason & | |
| 7 | FloatPrecision | const TMtxFloatPrecision | |
| 8 | MaxIter | int | |
| 9 | Tolerance | double |
Overload 3: int Simplex(TRealFunction Func, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, const DewArray<double> &LB, const DewArray<double> &UB, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, int MaxIter = 500, double Tolerance = 1.0E-8, tStrings *Verbose = null);
Minimize function of several variables by using Simplex method with lower and/or upper bounds for parameters.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Func | TRealFunction | |
| 2 | Pars | DewArray<double> & | |
| 3 | Consts | const DewArray<double> & | |
| 4 | ObjConst | const DewArray<tObject *> & | |
| 5 | LB | const DewArray<double> & | |
| 6 | UB | const DewArray<double> & | |
| 7 | FMin | double & | |
| 8 | StopReason | TOptStopReason & | |
| 9 | FloatPrecision | const TMtxFloatPrecision | |
| 10 | MaxIter = 500 | int | |
| 11 | Tolerance = 1.0E-8 | double | |
| 12 | Verbose = null | tStrings * |
This version supports lower and upper bound(s) for function parameters Pars. Lower and upper bounds are defined in LB and UP arrays respectively. Depending on lower and/or upper bound for parameter, there are several possibilities for LB and UB:
- Lower and upper bound: For each parameter both LB and UB should be set to specific value.
- Upper bound only: In this case, LB is set to -INF, UB to specific value.
- Lower bound only: In this case, LB should be set to specific value, UB to +INF.
- No bounds: In this case, use non-bounded Simplex version or set LB and UB to -INF and +INF respecively.