Create Solver Object
What Is a Solver Object?
A solver object contains your preferences for the global portion of the optimization.
You do not need to set any preferences. Create a GlobalSearch object
named gs with default settings as follows:
gs = GlobalSearch;
Similarly, create a MultiStart object named ms with
default settings as follows:
ms = MultiStart;
Properties (Global Options) of Solver Objects
Global options are properties of a GlobalSearch or MultiStart object.
Properties for both GlobalSearch and MultiStart
| Property Name | Meaning |
|---|---|
Display | Detail level of iterative display. Set to 'off' for
no display, 'final' (default) for a report at the
end of the run, or 'iter' for reports as the solver
progresses. For more information and examples, see Iterative Display. |
FunctionTolerance | Solvers consider objective function values within FunctionTolerance of
each other to be identical (not distinct). Default: 1e-6.
Solvers group solutions when the solutions satisfy both FunctionTolerance and XTolerance tolerances. |
XTolerance | Solvers consider solutions within XTolerance distance
of each other to be identical (not distinct). Default: 1e-6.
Solvers group solutions when the solutions satisfy both FunctionTolerance and XTolerance tolerances. |
MaxTime | Solvers halt if the run exceeds MaxTime seconds,
as measured by a clock (not processor seconds). Default: Inf |
StartPointsToRun | Choose whether to run 'all' (default) start
points, only those points that satisfy 'bounds',
or only those points that are feasible with respect to bounds and
inequality constraints with 'bounds-ineqs'. For
an example, see Optimize Using Only Feasible Start Points. |
OutputFcn | Functions to run after each local solver run. See Output Functions for GlobalSearch and MultiStart.
Default: [] |
PlotFcn | Plot functions to run after each local solver run. See Plot Functions for GlobalSearch and MultiStart.
Default: [] |
Properties for GlobalSearch
| Property Name | Meaning |
|---|---|
NumTrialPoints | Number of trial points to examine. Default: 1000 |
BasinRadiusFactor |
See |
DistanceThresholdFactor | |
MaxWaitCycle | |
NumStageOnePoints | |
PenaltyThresholdFactor |
Properties for MultiStart
| Property Name | Meaning |
|---|---|
UseParallel | When true, MultiStart attempts
to distribute start points to multiple processors for the local solver.
Disable by setting to false (default). For details,
see How to Use Parallel Processing in Global Optimization Toolbox.
For an example, see Parallel MultiStart. |
Creating a Nondefault GlobalSearch Object
Suppose you want to solve a problem and:
Consider local solutions identical if they are within 0.01 of each other and the function values are within the default
FunctionTolerancetolerance.Spend no more than 2000 seconds on the computation.
To solve the problem, create a GlobalSearch object gs as
follows:
gs = GlobalSearch('XTolerance',0.01,'MaxTime',2000);
Creating a Nondefault MultiStart Object
Suppose you want to solve a problem such that:
You consider local solutions identical if they are within 0.01 of each other and the function values are within the default
FunctionTolerancetolerance.You spend no more than 2000 seconds on the computation.
To solve the problem, create a MultiStart object ms as
follows:
ms = MultiStart('XTolerance',0.01,'MaxTime',2000);