|On this page…|
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 TolX 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 TolFun value of 1e-8, and a TolX value of 1e-7:
problem.options = optimoptions(problem.options,'GradObj','on', ... 'TolFun',1e-8,'TolX',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 MultiStart with properties: UseParallel: 0 Display: 'final' TolFun: 1.0000e-06 TolX: 1.0000e-06 MaxTime: Inf StartPointsToRun: 'all' OutputFcns:  PlotFcns: 
To change ms to have its TolX value equal to 1e-3, update the TolX field:
ms.TolX = 1e-3 MultiStart with properties: UseParallel: 0 Display: 'final' TolFun: 1.0000e-06 TolX: 1.0000e-03 MaxTime: Inf StartPointsToRun: 'all' OutputFcns:  PlotFcns: 
Reconstruct the object starting from the current settings. For example, to set the TolFun field in ms to 1e-3, retaining the nondefault value for TolX:
ms = MultiStart(ms,'TolFun',1e-3) MultiStart with properties: UseParallel: 0 Display: 'final' TolFun: 1.0000e-03 TolX: 1.0000e-03 MaxTime: Inf StartPointsToRun: 'all' OutputFcns:  PlotFcns: 
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 TolX and TolFun:
gs = GlobalSearch(ms) GlobalSearch with properties: NumTrialPoints: 1000 BasinRadiusFactor: 0.2000 DistanceThresholdFactor: 0.7500 MaxWaitCycle: 20 NumStageOnePoints: 200 PenaltyThresholdFactor: 0.2000 Display: 'final' TolFun: 1.0000e-03 TolX: 1.0000e-03 MaxTime: Inf StartPointsToRun: 'all' OutputFcns:  PlotFcns: