Gurobi crashes in the cbcut
Hi Gurobi community,
I'm using Python Gurobi interface on linux. I'm using a callback function to add a set of valid inequalities. My callback looks like this:
def mycallback(m, where):
if where == GRB.Callback.MIPNODE:
SOME LAZY CUTS ... (This part works perfectly)
if where == GRB.Callback.MIPNODE:
sol_beta = m.cbGetNodeRel(Beta)
sol_g = m.cbGetNodeRel(g)
sol_v = m.cbGetNodeRel(v_var)
rhs1=LinExpr()
rhs2= LinExpr()
lhs = LinExpr()
bar_beta1={}
index=-1
CNUM1={}
for j,k in List_edges:
index +=1
if sol_g[j,k] >=0.0000001:
if sol_v[j,k] +0.00001 <= (2*sol_beta[j,k])*sol_beta[j,k] +(-1*sol_beta[j,k]*sol_beta[j,k])*sol_g[j,k]:
bar_beta1[index] = (sol_beta[j,k])/float(sol_g[j,k])
lhs= m._v_var[index]
rhs1 = (2*bar_beta1[index])*m._beta_var[index]
rhs2= (-1*bar_beta1[index]*bar_beta1[index])*m._g_var[index]
CNUM1[index]=m.cbCut(lhs - rhs1- rhs2 >= 0)
m.params.PreCrush = 1
m.Params.lazyConstraints = 1
m._v_var = m.getVars()[:len(List_edges)]
m._beta_var = m.getVars()[len(List_edges):2*len(List_edges)]
m._g_var = m.getVars()[2*len(List_edges):3*len(List_edges)]
m.optimize(mycallback)
When I use m.cbCut(lhs -rhs1>=0), I can run my model fine. However, the current model gives me an strange error which I cannot debug. The error is as follows:
*** Error in `/home/hasan/Packages/anaconda2/bin/python2.7': realloc(): invalid next size: 0x000055d3d4818990 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fa4d83df7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x834aa)[0x7fa4d83eb4aa]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0x179)[0x7fa4d83ec839] ...
I really appreciate your help. What could be the source of the problem.
-
Official comment
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?. -
Please create a self-contained, minimal working example and submit a ticket at https://support.gurobi.com. This way we can try to reproduce it on our end.
0
Please sign in to leave a comment.
Comments
2 comments