optimset

Specify optimization function options.

Syntax

options = optimset('option1', value1, 'option2', value2, ...)

Inputs

optionN
The name of option N.
valueN
The value of option N.

Outputs

options
A struct containing the options. See Comments.
The available options are as follows:
Method
The fmincon method.
  • 'sqp': sequential quadratic programming (default).
  • 'grg': generalized reduced gradient.
MaxIter
The maximum number of iterations allowed (default: 400).
MaxFunEvals
The maximum number of function evaluations allowed (default: 1,000,000).
TolFun
The termination tolerance on the objective function convergence (default: 1.0e-7).
TolX
The termination tolerance on the parameter convergence (default: 1.0e-7).
TolCon
The constraint violation allowance, as a percent (default: 0.5).
TolKKT
The termination tolerance on the Karush-Kuhn-Tucker conditions (default: 1.0e-4).
GradObj
An 'on'/'off' flag to indicate whether the objective function will return the gradient as an optional second return value. (Only for fminunc). The function signature is as follows: function [sys, grad] = System(x), where sys and grad contain the system function and its gradient.
GradConstr
An 'on'/'off' flag to indicate whether the non-linear constraint function will return the gradients as the optional third and fourth return value. If a non-linear constraint is used, then GradConstr must be set the same as GradObj. The function signature is as follows: function [c, ceq, cj, ceqj] = ConFunc(x), where c and ceq contain inequality and equality contraints, respectively, and cj and ceqj contain their Jacobians. The inequality constraints are assumed to have upper bounds of 0.
Jacobian
An 'on'/'off' flag to indicate whether the objective function will return the Jacobian as an optional second return value (Only for fsolve, lsqcurvefit). The function signature is as follows: function [res, jac] = System(x), where res and jac contain the residuals vector of the system function and its Jacobian.
Display
An 'iter'/'off' flag to indicate whether objective function results will be displayed at each iteration. For more extensive iteration information, see the output return argument of the optimization function.

Examples

Set options to control the number of iterations and display intermediate data:
options = optimset('MaxIter', 200, 'Display', 'iter')
options = struct [
Display: iter
MaxIter: 200
]
Set options to specify that the analytical Jacobian function name is returned by the objective function:
options = optimset('Jacobian', 'on')
options = struct [
Jacobian: on
]

Comments

Care must be shown to select the options that apply to the solver of interest, as follows. A solver will ignore any option that does not apply.

For fminbnd, the only available tolerance option is: TolX.

For fminunc, the available tolerance options are: TolFun and TolX.

For fminsearch, the only available tolerance option is: TolX.

For fsolve, the available tolerance options are: TolFun and TolX.

For fzero, the only available tolerance option is: TolX.

For lsqcurvefit, the available tolerance options are: TolFun and TolX.

The solver functions terminate the first time that any of the convergence tolerance criteria are met.

TolX sets the convergence criteria relative to the design variable magnitudes.