Skip to content

Commit

Permalink
[FileFormats.MPS] fix reading default bounds of INTORG variables
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Apr 12, 2024
1 parent ec4cfb1 commit c50a759
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FileFormats/MPS/MPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,8 @@ end
function _set_intorg(data, column, column_name)
if data.intorg_flag
data.vtype[column] = VTYPE_INTEGER
# The default upper bound for variables in INTORG is `1`, not `Inf`...
data.col_upper[column] = 1.0
elseif data.vtype[column] != VTYPE_CONTINUOUS
error(
"Variable $(column_name) appeared in COLUMNS outside an " *
Expand Down
9 changes: 9 additions & 0 deletions test/FileFormats/MPS/MPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ function test_stacked_data()
return
end

function test_integer_default_bounds()
model = MPS.Model()
MOI.read_from_file(model, joinpath(@__DIR__, "integer_default_bounds.mps"))
x = only(MOI.get(model, MOI.ListOfVariableIndices()))
ci = MOI.ConstraintIndex{MOI.VariableIndex,MOI.Interval{Float64}}(x.value)
@test MOI.get(model, MOI.ConstraintSet(), ci) == MOI.Interval(0.0, 1.0)
return
end

function test_free_integer()
model = MPS.Model()
MOI.read_from_file(model, joinpath(@__DIR__, "free_integer.mps"))
Expand Down
11 changes: 11 additions & 0 deletions test/FileFormats/MPS/integer_default_bounds.mps
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME
OBJSENSE MIN
ROWS
N obj
COLUMNS
MARKER 'MARKER' 'INTORG'
x obj 1
MARKER 'MARKER' 'INTEND'
RHS
BOUNDS
ENDATA

0 comments on commit c50a759

Please sign in to comment.