Skip to content

Commit

Permalink
ensure relative_gap is not NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
bachdavi committed Mar 21, 2024
1 parent bc8dab4 commit c570a56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SolverAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ function response(

try
rel_gap = Float64(MOI.get(model, MOI.RelativeGap()))
if !isinf(rel_gap)
res["relative_gap"] = rel_gap # Inf cannot be serialized to JSON
if !isinf(rel_gap) && !isnan(rel_gap)
res["relative_gap"] = rel_gap # Inf and NaN cannot be serialized to JSON
end
catch
# ignore if solver does not support relative gap
Expand Down

0 comments on commit c570a56

Please sign in to comment.