Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
2.03k stars 518 forks source link

Default Gurobi interface may not work depending on how Gurobi was installed #2132

Closed michaelbynum closed 2 years ago

michaelbynum commented 3 years ago

Summary

Newer versions of Gurobi do not come with a "gurobi.sh" executable if installed with conda or pip. Our default Gurobi interface relies on this executable. I think we could fix this by checking if Gurobi is installed in the current environment. If so, we can simply use "python" as the executable instead of "gurobi.sh".

jsiirola commented 3 years ago

This is interesting: doing as you suggest would also help us get coverage statistics for the GUROBI_RUN.py interface, which would potentially be really useful.

Alternatively, we could have gurobi fall back on gurobi_direct if gurobi.sh was not available (or even preferentially use gurobi_direct if both gurobipy and gurobi.sh are present). The latter would potentially give users a performance improvement. However, in the past we have made arguments against "implicitly" switching the interface method (e.g., in the case of XPRESS; see the discussion in #2125). I'd be interested in hearing everyone's thoughts on this... Should we make the base solver name (e.g., 'gurobi') always be a meta solver that picks what we think is the best available interface unless the user explicitly calls out an interface (e.g., using SolverFactory('gurobi_lp') or SolverFactory('gurobi', solver_io='lp'))?

bknueven commented 3 years ago

Similar (if not identical in intent) to #1776.