Constraint has no Bool Value
回答済みI get the following error for this constraint :
for i in range(I):
for k in range(K):
for t in range(T):
model.addConstr(Tr[i,k,t]==0 or Tr[i,k,t]==9 or Tr[i,k,t]==10 or Tr[i,k,t]==11)

0
-
You cannot specify a group of "or" constraints like this using the Model.addConstr() method.
Assuming \(\texttt{Tr}\) is a variable object, you can model this logic by defining the \(\texttt{Tr}\) variables as semi-continuous integer variables. Semi-continuous variables can either take a value of \( 0 \) or a value between the specified lower and upper bounds. In your case, you would add lower bounds of \( 9 \) and upper bounds of \( 11 \):
Tr = model.addVars(I, K, T, lb=9, ub=11, vtype=GRB.SEMIINT, name="Tr")
0 -
it worked !!
Tnahk you !
0
サインインしてコメントを残してください。
コメント
2件のコメント