Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/FileFormats/MPS/MPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,20 @@ function test_obj_constant_max_to_max()
return
end

function test_duplicate_coefficient()
model = MPS.Model()
MOI.read_from_file(model, joinpath(@__DIR__, "duplicate_coefficient.mps"))
dest = MOI.Utilities.Model{Float64}()
MOI.copy_to(dest, model)
F, S = MOI.ScalarAffineFunction{Float64}, MOI.EqualTo{Float64}
x = only(MOI.get(dest, MOI.ListOfVariableIndices()))
c = only(MOI.get(dest, MOI.ListOfConstraintIndices{F,S}()))
f = MOI.get(dest, MOI.ConstraintFunction(), c)
@test isapprox(f, 2.0 * x)
@test MOI.get(dest, MOI.ConstraintSet(), c) == MOI.EqualTo(1.0)
return
end

end # TestMPS

TestMPS.runtests()
13 changes: 13 additions & 0 deletions test/FileFormats/MPS/duplicate_coefficient.mps
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NAME DUPLICATE_COEFFICIENT
ROWS
N obj
E c
COLUMNS
x obj 1
x c 1
x c 1
RHS
rhs c 1
BOUNDS
FR bounds x
ENDATA
Loading