Fmincon - Variable dependent constraints
古いコメントを表示
Hello,
I'm sorry if this question has already been answered.
I want to find the minimum of a function of three variables f(x,y,z), where the constraints of the variables are defined as follows (for example) :
- 1 < x < 2
- x/20 < y < x/10
- 2y < z < x/5
I would be greatful if someone could help me about how to define this by using the fmincon function.
Thanks in advance!
採用された回答
その他の回答 (1 件)
If you wish, you can download prob2matrices() and use the problem-based framework to help set up the linear constraints.
x=optimvar('x','LowerBound',1, 'UpperBound',2);
y=optimvar('y');
z=optimvar('z');
con.xyleft= x/20<=y;
con.xyright= y<=x/10;
con.yzleft= 2*y <= z;
con.yzright= z<=x/5;
[S,idx]=prob2matrices({x,y,z}, 'Constraints',con);
xyz=fmincon(@objective, [x0,y0,z0], S.Aineq,S.bineq,S.Aeq,S.beq,S.lb,S.ub)
カテゴリ
ヘルプ センター および File Exchange で Structural Mechanics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!