필터 지우기
필터 지우기

Writing nonlinear constraint in fmincon

조회 수: 2 (최근 30일)
george pepper
george pepper 2020년 10월 23일
댓글: george pepper 2020년 10월 27일
Hello,
I minimize a function with 4 parameters on fmincon. The vector of parameters is b=[a1 a2 b1 b2 ]. How can I add a nonlinear constraint such that 5/b1<b2?
  댓글 수: 2
Matt J
Matt J 2020년 10월 24일
편집: Matt J 2020년 10월 24일
Note that it can be critically misleading to people to say you want 5/b1<b2 if you really mean 5/b1<=b2. Theoretically, for example, the following minimization problem no solution:
min. x,
s.t. x>0
but the solution to,
min. x
s.t. x>=0
is x=0.
george pepper
george pepper 2020년 10월 27일
Thanks a lot! This is great.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 10월 24일
5/b1 < b2 implies 5 < b2*b1 implies 0 < b2*b1 - 5 implies b2*b1 - 5 < 0 implies b2*b1 - 5 + delta = 0 for some positive delta.
This leads to the constraint
delta = eps(realmin);
b(3)*b(4) - 5 + delta %<= 0 implied
However I would suggest you think more about your boundary constraint. Is 5/b1 == b2 an actual problem for your situation? If it is then you run serious risks that due to round-off issues, that whatever calculation fails with 5/b1 == b2, will not round in a "fortunate" way.
I personally would probably not use eps(realmin) for the delta: I would be more likely to use 5*(1-eps) instead of 5+delta
  댓글 수: 3
Walter Roberson
Walter Roberson 2020년 10월 24일
True, I forgot about the case of negatives.
You could always code
5/b(3) - b(4)
and make the appropriate alteration for the border equality... provided that you know that b(3) is never 0.
george pepper
george pepper 2020년 10월 27일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by