有人可以帮我解决这个错误吗?当我收到错误时我应该在哪里看:GurobiError:无法将参数转换为表达式。我应该补充一点,我在 python 中使用 Gurobi 库
from gurobipy import*
m=Model('mymodel')
def label(c):
return "x" + str(c).translate(None, " '")
shifts = [1,2]
hours = [1,2]
games = ['bj', 'cr']
pits = [1,2]
order1 = [1,2]
order2 = [1,2,3]
combo, oi = multidict( {
(1,1,'bj',1,1,1): 100,
(1,1,'bj',1,1,2):200,
(1,1,'bj',1,1,3):200,
(1,1,'bj',1,2,1):50,
(1,1,'bj',1,2,2):70,
(1,1,'bj',1,2,3):70,
(1,1,'cr',1,1,1):400,
(1,1,'cr',1,1,2):450
})
combo= tuplelist(combo)
for s in shifts:
for t in hours:
for i in games:
for n in order1:
m.addConstr(quicksum(x[s,t,i,p,n,k] for s,t,i,p,n,k in combo.select(s,t,i,'*',n,'*'))- int(1)== 0, name=label((s,t,i,p,n,k))