gurobimh is a drop-in replacement for the gurobipy API bindings shipped with
Gurobi. It offers several advantages:
gurobimhcan be compiled for all current versions of Python; you do not need to rely on Gurobi officially supporting your desired Python version.gurobimh's performance is much better, especially when modifying models a lot (like in a hand-written branch and bound solver).gurobimhis free software an can be easily extended.gurobimhships a Cythonpxdfiles, and theModelclass has some fast-accesscdefmember methods for model modifications or queries than circumvent some of the slower API parts. This means that, if you are writing your algorithms in Cython, you can almost achieve the performance of the C interface, but using a much cleaner API.
Of course, there are also disatvantages:
- Up to now,
gurobimhsupports only a subset of the officialgurobipyAPI, in particular quadratic programming is not yet supported, and lots of parameters are missing. However these features are easy to implement once you look at how the others are, so you are welcome to contribute. Simply put, I have only implemented the features I am using myself. - Though I have successfully verified that
gurobimhbehaves likegurobipyfor my programs, there are probably lots of bugs, and of course there's no commercial support. Don't use in productive environments!
The API is written in Python. To compile it, you need Cython. Of
course, you need to have Gurobi installed, and the GUROBI_HOME environment variable needs to be
set correctly.
Install directly from the Python Package Index with
pip install gurobimh
Alternatively, download the package and type:
python setup.py install
Both commands can be appended by the --user option which locally installs gurobimh for the
current user without needing root privileges.
Simply replace any gurobipy import statements with gurobimh. If anything goes wrong, file a bug!
Please contact me or use the GitHub features for comments, bugs etc.