class TMtxOptimization : public TMtxComponent;
Interfaces the optimization routines.
The component can be used to find the minimum of function of several variables.
How to use TMtxOptimization component?
- Drop a TMtxOptimization component on the form.
- Define the number of variables and their initial values by accessing the TMtxOptimization::VariableParameters vector.
- Define any additional constant parameters by accessing TMtxOptimization::ConstantParameters vector.
- Define any additional constant pointer parameter by using the TMtxOptimization::SetObjects method.
- Define real function (must be of TRealFunction type).
- Define optimization method by accessing the TMtxOptimization::OptimizationMethod property.
- Depending on optimization method you'll have to (optionally) define the gradient calculation procedure (TMtxOptimization::GradProcedure method) or gradient/Hessian matrix calculation procedure (TMtxOptimization::GradHessProcedure method). If you don't specify the GradProcedure or GradHessProcedure then the numeric approximation will be used to calculate the gradient vector and Hessian matrix. In this case you must also specify which gradient aproximation method you will use - access the TMtxOptimization::NumericGradMethod property.
- Call the TMtxOptimization::Recalculate method to find the minimum of function of several variables.
Results:
- TMtxOptimization::MinValue : RealFunction, evaluated at minimum.
- TMtxOptimization::VariableParameters : minimum position.
- TMtxOptimization::Iterations: Number of iterations needed to reach specified (TMtxOptimization::Tolerance property) minimum precision.
- TMtxOptimization::InverseHess : Inverse Hessian matrix (returned only by BFGS, ConjGrad and Marquardt methods)
- TMtxOptimization::StopReason: Why did the optimization algorithm stopped ?
Constructors
| Name | Description |
|---|---|
| TMtxOptimization (2) |
Destructors
| Name | Description |
|---|---|
| ~TMtxOptimization |
Properties
| Name | Type | Description |
|---|---|---|
| AutoUpdate | bool | Automatic recalculation. |
| BlockAssign | bool | Block streaming of specific properties when storing only a "template". |
| ConstantParameters | TVec* | set/read the additional constants used in minimized function. |
| Dirty | bool | Becomes true after any of the properties have changed. |
| EditorActive | bool | Returns True, if the component editor is displayed. |
| GradHessProcedure | TGradHess | Defines the gradient vector and Hessian matrix calculation routine. |
| GradProcedure | TGrad | Defines the gradient vector calculation routine. |
| GradTolerance | double | The precision for numeric gradient and/or Hessian matrix calculation. |
| Lambda0 | double | Initial lambda step used in Marquardt optimization algorithm. |
| MaxIterations | int | maximum number of iterations allowed for minimum search. |
| Name | DewString | |
| NumericGradMethod | TNumericGradMethod | Defines which gradient numerical approximation method will be used to to evaluate gradient. |
| OptimizationMethod | TOptMethod | Optimization algorithm used for minimum search. |
| RealFunction | TRealFunction | Defines the function to be minimized. |
| Reference | TReferenceList* | Stores a list of components that have to be notified, when this component is destroyed. |
| SoftSearch | bool | Internal line search algorithm. |
| StopReason | TOptStopReason | Stop reason for optimization algorithm. |
| Tolerance | double | Precision. |
| VariableParameters | TVec* | Set/read the variables in minimized function. |
| Verbose | tStrings* | If not nil then the optimization method uses it for logging each optimization step. |
Methods
| Name | Description |
|---|---|
| AllowStreaming | Returns the negatated value of BlockAssign. |
| Assign | Assign values of all published properties from Source. |
| AssignTemplate | Assign values of "template-like" published properties from Source. |
| EditorClass | |
| LoadFromStream | Load the component from Src stream. |
| LoadTemplateFromFile | Load a template from file. |
| LoadTemplateFromStream | Load a template from stream. |
| Recalculate | Triggers TMtxOptimization recalculation. |
| ReferenceRemoved | |
| Reset | Reset is called after loading the data from stream or file. |
| SaveTemplateToFile | Save template to file. |
| SaveTemplateToStream | Save template to stream. |
| SaveToStream | Save the component to Dst stream. |
| SetObjects | Define any additional Object constant parameters in the RealFunction. |
Fields
| Name | Type | Description |
|---|---|---|
| InverseHess | TMtx * | Returns the inverse of Hessian matrix. |
| Iterations | int | Returns number of optimization algorithm iterations. |
| MinValue | double | Stores value of the objective function, evaluated at minimum. |
| Tag | intptr_t |