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
fix: scipy time limit raises SolverError #2080
fix: scipy time limit raises SolverError #2080
Conversation
Benchmarks that have stayed the same:
|
Thanks for making this PR! You should make sure a solution is actually present when the iteration limit/time limit is reached. We made a similar change to the SCIP interface, which caused a different bug (see #2050). This is a bit hard to unit test but if you could try I'd appreciate it (in test_conic_solvers.py). |
Will do! |
@SteveDiamond You were right to be concerned! It seems that when a time limit is reached, scipy will only sometimes return a solution. I was only able to get "Time limit reached" with a solution present when solving a MI problem with presolve=True (which is the default). The unit test I added may be flaky since it uses a time limit, but, unfortunately, SciPy/HiGHS has no iteration limit for MI problems. If you're concerned about this, we could drop the "run without enough time to find optimum" part. |
Since the "run without enough time to find optimum" test passes on all CI platforms I think it's probably ok. @rileyjmurray @phschiele what do you think? |
* fix: scipy time limit raises SolverError * fix: only allow optimal_inaccurate from scipy if solution is present * chore: lint fix
* Introduce ruff linter (#2049) * Fix scip timelimit no solution (#2084) * Add condition timelimit and no solution * Add timelimit example * Add unit test timelimit and no solution * attempt * Update timelimit * try to fix windows * remove failing test --------- Co-authored-by: Steven Diamond <steven@gridmatic.com> * Adds devcontainer support (#2088) * Adds minimal devcontainer setup * Adds docs * Fix conv and add convolve (#2047) * make conv more like np.convolve * more tests * make backwards compatible * add convolve, deprecate conv * added convolve, deprecated conv * update docs * Cherry-pick #2080 * Fix scip timelimit no solution (#2084) * Add condition timelimit and no solution * Add timelimit example * Add unit test timelimit and no solution * attempt * Update timelimit * try to fix windows * remove failing test --------- Co-authored-by: Steven Diamond <steven@gridmatic.com> * Fixes to PowCone3D and updates to test_conic_solvers.py (#2131) Update solver_test_helpers.py to include a cone program with SDP and power cone constraints. Correct a bug in PowCone3D.residual, which should have been declared as a property but was not. --------- Co-authored-by: Steven Diamond <steven@gridmatic.com> * Revert "Fixes to PowCone3D and updates to test_conic_solvers.py (#2131)" This reverts commit e68445e. * Fix rare bugs in curvature calculation: non-psd diagonal matrices and starting vectors in eigsh (#2086) * explicitly generate the starting vector in our calls to eigsh; generate the vector based on a fixed random stream. * Add special casing for diagonal matrices --------- Co-authored-by: Riley Murray <rileyjmurray@users.noreply.github.com> * Fix bug with calling Mosek simplex solver (#2126) * got new mosek simplex test passing * revert clarabel intf change * CBC interface: add ability to configure the underlying CLP solver (#1821) * update CBC our interface (which passes through cylp) so that the user can configure the underlying CLP solver. * write tests to verify that changing CLP tolerance settings will change CLP's behavior predictably. * write tests to verify that changing logLevel affects the amount of material logged to console. (This was hard!) * remove deprecated old test code * replace TestCBC's use of unittest.skipUnless with appropriately modified pytest.mark.skipif. --------- Co-authored-by: Riley Murray <rileyjmurray@users.noreply.github.com> * remove github banner (#2160) * Update scipy_wrapper (#2159) * update spwrapper * Update cvxpy/interface/scipy_wrapper.py Co-authored-by: Isaac Virshup <ivirshup@gmail.com> --------- Co-authored-by: Philipp Schiele <44360364+phschiele@users.noreply.github.com> Co-authored-by: Isaac Virshup <ivirshup@gmail.com> * Fixes to PowCone3D and updates to test_conic_solvers.py (#2131) Update solver_test_helpers.py to include a cone program with SDP and power cone constraints. Correct a bug in PowCone3D.residual, which should have been declared as a property but was not. --------- Co-authored-by: Steven Diamond <steven@gridmatic.com> * Explicit import of power cone 3d * Only port bug fix for mosek * Only port bug fix for mosek * Only port bug fix for mosek --------- Co-authored-by: Philipp Schiele <44360364+phschiele@users.noreply.github.com> Co-authored-by: Steven Diamond <steven@gridmatic.com> Co-authored-by: Steven Diamond <diamond@cs.stanford.edu> Co-authored-by: Allen Lawrence <allenlawrence94@gmail.com> Co-authored-by: Riskfolio <dany.cajas.n@uni.pe> Co-authored-by: Riley Murray <rileyjmurray@users.noreply.github.com> Co-authored-by: bkurtz <bkurtz@users.noreply.github.com> Co-authored-by: Isaac Virshup <ivirshup@gmail.com>
Description
When using SciPy, if the solver reaches it's set time limit, a
SolverError
is raised. This change makes it so these instances are instead reported asOPTIMAL_INACCURATE
. I think this behavior is more consistent with other solvers - this is at least how GLPK works currently.I haven't added a unit test for this. Let me know if this seems necessary.
Type of change
Contribution checklist