# Inconsistent data in fmincon output structure

7 views (last 30 days)
Carlo Cabrera on 28 Aug 2018
Commented: Carlo Cabrera on 28 Aug 2018
I'm using FMINCON to solve a constrained optimization problem. When I examine the output structure generated by FMINCON, I get inconsistent results for the first-order optimality measure.
For example, when I look in output.message, I see
'Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
Stopping criteria details:
Optimization completed: The relative first-order optimality measure, 9.417002e-07,
is less than options.OptimalityTolerance = 1.000000e-06, and the relative maximum constraint
violation, 1.110223e-16, is less than options.ConstraintTolerance = 1.000000e-06.
Optimization Metric Options
relative first-order optimality = 9.42e-07 OptimalityTolerance = 1e-06 (default)
relative max(constraint violation) = 1.11e-16 ConstraintTolerance = 1e-06 (default)'
This indicates a first-order optimality measure of 9.47e-07. However, if I look at output.firstorderopt, I see
>> out.firstorderopt
ans =
8.7505e-06
Does anyone have any idea what's going on? The code that generates this is a little complicated to summarise here, but I can upload it somewhere if someone would like to take a closer look.

Alan Weiss on 28 Aug 2018
The key word is "relative." The relative first-order optimality measure is (usually) the ratio of the final to the initial measure. So the initial first-order optimality measure was probably around 10.
Alan Weiss
MATLAB mathematical toolbox documentation
Carlo Cabrera on 28 Aug 2018
That certainly explains things. My relative first-order optimality measure consistently differs from the actual one by a factor of 10 for identical initial starting values.
I was under the mistaken impression that the firstorderopt field was also a relative measure, since I had run fmincon on a simpler problem and found that the measure reported in the message field matched the one reported in the firstorderopt field.
Thanks!