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

Fix removal of variables (#294) #296

Closed sebheger closed 1 year ago

sebheger commented 1 year ago

Fixes #294

sebheger commented 1 year ago

@Markus28 Could you provide the necessary unit-tests? You mentioned in #288 that you tested the complete removal workflow. Thanks!

Markus28 commented 1 year ago

In the test_remove method in test_model.py, just add the line m.remove(x) at the very bottom.

I'm not 100% sure what is supposed to happen when you remove a variable that is used in a constraint or the objective thought, so it might make sense to add a test for that case as well (e.g. if some exception is supposed to be raised).