Professional Documents
Culture Documents
Optimization Tool With The Fmincon Solver
Optimization Tool With The Fmincon Solver
This example shows how to use the Optimization Tool with the fmincon solver to minimize a quadratic subject to linear and
nonlinear constraints and bounds.
Step 3: Set up and run the problem with the Optimization Tool.
2. Select fmincon from the selection of solvers and change the Algorithm field to Active set.
3. Enter @objecfun in the Objective function field to call the objecfun.m file.
Set the linear inequality constraint by entering [-1 -1] in the A field and enter -1 in the b field.
Set the nonlinear constraints by entering @nonlconstr in the Nonlinear constraint function field.
6. In the Options pane, expand the Display to command window option if necessary, and select Iterative to show
algorithm information at the Command Window for each iteration.
8. When the algorithm terminates, under Run solver and view results the following information is displayed:
The Current iteration value when the algorithm terminated, which for this example is 7.
The final value of the objective function when the algorithm terminated:
1
1
9. In the Command Window, the algorithm information is displayed for each iteration: