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
514 stars 89 forks source link

Apply LazyConstraintGenerator if and only if an improved integral solution is found for cbc #274

Open sebheger opened 2 years ago

sebheger commented 2 years ago

At the moment it is applied whenever the solution is integer. So unnecessary calls for the same solution are observed.

sebheger commented 2 years ago

Might be related to #144

KyleBooth commented 2 years ago

Perhaps related to this, but I have a situation (using CBC with mip-python) where it seems like the solver is ignoring my lazy constraints.

For example, at some point in the search this lazy constraint is added: + var(7) + var(157) <= 1.0

At future iterations of the callback, the solution passed to the callback has both var(7) and var(157) assigned a value of 1 (which should be impossible) and the solver gets "stuck" as it keeps returning the same solution when the cut should prevent it from doing this.

Any thoughts?

sebheger commented 2 years ago

@KyleBooth Thanks for your comment. Could you provide a minimalistic code example for the behavior? I have observed similar results, but couldn't nail it down to a straightforward code example.

KyleBooth commented 2 years ago

@sebheger It will be difficult to produce a minimal example since the particular cut being violated is part of a larger MILP, but I will see if I can come up with something.

sebheger commented 1 year ago

Similar to #331