add conditional constraint
AnsweredHi, could u please tell me how to add this kind of constraint to the optimization problem?
f(x)<=2;
Here, x=[x1,x2,x3,x4]; x1-x4 are variables.
f(x)= x1,if x2>x4;
=x3, if x2<=x4;
Here the value of the function f(x) is x1 or x3, while it depends on whether x2 or x4 is bigger.
0
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi,
You can find an example of how to formulate such an if-else-statement in the stackexchange post How to write if else statement in Linear programming?
Best regards,
Jaromił0 -
Hi Jaromił,
Really thanks for ur help. I figured it out.
0
Post is closed for comments.
Comments
3 comments