Question: How to Free Up Gurobi License for Sequential MIP Solves in PuLP? #763
-
I am using PuLP to solve multiple MIP problems sequentially (not in parallel) on a server that has only one Gurobi license using a token server. The issue I am encountering is that when I try to solve the second problem, PuLP defaults to using CBC instead of Gurobi. I suspect this happens because the Gurobi license is still blocked by the first solver instance, even though I have deleted the solver and run the garbage collector. Is there a way to properly release the Gurobi license after each solve in PuLP? Or is there a functionality similar to Gurobi's context manager in their Python API, like: with gp.Env() as env:
with gp.Model(env=env) as model1:
... Any help or guidance on how to ensure the Gurobi license is freed up between solves would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Not sure if this answers your question but the GUROBI solver has an Line 68 in 7286f40
|
Beta Was this translation helpful? Give feedback.
Not sure if this answers your question but the GUROBI solver has an
env
,envOptions
andmanageEnv
arguments . See:https://coin-or.github.io/pulp/technical/solvers.html#pulp.apis.GUROBI
I'm not sure why the documentation doesn't show all the arguments.
if you check the source code there are instructions:
(
pulp/pulp/apis/gurobi_api.py
Line 68 in 7286f40