How to express a constraint with fmincon

조회 수: 1 (최근 30일)
John
John 2014년 10월 11일
댓글: John 2014년 10월 13일
I want to use fmincon and i have this constraint:
0<x(1)<5
0<x(2)<5
0<x(3)<x(4)
0<x(4)<1
I use this syntax:
x0=[ 1 1 0.2 0.5];
lb=[0 0 0 0];
ub=[5 5 ? 1];
x=fmincon(fun,x0,[],[],[],[],lb,ub);
How can i express x(3)<x(4)?

채택된 답변

Matt J
Matt J 2014년 10월 12일
편집: Matt J 2014년 10월 12일
Using linear inequalities
A=[0 0 1 -1];
b=0;
lb=[0 0 0 0];
ub=[5 5 inf 1];
x=fmincon(fun,x0,A,b,[],[],lb,ub);
  댓글 수: 3
Matt J
Matt J 2014년 10월 12일
편집: Matt J 2014년 10월 12일
No, I can't see how that would make the problem infeasible. What happened when you tried it?
John
John 2014년 10월 13일
fmincon failed but i used patternsearch instead (with the same constraints) and it worked.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by