Change gurobi enviroment parameters through pyomo
AnsweredI am trying to run a pyomo model with gurobi as a solver using a WLS licence (in google colab).
this website https://support.gurobi.com/hc/en-us/articles/4409582394769-Google-Colab-Installation-and-Licensing explains how to use a wls license. If i run the code example on the website in google colab i can create a model using the enviroment with the WLS license
# Create an environment with your WLS license
params = {
"WLSACCESSID": 'your wls accessid (string)',
"WLSSECRET": 'your wls secret (string)',
"LICENSEID": <your license id (integer)>,
}
env = gp.Env(params=params)
# Create the model within the Gurobi environment
model = gp.Model(env=env)
I want Pyomo to als acces the Gurobi environment with the WLS license, in the following manner.
solver = SolverFactory("gurobi")
solver.options['WLSACCESSID'] = <WLS ID here>
solver.options['WLSSECRET'] = <Key here>
solver.options['LICENSEID'] = <ID here>
results = solver.solve(model)
But that gave the following error :
GurobiError: Unable to modify parameter WLSAccessID after environment started
Is there another way to set the Gurobi environment options through pyomo?
-
Hi Jasper,
I'm no Pyomo expert, but following this answer, I would take it that it is not possible to explicitly manage Gurobi environments with Pyomo. There is even an open issue in Pyomo GitHub repo in this respect.
Best regards
Jonasz0
Please sign in to leave a comment.
Comments
1 comment