-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add 'save_file' kwargs for GUROBI. #1720
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
Conversation
- use Gurobi.write(save_file) to save the model file. - cplex and mosek have the similar functionality.
# Save file (*.mst, *.sol, ect.) | ||
if 'save_file' in solver_opts: | ||
model.write(solver_opts['save_file']) | ||
del solver_opts['save_file'] |
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.
No need to delete.
Thanks for adding this! Could you write a test as well? It's not so much to validate the code (which is very simple), as to commit us to maintaining this functionality. |
A test is added |
Thanks for adding the test! The CI is failing because of code style issues. Please follow these instructions: https://www.cvxpy.org/contributing/index.html#code-style @rileyjmurray how should this test be integrated into the solver tests? |
NIT: Perhaps the file |
created a folder called ./cvxpy/tests/resources/
|
No worries, we'll take it from here. |
the test fails (might) because there was no ./resources/ folder, and now it fixes the problem. |
cvxpy/tests/test_gurobi_write.py
Outdated
@@ -0,0 +1,48 @@ | |||
""" | |||
Copyright 2022 Jiaxin Wang |
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.
@qiuwjx please change this line to "Copyright 2022, the CVXPY authors"
cvxpy/tests/test_gurobi_write.py
Outdated
|
||
|
||
class TestGurobiWrite(BaseTest): | ||
""" Unit tests for the expression/expression module. """ |
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.
@qiuwjx this docstring isn't correct
…github.com:cvxpy/cvxpy * 'master' of github.com:QiuWJX/cvxpy: changed the copyright and docstring create resources folder in codes undid changes standardized the code style created a folder called ./cvxpy/tests/resources/ Add unit test for gurobi `model.write()` Add 'save_file' kwargs for GUROBI. - use Gurobi.write(save_file) to save the model file. - cplex and mosek have the similar functionality. cvxpy/tests: Add test for infeasible boolean problem (#1705) Handle new CyLP statuses from coin-or/CyLP#150 (#1707) * 'master' of github.com:cvxpy/cvxpy: SCIP: add version requirement (< 4.0.0) and fix solve_via_data to eliminate certain error messages update error message for mixed-integer problems (#1738) remove out of date news fix TypeError in GLOP and PDLP interfaces (#1736) Propagate today's documentation improvements from release/1.2.x (#1733) Cylp update (#1727) Add 'save_file' kwargs for GUROBI. (#1720) pip install cvxpy[GLOP,XPRESS] (#1719) Fix #1714 cvxpy/tests: Add test for infeasible boolean problem (#1705) Handle new CyLP statuses from coin-or/CyLP#150 (#1707)
Description
Very simple changes.
Make it possible to write model using gurobi.
Type of change
Contribution checklist