After you run a global solver, you might want to change some global or local options. To determine which options to change, the guiding principle is:

To affect the local solver, set local solver options.

To affect the start points or solution set, change the

`problem`

structure, or set the global solver object properties.

For example, to obtain:

More local minima — Set global solver object properties.

Faster local solver iterations — Set local solver options.

Different tolerances for considering local solutions identical (to obtain more or fewer local solutions) — Set global solver object properties.

Different information displayed at the command line — Decide if you want iterative display from the local solver (set local solver options) or global information (set global solver object properties).

Different bounds, to examine different regions — Set the bounds in the

`problem`

structure.

To start your local solver at points only satisfying inequality constraints, set the

`StartPointsToRun`

property in the global solver object to`'bounds-ineqs'`

. This setting can speed your solution, since local solvers do not have to attempt to find points satisfying these constraints. However, the setting can result in many fewer local solver runs, since the global solver can reject many start points. For an example, see Optimize Using Only Feasible Start Points.To use the

`fmincon`

`interior-point`

algorithm, set the local solver`Algorithm`

option to`'interior-point'`

. For an example showing how to do this, see Examples of Updating Problem Options.For your local solver to have different bounds, set the bounds in the

`problem`

structure. Examine different regions by setting bounds.To see every solution that has positive local exit flag, set the

`XTolerance`

property in the global solver object to`0`

. For an example showing how to do this, see Changing Global Options.

There are several ways to change values in a local options structure:

Update the values using dot notation and

`optimoptions`

. The syntax is*problem*.options = optimoptions(*problem*.options,'*Parameter*',*value*,...);You can also replace the local options entirely:

*problem*.options = optimoptions(@*solvername*,'*Parameter*',*value*,...);Use dot notation on one local option. The syntax is

*problem*.options.*Parameter*=*newvalue*;Recreate the entire problem structure. For details, see Create Problem Structure.

Create a problem structure:

problem = createOptimProblem('fmincon','x0',[-1 2], ... 'objective',@rosenboth);

Set the problem to use the

`sqp`

algorithm in`fmincon`

:problem.options.Algorithm = 'sqp';

Update the problem to use the gradient in the objective function, have a

`FunctionTolerance`

value of`1e-8`

, and a`XTolerance`

value of`1e-7`

:problem.options = optimoptions(problem.options,'GradObj','on', ... 'FunctionTolerance',1e-8,'XTolerance',1e-7);

There are several ways to change characteristics of a `GlobalSearch`

or `MultiStart`

object:

Use dot notation. For example, suppose you have a default

`MultiStart`

object:ms = MultiStart ms = MultiStart with properties: UseParallel: 0 Display: 'final' FunctionTolerance: 1.0000e-06 MaxTime: Inf OutputFcn: [] PlotFcn: [] StartPointsToRun: 'all' XTolerance: 1.0000e-06

To change

`ms`

to have its`XTolerance`

value equal to`1e-3`

, update the`XTolerance`

field:ms.XTolerance = 1e-3 ms = MultiStart with properties: UseParallel: 0 Display: 'final' FunctionTolerance: 1.0000e-06 MaxTime: Inf OutputFcn: [] PlotFcn: [] StartPointsToRun: 'all' XTolerance: 1.0000e-03

Reconstruct the object starting from the current settings. For example, to set the

`FunctionTolerance`

field in`ms`

to`1e-3`

, retaining the nondefault value for`XTolerance`

:ms = MultiStart(ms,'FunctionTolerance',1e-3) ms = MultiStart with properties: UseParallel: 0 Display: 'final' FunctionTolerance: 1.0000e-03 MaxTime: Inf OutputFcn: [] PlotFcn: [] StartPointsToRun: 'all' XTolerance: 1.0000e-03

Convert a

`GlobalSearch`

object to a`MultiStart`

object, or vice-versa. For example, with the`ms`

object from the previous example, create a`GlobalSearch`

object with the same values of`XTolerance`

and`FunctionTolerance`

:gs = GlobalSearch(ms) gs = GlobalSearch with properties: NumTrialPoints: 1000 BasinRadiusFactor: 0.2000 DistanceThresholdFactor: 0.7500 MaxWaitCycle: 20 NumStageOnePoints: 200 PenaltyThresholdFactor: 0.2000 Display: 'final' FunctionTolerance: 1.0000e-03 MaxTime: Inf OutputFcn: [] PlotFcn: [] StartPointsToRun: 'all' XTolerance: 1.0000e-03

Was this topic helpful?