Main Content

Set Problem-Based Optimization Options for Global Optimization Toolbox Solvers

To tune your optimization solution process in the problem-based approach, set options using optimoptions and pass the options to solve. Set the solver for solve to match the options.

options = optimoptions("patternsearch",PlotFcn="psplotbestf");
[sol,fval] = solve(prob,x0,Options=options,Solver="patternsearch");

To find all available solvers for a problem, view the second output of solvers.

[~,validsolvers] = solvers(prob)
validsolvers = 1x10 string
    "lsqnonlin"    "lsqcurvefit"    "fmincon"    "ga"    "patternsearch"    "surrogateopt"    "particleswarm"    "simulannealbnd"    "gamultiobj"    "paretosearch"

Some Global Optimization Toolbox solver options require you to map the option values to their solver equivalents. For example, to set an initial population for ga or particleswarm, you need to map all problem variables to a single matrix. Perform this mapping using the varindex function. For a discussion and examples, see Set Options in Problem-Based Approach Using varindex.

The remaining considerations for setting options are largely the same as in the solver-based approach. For details, see Set Optimization Options.

See Also

| | |

Related Topics