If constraints
Hello,
I am working on a MILP where i want to add the following constraint:
I have two variables o[i] that is binary and f[i] that is continuous.
I added the following constraint : m.addGenConstrIndicator( o[i], False, f[i], GRB.LESS_EQUAL, 0.0)
to force f[i] to be strictly positive whenever o[i] is equal to one.
Now, I would like to other another constraint on f[i] : whenever f[i] is strictly positive I want it to be bigger than a certain value f_budget :
m.addConstr((f[i]<=f_budget)>>(f[i]==0), name="Budget Penalty")
I added this constraint but its giving me errors . I wonder if there is a way to do it ?
I've always wondered about the order in which gurobi gives values to its variables since the two are related. Does it first designate o[i] and then look for the optimal value for f[i] ?
Regards,
Ibtissam
-
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?.
Post is closed for comments.
Comments
1 comment