# how does fmincon deal with inequality linear constraint

2 views (last 30 days)
xueqi on 9 Mar 2014
Edited: Matt J on 10 Mar 2014
Hi,
I would like to ask how does fmincon deal with inequality linear constraint A*x<=1.
I have a objective function f(p1,p2,p3). When I add the inequality linear constraint p1+p2+p3<=1 and get the optimal value is V1. When I add the equality linear constraint p1+p2+p3=1 and get the optimal value is V2. You would think that V1 must be less or equal than V2 becasue the later the equality constraint is more strict than the inequality constraint. But I have V1>=v2 ! Strange!
I am wondering if that is because when fmincon cope with inequality constraint, it ignores the point on the p1+p2+p3=1 but the optima happen to be on the line. If this is true, should we always find a optima with inequality constraint both by adding itself and optimize again with the equality constraint to be safe?
Another possibility is, in the inequality linear constraint case, it is more difficult to find the global optima. So it some times just stops at the local minimum.

Matt J on 9 Mar 2014
Edited: Matt J on 10 Mar 2014
The relationship between v1 and v2 might be due to inexact minimization. No numerical optimization routine terminates at the actual minimum, most of the time. It always gives you an approximation. If the true minimum values are f1 and f2 with f1<=f2, their approximations v1 and v2 may not preserve this ordering if f1 and f2 are similar enough and the approximation errors are large enough. Without seeing the 2 fmincon results, the objective function, and the magnitude of the difference between v1 and v2, it's hard to say.
Furthermore, many solvers, including fmincon, do not return solutions satisfying the constraints perfectly. This is true of both inequality and equality constraints, but especially the latter, because perfect equality is nearly always impossible to have in finite precision computer arithmetic. If you check the solution you get under the sum(p)=1 constraint, you will see that the constraint is not perfectly satisfied.
In the Optimization Toolbox, the options.TolCon parameter is used to limit constraint violation, but there is a price for making it too small (larger and larger numbers of iterations), so you can't freely make the constraint violations as small as you want. You have to accept some deviation.
Finally, your function also has some suspicious properties, if your comment in this thread was true. (see my response to that). We can't be sure what effect that is having.
##### 1 CommentShowHide None
John D'Errico on 10 Mar 2014
Edited: John D'Errico on 10 Mar 2014
Yep.