KeyError ( 0 0 0)
回答済みHelloo,
Please, i have a littel problem, i need some help
I defined this Binary variable Z
After that i tried to introduce on it the quicksum fonction

I have this error message

Thank you,
0
-
On line 25, you assign the Var object returned by Model.addVar() to \(\texttt{Z[i, K, t]}\):
Z[i, K, t] = model.addVar(...)
You should use \(\texttt{k}\) instead of \(\texttt{K}\) here.
To simplify the code, consider using Model.addVars() to construct \(\texttt{Z}\):
Z = model.addVars(I, K, T, vtype=gp.GRB.BINARY, name="Z")
With this approach, \(\texttt{Z}\) is a tupledict object. The tupledict class includes helper methods to make model-building easier. For example, you could then use the tupledict.sum() method to simplify the creation of \(\texttt{result_3}\):
result_3 = 38 * Z.sum()
0 -
ohh I see,
Thanks a lot !
0
サインインしてコメントを残してください。
コメント
2件のコメント