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!