funkelab / ilpy

Unified python wrappers for popular ILP solvers
https://funkelab.github.io/ilpy/
MIT License
3 stars 2 forks source link

consider putting SolverFactory logic in python #14

Open tlambert03 opened 1 year ago

tlambert03 commented 1 year ago

I just spent a little time trying to see what it would take to allow ilpy to be installed and run without all backends being present in the environment. (Currently, one must install all possible backends for ilpy to even import, even if they only intend on using one)

The thing that would need to change, I believe, is the SolverFactory. Currently SolverFactory.cpp includes all of the headers that are present at build time, (and expects them all to be there at runtime), which would necessitate a different build for every backend/combination.

If we pulled out the SolverFactory.createXSolverBackend logic from cpp land and put it into python, then we could try/except any specified backend preferences, meaning if scip or gurobi wasn't installed, it would simply raise a runtime python exception (at the moment of unsatisfiable preference) rather than an ilpy ImportError.