diff --git a/src/SolverAPI.jl b/src/SolverAPI.jl index 1251168..b583218 100644 --- a/src/SolverAPI.jl +++ b/src/SolverAPI.jl @@ -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