How to define a semi-continuous variable in Gurobi/Python?
AnsweredHi
Suppose we have a continuous variable "x" and a parameter "\theta". Now, we want to define the variable "y" as follows:
y = \theta*x if x>0;
0 if x=0
I would be thankful to know how to model y. Thanks
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?. -
You can model this relationship with the single constraint \( y = \theta x \). If \( x \) equals \( 0 \), then \( \theta x \) also equals \( 0 \).
0
Post is closed for comments.
Comments
2 comments