Skip to content

Changed behavior of Preference.Any by pure python installation #74

@cmalinmayor

Description

@cmalinmayor

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions