# 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.

## Examples

`options = optimset('MaxIter', 200, 'Display', 'iter')`

```
options = struct [
Display: iter
MaxIter: 200
]
```

`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.

For fmincon, the algorithm option is the Method, either 'sqp' for sequential quadratic programming or 'grg' for generalized reduced gradient. See fmincon for more information.

For fmincon with the SQP algorithm, the available tolerance options are: TolX and TolKKT and TolCon. The MaxFail option also applies.

For fmincon with the GRG algorithm, the available tolerance options are: TolFun and TolKKT.

TolX, when used with fmincon and its SQP algorithm, sets the convergence criteria relative to the design variable bounds. The TolX value is applied to the interval sizes as a scale factor. With other solvers, TolX sets the convergence criteria relative to the design variable magnitudes.

TolCon only applies when fmincon cannot find a feasible solution with its SQP algorithm. In such cases, the function returns the best infeasible solution found within the allowed violation, along with a warning. The algorithm does not attempt to minimize the utilized violation. The TolCon value is applied as a percent of the constraint bound, with an absolute minimum of 1.0e-4 applied when the bound is zero or near zero.

TolKKT sets the convergence criterion for the optimal relationship between the gradients of the objective and constraint functions, which is an equation involving Lagrange multipliers. It only applies to fmincon.