Main Content
Set and Change Options
For all Global Optimization Toolbox solvers except GlobalSearch
and MultiStart
,
the recommended way to set options is to use the optimoptions
function. Set GlobalSearch
and MultiStart
options
using their name-value pairs; see Changing Global Options.
For example, to set the ga
maximum time
to 300
seconds and set iterative display:
options = optimoptions('ga','MaxTime',300,'Display','iter');
Change options as follows:
Dot notation. For example,
options.MaxTime = 5e3;
optimoptions
. For example,options = optimoptions(options,'MaxTime',5e3);
Ensure that you pass options
in your solver
call. For example,
[x,fval] = ga(@objfun,2,[],[],[],[],lb,ub,@nonlcon,options);
To see the options you can change, consult the solver function reference pages. For option details, see the options reference sections.
See Also
patternsearch
| particleswarm
| ga
| simulannealbnd
| surrogateopt
| paretosearch
| gamultiobj