Skip to content
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

adding relative & absolute mip gaps #17

Merged
merged 13 commits into from
Nov 3, 2023
7 changes: 4 additions & 3 deletions src/SolverAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ function response(
result_count = MOI.get(model, MOI.ResultCount())

try
res["relative_gap"] = Float64(MOI.get(model, MOI.RelativeGap()))
if isinf(res["relative_gap"])
res["relative_gap"] = nothing # Inf cannot be serialized to JSON
res["relative_gap"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line?

rel_gap = Float64(MOI.get(model, MOI.RelativeGap()))
if isinf(rel_gap)
res["relative_gap"] = rel_gap# Inf cannot be serialized to JSON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res["relative_gap"] = rel_gap# Inf cannot be serialized to JSON
res["relative_gap"] = rel_gap # Inf cannot be serialized to JSON

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, it should be if !isinf(rel_gap)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

end
catch
# ignore if solver does not support relative gap
Expand Down