1
我在python和Gurobi中很新穎! 最近我開始編寫一個問題,我需要編寫此限制:如何在Gurobi python中編寫約束
for each i and j (while i is not equal to j):
(y[i][j]) * (D[i] - d[i][j])) <= T
我也試着開始不考慮相等部分寫道:
for i in people:
for j in people:
m.addConstr((carpools[i][j])*(distance[i]-distBtw[i][j])) <= 400
但我收到此錯誤:
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
非常感謝。關於二次約束D [i]和d [i] [j] s是參數,y [i] [j]是二元變量,所以我猜它是線性的。 –