Variable constraint
AnsweredHelloo,
i add a constarint on my variable X[i,j,t] like X[i,j,t] <= 13

But after resolving the model i found that X[0,2,1]=16

I dont where is the mistake;
Thank youu
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. -
Your third for-loop looks not correct:
for j in range(j)
0 -
thanks a lot !
But now i want to add conditions like this

But i dont know how to write in python
thank you !
0 -
It is not easy to understand what you really want to do with these code snippets and what is not working. But the following is possible:
I=range(3)
T=range(5)
J=range(4)
x = model.addVars(I, J, T, name='u')
for i in I:
for t in T:
for j in J:
if j==1:
model.addConstr(x[i, j, t] <= 4)
elif j==2:
model.addConstr(x[i, j, t] <= 3)
else:
model.addConstr(x[i, j, t] <= 1)What kind of problem do you have?
0 -
Perfect, i just forgot the loop for j
thank youu !!
0
Post is closed for comments.
Comments
5 comments