optimset

Create or edit optimization options structure

Syntax

options = optimset('param1',value1,'param2',value2,...)
optimset
options = optimset
options = optimset(optimfun)
options = optimset(oldopts,'param1',value1,...)
options = optimset(oldopts,newopts)

Description

Note

optimoptions is recommended instead of optimset for all solvers except fzero, fminbnd, fminsearch, and lsqnonneg.

options = optimset('param1',value1,'param2',value2,...) creates an optimization options structure called options, in which the specified options (param) have specified values. Any unspecified options are set to [] (options with value [] indicate to use the default value for that option when you pass options to the optimization function). It is sufficient to type only enough leading characters to define the option name uniquely. Case is ignored for option names.

optimset with no input or output arguments displays a complete list of options with their valid values.

options = optimset (with no input arguments) creates an options structure options where all fields are set to [].

options = optimset(optimfun) creates an options structure options with all option names and default values relevant to the optimization function optimfun.

options = optimset(oldopts,'param1',value1,...) creates a copy of oldopts, modifying the specified options with the specified values.

options = optimset(oldopts,newopts) combines an existing options structure, oldopts, with a new options structure, newopts. Any options in newopts with nonempty values overwrite the corresponding old options in oldopts.

Options

For more information about individual options, including their default values, see the reference pages for the optimization functions. Optimization Options Reference provides descriptions of optimization options and which functions use them. optimset uses different names for some options than optimoptions. See Current and Legacy Option Names.

Use the command optimset(@solver) or the equivalent optimset solver to see the default values of relevant optimization options for a solver. Some solvers do not have a default value, since the default depends on the algorithm. For example, the default value of the MaxIterations option in the fmincon solver is 400 for the trust-region-reflective algorithm, but is 1000 for the interior-point algorithm.

Examples

This statement creates an optimization options structure called options in which the Display option is set to 'iter' and the TolX option is set to 1e-8.

options = optimset('Display','iter','TolX',1e-8)

This statement makes a copy of the options structure called options, changing the value of the TolX option and storing new values in optnew.

optnew = optimset(options,'TolX',1e-4);

This statement returns an optimization options structure options that contains all the option names and default values relevant to the function fminbnd.

options = optimset('fminbnd')

If you only want to see the default values for fminbnd, you can simply type

optimset fminbnd

or equivalently

optimset('fminbnd')

Extended Capabilities

Introduced before R2006a