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
513 stars 88 forks source link

Small bugfix for Gurobi <10 libraries #324

Closed aphi closed 1 year ago

aphi commented 1 year ago

This PR addresses two small bugs:

  1. The recent change to enable pickup of Gurobi 10.0 libraries has meant that all previous Gurobi versions are not findable, due to the glob-style matching. i.e. it now expects 3 digits like libgurobi100.so, not allowing for 2 digits like libgurobi95.so which many will still be using.

  2. The code clause starting with "checking gurobi version" was not at the correct level of indentation. When no libfile was found from the globs, lib_path is still None, but gets called in lib_path.split and errors, instead of continuing to the next block of execution.

Fix: Rather than add more glob-style matches, this section is reworked with a very simple regex. The regex also allows extraction of the major_ver and minor_ver values, although these are not used.

I've tested this picks up the correct library for versions >=10 and <10 on Linux.

sebheger commented 1 year ago

thanks @aphi for this. I had not fully tested downwards compatability.