Skip to content

Check solving state of model #5

Answered by metab0t
Zhanwei-Liu asked this question in Q&A
Discussion options

You must be logged in to vote

For the solver-agnostic attribute, the return value of model.get_model_attribute(poi.ModelAttribute.TerminationStatus) is pyoptinterface.TerminationStatusCode as documented in the table.

status = model.get_model_attribute(poi.ModelAttribute.TerminationStatus)
if status == poi.TerminationStatusCode.OPTIMAL:
    ...
elif status == poi.TerminationStatusCode.INFEASIBLE:
    ...
elif status == poi.TerminationStatusCode.INFEASIBLE_OR_UNBOUNDED
    ...

The concept is the same as JuMP.jl and I have followed the same logic in Gurobi.jl
https://jump.dev/JuMP.jl/stable/manual/solutions/#Why-did-the-solver-stop?
https://jump.dev/JuMP.jl/stable/moi/reference/models/#MathOptInterface.TerminationStatusCode

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Zhanwei-Liu
Comment options

You must be logged in to vote
1 reply
@Zhanwei-Liu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants