Clear Filters
Clear Filters

Fmincon, is it possible to give a priority to the constraints defined?

2 views (last 30 days)
Dear all, I have to solve a simple optimization problem with few equality and inequality constraints. To do that, I am using fmincon. Due to the fact that not all the constraints that I am using have the same priority in my problem, I was wandering if there is any way to tell Matlab which constraint is more important and have to be satisfied first. If the less important constraints are not satisfied, this will not cause an issue to my work. Thank you very much in advance, Jacopo

Accepted Answer

Walter Roberson
Walter Roberson on 12 Jun 2017
Depending on you function, you might be able to express your less important constraints in terms of numeric penalties. For example, if x(3) being outside the range [x(2)-5, x(2)+5] is not critical, then
f = .... + (x(3) < x(2)-5 | x(3) > x(2)+5) .* 5 .* abs(x(3)-x(2))^2
would give a penalty of 5 times the square of the difference to x(2) for being outside the area, but would otherwise not reject the possibility. (The best weight for the penalty would depend upon the priority and upon the typical function values.)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!