Skip to content

[FileFormats.MPS] fix reading default bounds of INTORG variables #2480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2024
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
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