Variable constraint
回答済みHelloo,
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
-
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
サインインしてコメントを残してください。
コメント
4件のコメント