Constraints in Gurobi
AnsweredI have the following constraint:
model.addConstr(aux1["O+", "1", m, t] == demand - sum(i1["O+", "1", m, t] for m in range(1, m)))
model.addConstr(aux2["O+", "1", m, t] == gp.max_(0, aux1["O+", "1", m, t]))
model.addConstr(aux3["O+", "1", m, t] == i1["O+", "1", m, t] - aux2["O+", "1", m, t])
model.addConstr(I1["O+", "1", m, t] == gp.max_(0, aux3["O+", "1", m, t]))
which is representative of:
is there anything wrong with using auxiliary variables?
0
-
Official comment
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Shahrzad,
It looks correct. You would not be able to formulate this using the current Gurobi API without using auxiliary variables.
- Riley
0 -
Thank you Riley for your prompt response.
0
Post is closed for comments.
Comments
3 comments