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
525 stars 92 forks source link

Column not cleared on Mac #94

Closed WarnerLensing closed 4 years ago

WarnerLensing commented 4 years ago

I am trying to implement a column generation using mip. However, I am experiencing some troubles with the class Column. Implicitly this class saves the constraints and coefficients of all the Column objects that are created. Hopefully, this example clarifies my problem:

from mip import Model, MINIMIZE, CBC, CONTINUOUS, xsum, Column m = Model() x = m.add_var()

example_constr1 = m.add_constr(x >= 1,'constr1') example_constr2 = m.add_constr(x <= 2,'constr2') column1 = Column() column1.constrs = [example_constr1] column1.coeffs = [1] second_var = m.add_var("second",column = column1) column2 = Column() column2.constrs = [example_constr2] column2.coeffs = [2] third_var = m.add_var("third",column = column2) print(column2) print(second_var.column) print(third_var.column)

The output of this program is: [1: 2, ] [0: 1.0, ] [0: 1.0, 1: 2.0, ] While the last column should be: [1: 2.0, ]

As the documentation about the Column class is short, I could not find a way to solve this problem. I tried to use copy in all possible ways, but this does not help as well. I have not checked whether this also occurs on other operating systems than Mac OS. Can anyone help me solving this problem?

h-g-s commented 4 years ago

should be fixed in 1.8.2, could you check it ?

WarnerLensing commented 4 years ago

Yes, works! Thanks