-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improved support for Gurobi environments #2370
base: master
Are you sure you want to change the base?
Conversation
|
11: s.SOLVER_ERROR, | ||
12: s.SOLVER_ERROR, | ||
13: s.SOLVER_ERROR} | ||
7: s.USER_LIMIT, # ITERATION_LIMIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about why this is a delta. This change should be in master. Maybe you need to sync with master?
or license_project is None | ||
or license_expiration_date is None | ||
or license_code is None): | ||
print("Note: License parameters can be provided in enviroment " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not print if verbose=False. Also I don't understand the meaning of the message.
# Create Gurobi model using default (unspecified) environment | ||
model = grb.Model() | ||
# Alternatively, reads the license off the environment variables | ||
log_file = os.getenv("GUROBI_LOG_FILE", "gurobi.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you factor out/clean up this code somehow?
Can you explain with a more concrete example what this PR is enabling? |
I think it's bad form to have cvxpy read in environment variables like this. To the extent the mechanism for providing the Gurobi Environment was unclear, I think this code belongs as just an example. I should also note that the Gurobi Env API has not been static and so this puts an additional burden on cvxpy for a specific license type that will not be easy to test. |
Considering the concerns about testing, do we want to proceed with this PR? |
Description
Gurobi is a commercial solver, with an academic license, trial license, etc. Three years ago, @sjschneider added support for instatiating the model with a custom environment, which would have the license details pre-loaded. It is non-obvious from the documentation how to set the environment up, though.
This pull request fixes gurobi_conif.py and gurobi_qpif.py such that even without specifying the environment, the license is loaded from the correct environment variables.
Type of change
Contribution checklist