How to update constraint in nonlinear optimization

5 ビュー (過去 30 日間)
Mohamed Hmamouch
Mohamed Hmamouch 2021 年 11 月 25 日
編集済み: Matt J 2021 年 11 月 26 日
I have a location facility project where i should optimize the cost of implementing it using fmnincon. The problem is i have a condition on (x,y) (this is th coordinate of my facilities):
Since this two equation are non linear i can define this function:
function [c,ceq]=NLcon(z)
c(1)=-z(1)^2 +26*z(1)-z(2)^2+96*z(2)-2473+100;
but how can I add this constraint: if 20<=y<=40 then x<=20?


Matt J
Matt J 2021 年 11 月 25 日
編集済み: Matt J 2021 年 11 月 26 日
Divide into 3 sub-problems. Solve with the constraints
(1) y<=20 and NLcon
(2) 20<=x<=40, y<=20, and NLcon
(3) y>=20 and NLcon
Take the solution to whichever of the 3 sub-problems gives the most optimal cost value.
  2 件のコメント
Matt J
Matt J 2021 年 11 月 26 日
so we can't define three cases where my x can be unconstrained
Since you accepted the answer, I assume you figure it out?
If not, see my updated answer.


その他の回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by