-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Add is_solved_and_feasible #3668
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3668 +/- ##
=======================================
Coverage 98.32% 98.33%
=======================================
Files 43 43
Lines 5686 5696 +10
=======================================
+ Hits 5591 5601 +10
Misses 95 95 ☔ View full report in Codecov by Sentry. |
See https://discourse.julialang.org/t/jump-behaviour-of-value-for-infeasible-models/109662/5 for some additional thoughts. |
docs/src/tutorials/getting_started/getting_started_with_JuMP.jl
Outdated
Show resolved
Hide resolved
I think I like my suggestion from discourse: """
has_solution(model::Model; dual::Bool = false)
Return `true` if the model has a feasible primal solution to return and the
solver terminated normally. If `dual`, additionally check that a feasible
dual solution is available.
If this function returns `false`, use [`termination_status`](@ref), [`result_count`](@ref),
[`primal_status`](@ref) and [`dual_status`](@ref) to understand what solutions
are available (if any).
"""
function has_solution(model::Model; dual::Bool = false)
ret = termination_status(model) in (OPTIMAL, LOCALLY_SOLVED) &&
primal_status(model) == FEASIBLE_POINT
if dual
ret &= dual_status(model) == FEASIBLE_POINT
end
return ret
end Then these would all just become We have |
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 a very welcome addition! I would also add some details on the various problem statuses, as mentioned on discourse
https://discourse.julialang.org/t/jump-behaviour-of-value-for-infeasible-models/109662/6
docs/src/tutorials/getting_started/getting_started_with_JuMP.jl
Outdated
Show resolved
Hide resolved
docs/src/tutorials/getting_started/getting_started_with_JuMP.jl
Outdated
Show resolved
Hide resolved
docs/src/tutorials/getting_started/getting_started_with_JuMP.jl
Outdated
Show resolved
Hide resolved
I've changed to |
x-ref https://discourse.julialang.org/t/jump-behaviour-of-value-for-infeasible-models/109662/4
Perhaps one reason the question keeps coming up is that the docs don't actually uniformly implement the checks (because we "know" that HiGHS will find the right answer) 😄 I'll take the blame for that.