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

gurobi env issue #325

Closed sebheger closed 1 year ago

sebheger commented 1 year ago

Discussed in https://github.com/coin-or/python-mip/discussions/313

Originally posted by **erelsgl** November 14, 2022 I have GUROBI installed, and MIP automatically detects it and uses it. How can I tell MIP to not use GUROBI?

I use the following code:

try: model = mip.Model(name='', sense='MIN', solver_name='', solver=None) except mip.InterfacingError: model = mip.Model(name='', sense='MIN', solver_name='cbc', solver=None) so that, if GUROBI is installed and its license is OK, it will run, otherwise MIP will use CBC.

It works, but I also get a lot of error messages:

Exception ignored in: <function SolverGurobi.del at 0x7f343cc4f9d0> Traceback (most recent call last): File "/mnt/d/Dropbox/ariel-algorithms/fairpy/.venv38linux/lib/python3.8/site-packages/mip/gurobi.py", line 439, in del GRBfreeenv(self._env) TypeError: initializer for ctype 'GRBenv ' must be a pointer to same type, not cdata 'GRBenv *' Is there a way to suppress these error messages?

sebheger commented 1 year ago

Fixed error of the deletion in #305