optiset

Create or edit OPTI options structure

Syntax

options = optiset('param1',value1,'param2',value2,...)

optiset

options = optiset

options = optiset(oldopts,'param1',value1,...)

Description

The function optiset creates an options structure that you can pass to opti for customizing the building and solving of a optimization problem. These options will always override any other options specified via other option functions, and are thus the 'master' options set.

options = optiset('param1',value1,'param2',value2,...) creates a OPTI options structure in which the specified parameters (param) have the specified values (value).

optiset with no input or output arguments displays a complete list of parameters with their valid names.

options = optiset with no input arguments creates a default options structure

options = optiset(oldopts,'param1',value1,...) updates the existing object structure, oldopts, with the new values specified.

Options

The following table lists the available options for optiset:

Parameter Value Description Default
solver string The name of the solver to use. See checkSolver for available solvers. 'AUTO'
maxiter double scalar The maximum number of iterations a solver can run 1500
maxfeval double scalar The maximum number of function evaluations a solver can call 10000
maxnodes double scalar The maximum number of nodes to search in a mixed integer problem 10000
maxtime double scalar The maximum runtime of a solver in seconds 1000
tolrfun double scalar The relative convergence tolerance of the objective function 1e-7
tolafun double scalar The absolute convergence tolerance of the objective function 1e-7
tolint double scalar The rounding tolerance on the absolute value of an integer in a mixed integer problem 1e-5
solverOpts structure Additional options to pass to the solver, e.g. an options structure from ipoptset. []
dynamicOpts structure Additional options to pass for dynamic optimization from optidynset. []
iterfun function handle Iteration callback function (see below) []
warnings string Display OPTI warnings ('all', 'critical', 'none') 'critical'
display string Print Level settings ('iter', 'final', 'off') 'off'
derivCheck string Checks user supplied derivatives against a numerical approximation ('on', 'off') 'off'

Note these settings are not been implemented in all solvers. Use >> configSolver('config') for a list of which solvers support which options.

Iteration Callback Function

Most nonlinear solvers allow a callback method to be automatically called at every iteration (or function evaluation, depending on the solver). The callback function must have the following form:

function stop = myCallback(iter,fval,x)

Where the input arguments are:

iter - The current iteration or function evaluation
fval - The current objective function value
x - The current solution vector (not available from all solvers, or may return a structure with more information)

And the output arguments are:

stop - Set this to true to stop the solver when the function returns. The default is false (continue). Do not attempt to set it to 0 or 1, only logical values are accepted. (not available from all solvers)

The callback function can be used to set customized stopping criteria, customized iteration display, or for plotting. OPTI provides a default plotting function for plotting the objective value vs iteration. This can be set as follows:

opts = optiset('iterfun',@optiplotfval)