Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve run_gurobi to wait for available token #281

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tgi-climact
Copy link
Contributor

When using a Gurobi floating token server license or a web single-use license, a program that calls Gurobi Optimizer must obtain a token from a Gurobi token server before it can solve an optimization model. When no token is available, an exception gurobipy.GurobiError is raised (source : https://support.gurobi.com/hc/en-us/articles/360029879251-How-do-I-check-the-availability-of-floating-license-tokens).

To avoid Gurobi Optimizer throwing an error, I suggest to optionally wait for an available token. This is the purpose of this PR. The waiting time (in seconds) can be configured in the solver options.

Side note : This enables scenarios in PyPSA-Eur.

Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 86.43%. Comparing base (f0c8457) to head (6ae5bfc).

Files Patch % Lines
linopy/solvers.py 20.00% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #281      +/-   ##
==========================================
- Coverage   89.69%   86.43%   -3.27%     
==========================================
  Files          16       16              
  Lines        4019     4032      +13     
  Branches      939      941       +2     
==========================================
- Hits         3605     3485     -120     
- Misses        281      421     +140     
+ Partials      133      126       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FabianHofmann
Copy link
Collaborator

thanks @tgi-climact, perhaps 60 secs is a bit long?

@tgi-climact
Copy link
Contributor Author

thanks @tgi-climact, perhaps 60 secs is a bit long?

Depending on the optimisation in progress, it could be very long or very short. I would like to avoid spam on the Gurobi servers. What would be your suggestion?

@FabianHofmann
Copy link
Collaborator

Depending on the optimisation in progress, it could be very long or very short. I would like to avoid spam on the Gurobi servers. What would be your suggestion?

okay I see, then the 60 secs make sense I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants