Model too large for size-limited license
AnsweredHi,
Thank you so much for your continued help. I tried to solve a large model with Gurobi and I got the error said the model is too large. Then I applied for a WLS license and click the link https://gurobi.com/unrestricted and follow the step (https://support.gurobi.com/hc/en-us/articles/13232844297489-How-do-I-set-up-a-Web-License-Service-WLS-license) to download my own gurobi.lic and write them in the code, and retry to solve the whole model, here is the code, I just use the example id as the example:
options = { "WLSACCESSID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "WLSSECRET": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "LICENSEID": 12345, }
with gp.Env(params=options) as env, gp.Model(env=env) as model:
m1 = gp.Model("Fair_regression")
...
m1.optimize()
Then I still met the same problem about the model is too large:
Could you please tell me how to solve this large scale model with the academia license? Thank you!
-
Your code is very close! You first create a Gurobi environment named \(\texttt{env}\) using your WLS license credentials, then associate that environment to a Model object called \(\texttt{model}\):
with gp.Env(params=options) as env, gp.Model(env=env) as model:
The \(\texttt{model}\) Model properly uses your WLS license. The problem comes from the next line of code, where you create a second Model object \(\texttt{m1}\) that is not associated with the \(\texttt{env}\) environment:
m1 = gp.Model("Fair_regression")
Because you do not pass an environment to the Model() constructor, Gurobi looks for a license file on your machine. It does not find one, and instead relies on the size-limited license file included in the \(\texttt{gurobipy}\) installation. Thus, model \(\texttt{m1}\) is restricted by this size-limited license.
To fix the issue, make sure the model you solve is associated with the \(\texttt{env}\) environment:
with gp.Env(params=options) as env, gp.Model("Fair_regression", env=env) as m1: ... m1.optimize()
0 -
Thank you so much Eli, that works!
0
Please sign in to leave a comment.
Comments
2 comments