coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
518 stars 92 forks source link

SEGFAULT after adding empty rows and defining coefficients later via column parameter of method add_var #184

Open peterlietz opened 3 years ago

peterlietz commented 3 years ago

Describe the bug Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

To Reproduce import mip

m = mip.Model("column_test", sense=mip.MAXIMIZE, solver_name=mip.CBC)

c1 = m.add_constr(mip.LinExpr(const=-10, sense=mip.LESS_OR_EQUAL), name="c1") c2 = m.add_constr(mip.LinExpr(const=-10, sense=mip.LESS_OR_EQUAL), name="c2") c3 = m.add_constr(mip.LinExpr(const=-10, sense=mip.LESS_OR_EQUAL), name="c3") a1 = m.add_var(name="a1", obj=1, column=mip.Column(constrs=[c1, c2], coeffs=[1., 1.])) a2 = m.add_var(name="a2", obj=1, column=mip.Column(constrs=[c1, c3], coeffs=[1., 1.])) a3 = m.add_var(name="a3", obj=1, column=mip.Column(constrs=[c2, c3], coeffs=[1., 1.]))

m.write("prob.lp")

Expected behavior The coefficients are added to the rows when the variables are created and the model is correctly written to file.

Desktop (please complete the following information):