Solving PyPSA model with Gurobi in Google Colab - License problem
AnsweredHello!
I am trying to solve an optimization problem with PyPSA in Google Colab using Gurobi as solver, which normally works perfectly fine on my local computer. When I try to run this in Google Colab I always receive the error of the size-limited license, although I have the correct non-size-limited academic license.
Before trying to run this in Google Colab I followed the steps indicated in the post "Google Colab: Installation and Licensing". The problem is that the model to be optimized is inside PyPSA and must not be created by myself with a line like
model = gp.Model(env=e)
as indicated in the aforementioned post.
So what I need is to find out how to make the model run in the correct environment.
I have run these lines of code to create the environment:
e = gp.Env(empty=True)
e.setParam('WLSACCESSID', 'your wls accessid (string)')
e.setParam('WLSSECRET', 'your wls secret (string)')
e.setParam('LICENSEID', <your license id (integer)>)
e.start()
And I use this dictionary to pass specify some parameters for the Gurobi Solver:
-
Hi Sebastian,
Unfortunately, I think PyPSA uses Pyomo internally, which creates a default environment for you, so you cannot use the method you described.
Try saving the license file to be accessible through your Google Colab instance and setting the \(\texttt{GRB_LICENSE_FILE}\) to point to this file (use the full path).
Cheers,
David0 -
Hello David,
Thank you for your answer.
Regards,
Sebastián
0
Please sign in to leave a comment.
Comments
2 comments