-
Notifications
You must be signed in to change notification settings - Fork 3
Changed behavior of Preference.Any by pure python installation #74
Description
ilpy/src/ilpy/solver_backends/__init__.py
Lines 30 to 40 in 6c35ace
| for modname, clsname in to_try: | |
| import_mod = f"ilpy.solver_backends.{modname}" | |
| try: | |
| mod = __import__(import_mod, fromlist=[clsname]) | |
| cls = getattr(mod, clsname) | |
| backend = cls() | |
| assert isinstance(backend, SolverBackend) | |
| return backend | |
| except Exception as e: # pragma: no cover | |
| errors.append((f"{import_mod}::{clsname}", e)) | |
Previously, if you put Preference.Any, and you didn't have a Gurobi license, we would try to create a gurobi solver and it would fail here. Gurobi when installed from pip/conda ships with a size-limited license (https://support.gurobi.com/hc/en-us/articles/360051597492-How-do-I-resolve-a-Model-too-large-for-size-limited-Gurobi-license-error). So, passing Preference.Any will always make a Gurobi solver, but later trying to solve any problem with more than 2000 parameters causes an error.
I mostly wanted to document this change and see what @tlambert03 thinks is the correct thing to do about it (if anything). Some options that I'm okay with:
- Accept the new behavior and tell users to specify SCIP if they don't have a gurobi license and want to solve large-ish problems.
- Deprecate "Preference.Any" and force users to be explicit, since now it is harder to infer which solver to use.
- Check if the license is size limited and fall back to SCIP if so, to try and emulate the previous behavior. (I assume this is possible but I didn't look into how)