Overload List
Overload 1: int ConjGrad(TRealFunction Fun, TGrad Grad, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, bool FletcherAlgo = true, bool SoftLineSearch = true, int MaxIter = 500, double Tol = 1.0E-8, double GradTol = 1.0E-8, tStrings *Verbose = null);
Minimizes the function of several variables by using the Conjugate gradient optimization algorithm.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | Real function (must be of TRealFunction type) to be minimized. |
| 2 | Grad | TGrad | The gradient and Hessian procedure (must be of TGrad type), used for calculating the gradient. |
| 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 | StopReason | TOptStopReason & | Returns reason why minimum search stopped (see TOptStopReason). |
| 8 | FloatPrecision | const TMtxFloatPrecision | Specifies the floating point precision to be used by the routine. |
| 9 | FletcherAlgo = true | bool | If True, ConjGrad procedure will use Fletcher-Reeves method. If false, ConjGrad procedure will use Polak-Ribiere method. |
| 10 | SoftLineSearch = true | bool | Selects the line-search acceptance rule used along each conjugate direction. It is a true/false parameter and does not turn the gradient on or off - both modes are gradient based (the line search evaluates the gradient at each trial step). True (soft / inexact, the default) accepts the first step satisfying the Armijo sufficient-decrease condition f(x+alpha d) <= f(x) + rho alpha grad f^T d and is the robust choice for a NUMERICAL (finite-difference) gradient; False (exact / Wolfe) additionally enforces the curvature condition |grad f(x+alpha d)^T d| <= beta |grad f^T d| and should be used only with an exact gradient. "Soft off" is still a gradient-based search, just a stricter one. See also the same parameter on Optimization::BFGS. |
| 11 | MaxIter = 500 | int | Maximum allowed numer of minimum search iterations. |
| 12 | Tol = 1.0E-8 | double | Desired Pars - minimum position tolerance. |
| 13 | GradTol = 1.0E-8 | double | Minimum allowed gradient C-Norm. |
| 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 nonlinear conjugate-gradient method, generating search directions that are conjugate with respect to the local curvature (Fletcher-Reeves when FletcherAlgo=True, Polak-Ribiere when False) and a line search along each. The standard test 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 and 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)
Domain. Pars holds the n starting coordinates;
Grad returns the gradient (exact, or numerical with SoftLineSearch=True); MaxIter > 0; Tol,GradTol ≥ 0.
Defined behaviour. Returns the iteration count; Pars
holds the minimizer and FMin the minimum value. StopReason is an optimality cause (TOptStopReason::OptResConverged, TOptStopReason::OptResSmallGrad or
TOptStopReason::OptResSmallStep) or a non-convergence cause such as TOptStopReason::OptResMaxIter. A NaN from the objective propagates
into FMin.
Overload 2: int ConjGrad(TRealFunction Fun, TGrad Grad, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, const TMtxFloatPrecision FloatPrecision, bool FletcherAlgo);
Minimizes the function of several variables by using the Conjugate gradient optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | Grad | TGrad | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | FloatPrecision | const TMtxFloatPrecision | |
| 8 | FletcherAlgo | bool |
Overload 3: int ConjGrad(TRealFunction Fun, TGrad Grad, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, bool FletcherAlgo, bool SoftLineSearch);
Minimizes the function of several variables by using the Conjugate gradient optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | Grad | TGrad | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | StopReason | TOptStopReason & | |
| 8 | FloatPrecision | const TMtxFloatPrecision | |
| 9 | FletcherAlgo | bool | |
| 10 | SoftLineSearch | bool |
Overload 4: int ConjGrad(TRealFunction Fun, TGrad Grad, DewArray<double> &Pars, const DewArray<double> &Consts, const DewArray<tObject *> &ObjConst, double &FMin, TOptStopReason &StopReason, const TMtxFloatPrecision FloatPrecision, bool FletcherAlgo, bool SoftLineSearch, int MaxIter, double Tol, double GradTol);
Minimizes the function of several variables by using the Conjugate gradient optimization method with no log.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Fun | TRealFunction | |
| 2 | Grad | TGrad | |
| 3 | Pars | DewArray<double> & | |
| 4 | Consts | const DewArray<double> & | |
| 5 | ObjConst | const DewArray<tObject *> & | |
| 6 | FMin | double & | |
| 7 | StopReason | TOptStopReason & | |
| 8 | FloatPrecision | const TMtxFloatPrecision | |
| 9 | FletcherAlgo | bool | |
| 10 | SoftLineSearch | bool | |
| 11 | MaxIter | int | |
| 12 | Tol | double | |
| 13 | GradTol | double |