Overload List
Overload 1: int Marquardt(TRealFunction Fun, TGradHess GradHess, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TMtx *IHess, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, int MaxIter = 500, double Tol = 1.0E-8, double GradTol = 1.0E-8, double Lambda0 = 1e-2, tStrings *Verbose = null);
Minimizes the function of several variables by using the Marquardt optimization algorithm.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | Real function (must be of TRealFunction type) to be minimized. |
| 2 | GradHess | TGradHess | The gradient and Hessian procedure (must be of TGradHess type), used for calculating the gradient and Hessian matrix. |
| 3 | Pars | DewArray<double> & | Stores the initial estimates for parameters (minimum estimate). After the call to routine returns adjusted calculated values (minimum position). |
| 4 | Consts | const DewArray<double> & | Additional Fun constant parameteres (can be/is usually nil). |
| 5 | ObjConst | const DewArray<tObject *> & | Additional Fun constant parameteres (can be/is usually nil). |
| 6 | FMin | double & | Returns function value at minimum. |
| 7 | IHess | TMtx * | Returns inverse Hessian matrix. |
| 8 | StopReason | TOptStopReason & | Returns reason why minimum search stopped (see TOptStopReason). |
| 9 | FloatPrecision | const TMtxFloatPrecision | Specifies the floating point precision to be used by the routine. |
| 10 | MaxIter = 500 | int | Maximum allowed numer of minimum search iterations. |
| 11 | Tol = 1.0E-8 | double | Desired Pars - minimum position tolerance. |
| 12 | GradTol = 1.0E-8 | double | Minimum allowed gradient C-Norm. |
| 13 | Lambda0 = 1e-2 | double | Initial lambda step, used in Marquardt algorithm. |
| 14 | 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 smooth real function of several
variables with the Levenberg-Marquardt method, solving a damped Newton step (H+lambda I) delta=-g and adapting the damping lambda (started from Lambda0) between gradient-descent and Newton behaviour. It needs both the gradient and the Hessian via GradHess. The standard test objective is
f(x_0,x_1) = 100 (x_1 - x_0^2)^2 + (1 - x_0)^2
with global minimum f=0 at , gradient
(d f)/(d x_0) = -400 (x_1 - x_0^2) x_0 - 2 (1 - x_0), (d f)/(d x_1) = 200 (x_1 - x_0^2)
and Hessian
H(f) = [ 1200 x_0^2 - 400 x_1 + 2 -400 x_0 ]
[ -400 x_0 200 ]
Domain. Pars holds the n starting coordinates;
GradHess returns the gradient and (symmetric) Hessian; MaxIter > 0; Tol,GradTol ≥ 0; Lambda0 > 0.
Defined behaviour. Returns the iteration count; Pars
holds the minimizer, FMin the minimum and IHess the inverse Hessian. StopReason reports the cause - TOptStopReason::OptResConverged/TOptStopReason::OptResSmallGrad on success, TOptStopReason::optNANValue if the objective returned NaN, or TOptStopReason::OptResBigLambda/TOptStopReason::OptResSmallLambda/ TOptStopReason::OptResMaxIter otherwise.
Overload 2: int Marquardt(TRealFunction Fun, TGradHess GradHess, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, const TMtxFloatPrecision FloatPrecision);
Minimizes the function of several variables by using the Marquardt optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | GradHess | TGradHess | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | FloatPrecision | const TMtxFloatPrecision |
Overload 3: int Marquardt(TRealFunction Fun, TGradHess GradHess, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision);
Minimizes the function of several variables by using the Marquardt optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | GradHess | TGradHess | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | StopReason | TOptStopReason & | |
| 8 | FloatPrecision | const TMtxFloatPrecision |
Overload 4: int Marquardt(TRealFunction Fun, TGradHess GradHess, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TMtx *IHess, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, int MaxIter, double Tol, double GradTol, double Lambda0);
Minimizes the function of several variables by using the Marquardt optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | GradHess | TGradHess | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | IHess | TMtx * | |
| 8 | StopReason | TOptStopReason & | |
| 9 | FloatPrecision | const TMtxFloatPrecision | |
| 10 | MaxIter | int | |
| 11 | Tol | double | |
| 12 | GradTol | double | |
| 13 | Lambda0 | double |