-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Extract solver stats for SCIP #3043
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
cvxpy/problems/problem.py
Outdated
| raise error.SolverError(f"All solvers failed: {solvers}") | ||
|
|
||
| def solve(self, *args, **kwargs): | ||
| def solve(self, *args, **kwargs) -> float: |
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 is an unrelated change but it has bugged me a few times when typing downstream projects 😄
I added a check that the value is a float and it seems to always be the case in the test suite, but I'm not 100% sure it's guaranteed in all cases.
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 looked into this, and the result could be None if the solver status is something like INFEASIBLE_OR_UNBOUNDED. See https://github.com/cvxpy/cvxpy/blob/master/cvxpy/reductions/solution.py#L30 So the return type should be float | None
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.
Indeed my test setup wasn't in the correct place, there seems to be a lot of possible return types (though I'm not sure it's correct). Here are some types generated during the tests:
float,intOKNoneOKnp.complex128? (the imaginary part is 0 up to numerical precision)tuple? (I think this is using custom solve methods)
So I'll just revert this change for now, it should be handled more thoroughly.
| def solve(self, *args, **kwargs) -> float: | |
| def solve(self, *args, **kwargs): |
SteveDiamond
left a comment
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.
LGTM other than changing solve return type to float | None
|
Benchmarks that have stayed the same: |
Description
Please include a short summary of the change.
The SCIP interface currently doesn't return any information about the solving process to the end user, despite retrieving it after the optimization.
This PR ensures the information is passed along the solving chain.
I added the usual attributes as well as the model itself to the extra stats to enable more advanced analysis without having to extract all available fields in the interface. One field I was unsure about is
SETUP_TIME, I wasn't able to find a clear definition and an equivalent in SCIP.Closes #2591
Closes #2910
Type of change
Contribution checklist