Main Content

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.
FunctionToleranceSolvers 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.
XToleranceSolvers 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.
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.
OutputFcnFunctions to run after each local solver run. See Output Functions for GlobalSearch and MultiStart. Default: []
PlotFcnPlot 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
BasinRadiusFactor

See GlobalSearch 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 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 FunctionTolerance tolerance.

  • 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 FunctionTolerance tolerance.

  • 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);

Related Topics