What does relative constraint tolerance of fmincon in detail ?

10 views (last 30 days)
Fabian Friz on 28 Nov 2021
Edited: Alan Weiss on 29 Nov 2021
Hi everyone,
i've got a question regarding the relative constraint tolerance of fmincon. I was looking for the detailed fomula, how the relative constraint violation using fmincon is computed, but couldn't find an answer. I have only linear inequality constraints. Is it like relative violation = violation / (1 + max(confun(x0)), where confun denotes the constraints ? But if I calculate these values, i dont get the same values as the iterative display shows
Furthermore, how can the relative constraint violation be interpreted ? Is it a measure, how good the constraints are satisfied ? The smaller the relative constraint tolerance, the better the result ?

Alan Weiss on 29 Nov 2021
As far as the interpretation, a positive value means at least one constraint is violated. A zero (or negative for other solvers) value means all constraints are satisfied. The larger the reported value, the more the violation. However, because the value is relative to something, the numerical value of the iterative display does not necessarily give a clear meaning.
I am sorry, but I cannot easily give you the meaning of the value. It depends on the specific fmincon algorithm.
Alan Weiss
MATLAB mathematical toolbox documentation
Alan Weiss on 29 Nov 2021
Sorry, I really don't understand your application. You say "... if I set the relative constraint violation too low, there may be some infeasible constraints." If there are violated constraints, well, either the solution is not an acceptable solution or you didn't really mean that those constraints are hard constraints, meaning they must be satisfied.
I think that the more fruitful approach for you is instead of trying to figure out exactly what "relative" means, you shjould check whether your linear constraints are infeasible by solving a linear programming problem. If they are infeasible, then you need to fix your problem formulation. On the other hand, if they are feasible, then you should be able to find a solution with zero infeasibility, and there is no reason to fiddle with your constraint tolerance.
Yes, I am oversimplifying. You might be able to solve a sequence of problems with gradually decreasing constraint tolerance. Or you could use a solver such as surrogateopt or ga that, by its nature, is always feasible with respect to linear constraints, even though these solvers are not nearly as speedy as fmincon.
Bottom line: I think that trying to set a good constraint tolerance is not a good use of your time. Instead, try to figure out if your problem has any feasible points, and if so, you can set as small a tolerance as makes sense, including 0. You can also try using different algorithms if the interior-point algorithm is not giving you an accurate enough solution.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!