Open
Conversation
Author
|
@bnaras hi, any chance you can review this super simple PR. It's very important to me |
Collaborator
Sorry this is a bit late, but please see the branch > result <- solve(problem, solver = "GUROBI")
> result$status
[1] "optimal"
attr(,"gurobi_status_code")
[1] "OPTIMAL"
attr(,"gurobi_status_desc")
[1] "Model was solved to optimality (subject to tolerances), and an optimal solution is available."
> result <- solve(problem, solver = "GUROBI", TimeLimit=1) ## optional valid parameter
> result$status
[1] "optimal"
attr(,"gurobi_status_code")
[1] "OPTIMAL"
attr(,"gurobi_status_desc")
[1] "Model was solved to optimality (subject to tolerances), and an optimal solution is available."
> result <- solve(problem, solver = "GUROBI", TimeLimit=0) ## optional valid parameter that should not proceed
> result$status
[1] "user_limit"
attr(,"gurobi_status_code")
[1] "TIME_LIMIT"
attr(,"gurobi_status_desc")
[1] "Optimization terminated because the time expended exceeded the value specified in the TimeLimit parameter."
> result <- solve(problem, solver = "GUROBI", TimeLimit1=1) ## optional INVALID parameter
Error in status_map(object, solution$status) :
GUROBI status unrecognized: SOLVER_ERROR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #99
Looking at the Gurobi docs, there are status codes which indicate user limits reached. It appears to me suboptimal solution may and often exist in these cases. https://www.gurobi.com/documentation/6.5/refman/optimization_status_codes.html#sec:StatusCodes
I played around with these Gurobi user limits, and indeed when time, iteration and solution limits are hit (in my single test case of a mixed integer programming problem), suboptimal solutions are returned from Gurobi solver, and can be successfully unpacked by CVXR.
I suggest we relax what CVXR considers suboptimal solutions to include these user limit solutions. I made the change for GUROBI_CONIC as well, though I didn't bother testing that.
I did not use USER_LIMIT for these user limits status codes because USER_LIMIT is not included in SOLUTION_PRESENT, which would have caused no solution unpacking. I'm not sure if it's wise to add USER_LIMIT to SOLUTION_PRESENT, so I did not use USER_LIMIT.