Skip to content

Commit e73f79c

Browse files
authored
[FileFormats.MPS] fix reading default bounds of INTORG variables (#2480)
1 parent ec4cfb1 commit e73f79c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/FileFormats/MPS/MPS.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,8 @@ end
14721472
function _set_intorg(data, column, column_name)
14731473
if data.intorg_flag
14741474
data.vtype[column] = VTYPE_INTEGER
1475+
# The default upper bound for variables in INTORG is `1`, not `Inf`...
1476+
data.col_upper[column] = 1.0
14751477
elseif data.vtype[column] != VTYPE_CONTINUOUS
14761478
error(
14771479
"Variable $(column_name) appeared in COLUMNS outside an " *

test/FileFormats/MPS/MPS.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ function test_stacked_data()
191191
return
192192
end
193193

194+
function test_integer_default_bounds()
195+
model = MPS.Model()
196+
MOI.read_from_file(model, joinpath(@__DIR__, "integer_default_bounds.mps"))
197+
x = only(MOI.get(model, MOI.ListOfVariableIndices()))
198+
ci = MOI.ConstraintIndex{MOI.VariableIndex,MOI.Interval{Float64}}(x.value)
199+
@test MOI.get(model, MOI.ConstraintSet(), ci) == MOI.Interval(0.0, 1.0)
200+
return
201+
end
202+
194203
function test_free_integer()
195204
model = MPS.Model()
196205
MOI.read_from_file(model, joinpath(@__DIR__, "free_integer.mps"))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
NAME
2+
OBJSENSE MIN
3+
ROWS
4+
N obj
5+
COLUMNS
6+
MARKER 'MARKER' 'INTORG'
7+
x obj 1
8+
MARKER 'MARKER' 'INTEND'
9+
RHS
10+
BOUNDS
11+
ENDATA

0 commit comments

Comments
 (0)