Error in Lazy constraints aith summation
I am trying to add lazy constraints in my callback function in python. The constraint is actually a set of constraints that each of them has a summation in their expressions. But I am getting this error:
TypeError: unsupported operand type(s) for -: 'generator' and 'NoneType'
My call back function is
def cut_callback(model, where):
if where == GRB.callback.MIPNODE:
x_temp = model._vars[0:m*n]
x_temp = np.reshape(x_temp,(m,n))
y_temp = model._vars[m*n:m*n+n]
p_temp = model._vars[m*n+n:]
model.cbLazy(gp.quicksum(max([(pL[j] - A[k, j]), (pL[i] - A[k, i])])
*x_temp[k-1,i-1] for i in J) + (A[k, j] - pL[j])
*y_temp[j] - p_temp[j] <= -pL[j] for j in J for k in I)
model.terminate()
I also changed the max in quicksum to gp.max_ but I got the same error. Can you help me figure out what the problem is?
0
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
投稿コメントは受け付けていません。
コメント
1件のコメント