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 Center および File ExchangeDirect Search についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by