Fmincon - Variable dependent constraints
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (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)
Categorías
Más información sobre Structural Mechanics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!