我正在使用Gurobipy编写一个线性程序,并且在编写一个约束时遇到了问题。我对如何求<;0不等式的和感到困惑。你知道吗
约束如下:https://imgur.com/a/FP0aAKl
我已经初始化了变量xC和xP(我称之为xPone)。参数B也已经被定义,并且包含在一个名为B的字典中。你知道吗
这是我当前的代码:
m = Model('LP')
m.addConstrs((xC_smp[s,m,p] == - quicksum (B[(s,n,m,p)] * xPone_slnmonep[s,l,n,mone,p])
for m in materials for s in sites for l in lines
for n in versions for p in periods for mone in materialones
if B[(s,n,m,p)] < 0), name='c7')
当前返回一个空集{}。我希望里面有一些价值观。如果有人能指出这个问题,我将不胜感激。谢谢。你知道吗
这可能是工作:
相关问题 更多 >
编程相关推荐