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 NameMeaning
DisplayDetail 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.
TolFunSolvers consider objective function values within TolFun of each other to be identical (not distinct). Default: 1e-6. Solvers group solutions when the solutions satisfy both TolFun and TolX tolerances.
TolXSolvers consider solutions within TolX distance of each other to be identical (not distinct). Default: 1e-6. Solvers group solutions when the solutions satisfy both TolFun and TolX tolerances.
MaxTimeSolvers halt if the run exceeds MaxTime seconds, as measured by a clock (not processor seconds). Default: Inf
StartPointsToRunChoose 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.
OutputFcnsFunctions to run after each local solver run. See Output Functions for GlobalSearch and MultiStart. Default: []
PlotFcnsPlot functions to run after each local solver run. See Plot Functions for GlobalSearch and MultiStart. Default: []

Properties for GlobalSearch

Property NameMeaning
NumTrialPointsNumber of trial points to examine. Default: 1000
BasinRadiusFactorSee Properties for detailed descriptions of these properties.
DistanceThresholdFactor
MaxWaitCycle
NumStageOnePoints
PenaltyThresholdFactor

Properties for MultiStart

Property NameMeaning
UseParallelWhen 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. 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 TolFun tolerance.

  • Spend no more than 2000 seconds on the computation.

To solve the problem, create a GlobalSearch object gs as follows:

gs = GlobalSearch('TolX',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 TolFun tolerance.

  • You spend no more than 2000 seconds on the computation.

To solve the problem, create a MultiStart object ms as follows:

ms = MultiStart('TolX',0.01,'MaxTime',2000);
Was this topic helpful?