From 97870a8238e7ef7122173c4ea6eca70708211b09 Mon Sep 17 00:00:00 2001 From: odow Date: Fri, 8 Aug 2025 16:18:03 +1200 Subject: [PATCH 1/2] Get back to 100% code coverage --- src/FileFormats/MPS/MPS.jl | 15 ++++++++------- .../Constraint/IntervalToHyperRectangleBridge.jl | 11 +++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/FileFormats/MPS/MPS.jl b/src/FileFormats/MPS/MPS.jl index 12a0fea13d..d173558d34 100644 --- a/src/FileFormats/MPS/MPS.jl +++ b/src/FileFormats/MPS/MPS.jl @@ -1444,14 +1444,15 @@ end function parse_rows_line(data::TempMPSModel{T}, items::Vector{String}) where {T} if length(items) < 2 error("Malformed ROWS line: $(join(items, " "))") - elseif length(items) > 2 - # We could throw an error here, but it seems like other solvers just - # happily ignore the extra fields. - # - # See https://github.com/jump-dev/MathOptInterface.jl/issues/2792 - # - # Oscar dislikes the poorly standardized nature of MPS. end + # if length(items) > 2 + # We could throw an error here, but it seems like other solvers just + # happily ignore the extra fields. + # + # See https://github.com/jump-dev/MathOptInterface.jl/issues/2792 + # + # Oscar dislikes the poorly standardized nature of MPS. + # end sense, name = Sense(items[1]), items[2] if haskey(data.name_to_row, name) error("Duplicate row encountered: $(join(items, " ")).") diff --git a/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl b/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl index 80c36c624e..ad33ca7450 100644 --- a/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl +++ b/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl @@ -116,6 +116,17 @@ function test_runtests(T) return end +function test_modify_ScalarCoefficientChange() + inner = MOI.Utilities.Model{Float64}() + model = MOI.Bridges.Constraint.IntervalToHyperRectangle{Float64}(inner) + x = MOI.add_variable(model) + c = MOI.add_constraint(model, 1.0 * x, MOI.Interval(0.0, 1.0)) + @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), 1.0 * x) + MOI.modify(model, c, MOI.ScalarCoefficientChange(x, 2.0)) + @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), 2.0 * x) + return +end + end # module TestConstraintIntervalToHyperRectangle.runtests() From 1f992ef52ed841d29eded96773ea565975d49f05 Mon Sep 17 00:00:00 2001 From: odow Date: Fri, 8 Aug 2025 16:55:33 +1200 Subject: [PATCH 2/2] Update --- .../Constraint/IntervalToHyperRectangleBridge.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl b/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl index ad33ca7450..63a992bc62 100644 --- a/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl +++ b/test/Bridges/Constraint/IntervalToHyperRectangleBridge.jl @@ -116,14 +116,14 @@ function test_runtests(T) return end -function test_modify_ScalarCoefficientChange() - inner = MOI.Utilities.Model{Float64}() - model = MOI.Bridges.Constraint.IntervalToHyperRectangle{Float64}(inner) +function test_modify_ScalarCoefficientChange(T) + inner = MOI.Utilities.Model{T}() + model = MOI.Bridges.Constraint.IntervalToHyperRectangle{T}(inner) x = MOI.add_variable(model) - c = MOI.add_constraint(model, 1.0 * x, MOI.Interval(0.0, 1.0)) - @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), 1.0 * x) - MOI.modify(model, c, MOI.ScalarCoefficientChange(x, 2.0)) - @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), 2.0 * x) + c = MOI.add_constraint(model, T(1) * x, MOI.Interval(T(0), T(1))) + @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), T(1) * x) + MOI.modify(model, c, MOI.ScalarCoefficientChange(x, T(2))) + @test ≈(MOI.get(model, MOI.ConstraintFunction(), c), T(2) * x) return end