-
Notifications
You must be signed in to change notification settings - Fork 42
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 empty optimization result + test of infeasible ip restricted master #173
Conversation
Codecov Report
@@ Coverage Diff @@
## master #173 +/- ##
==========================================
+ Coverage 76.87% 77.06% +0.18%
==========================================
Files 38 38
Lines 2171 2193 +22
==========================================
+ Hits 1669 1690 +21
- Misses 502 503 +1
Continue to review full report at Codecov.
|
@vitornesello GLPK throws an exception when you give it a model without variables. |
@@ -50,8 +50,8 @@ getprimalsols(res::OptimizationResult) = res.primal_sols | |||
getdualsols(res::OptimizationResult) = res.dual_sols | |||
nbprimalsols(res::OptimizationResult) = length(res.primal_sols) | |||
nbdualsols(res::OptimizationResult) = length(res.dual_sols) | |||
getbestprimalsol(res::OptimizationResult) = res.primal_sols[1] | |||
getbestdualsol(res::OptimizationResult) = res.dual_sols[1] | |||
getbestprimalsol(res::OptimizationResult) = get(res.primal_sols, 1, nothing) |
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.
Maybe we should leave it to the user to ask if there is a solution available in case he is not sure.
We could add a function issolavailable
Anyway after calling getbestsol
he will need to check if the return value was nothing
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 can add nbprimalsol()
and nbdualsol()
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.
They are already there..
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.
So what is the best behavior? In any case, the user should assure himself that there is at least one solution available, it he uses directly the result of the new getbestsol
he might also get in trouble
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 think it's fine for now if it returns nothing. I added new methods to handle this case e.g.
set_lp_primal_sol!(inc::Incumbents, ::Nothing) = false
. If the user works on the solution, he will have to test that solution != nothing
.
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.
It means we will have to add methods for functions that expect a solution all over the place.
problem, x, dec = CLD.GeneralizedAssignment.model(data, coluna) | ||
|
||
JuMP.optimize!(problem) | ||
@test JuMP.objective_value(problem) == Inf |
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 also check the feasibility status?
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.
It returns INFEASIBLE. I think it should be NODE_LIMIT. We should do that in another PR and tests all possible termination statuses.
Fix #167
Raise and fix #174