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
3 changes: 0 additions & 3 deletions src/FileFormats/LP/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -981,9 +981,6 @@ function _add_bound(
end

function _add_bound(cache::_ReadCache, x::MOI.VariableIndex, set::MOI.LessThan)
if set.upper < 0
delete!(cache.variable_with_default_bound, x)
end
if isfinite(set.upper)
MOI.add_constraint(cache.model, x, set)
end
Expand Down
10 changes: 5 additions & 5 deletions test/FileFormats/LP/test_LP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ function test_read_model2()
ci = MOI.ConstraintIndex{MOI.VariableIndex,MOI.Interval{Float64}}(2)
@test !MOI.is_valid(model, ci)
@test MOI.get(model, MOI.VariableName(), MOI.VariableIndex(8)) == "V8"
@test model.variables.lower[8] == -Inf
@test model.variables.lower[8] == 0.0
@test model.variables.upper[8] == -3
obj_type = MOI.get(model, MOI.ObjectiveFunctionType())
obj_func = MOI.get(model, MOI.ObjectiveFunction{obj_type}())
Expand Down Expand Up @@ -895,17 +895,17 @@ function test_reading_bounds()
# Test upper bound
_test_round_trip("x <= 1", "Bounds\n0 <= x <= 1\nEnd")
_test_round_trip("x <= 0", "Bounds\nx = 0\nEnd")
_test_round_trip("x <= -1", "Bounds\n-infinity <= x <= -1\nEnd")
_test_round_trip("x <= -1", "Bounds\n0 <= x <= -1\nEnd")
_test_round_trip("x < 1", "Bounds\n0 <= x <= 1\nEnd")
_test_round_trip("x < 0", "Bounds\nx = 0\nEnd")
_test_round_trip("x < -1", "Bounds\n-infinity <= x <= -1\nEnd")
_test_round_trip("x < -1", "Bounds\n0 <= x <= -1\nEnd")
# Test reversed upper bound
_test_round_trip("1 >= x", "Bounds\n0 <= x <= 1\nEnd")
_test_round_trip("0 >= x", "Bounds\nx = 0\nEnd")
_test_round_trip("-1 >= x", "Bounds\n-infinity <= x <= -1\nEnd")
_test_round_trip("-1 >= x", "Bounds\n0 <= x <= -1\nEnd")
_test_round_trip("1 > x", "Bounds\n0 <= x <= 1\nEnd")
_test_round_trip("0 > x", "Bounds\nx = 0\nEnd")
_test_round_trip("-1 > x", "Bounds\n-infinity <= x <= -1\nEnd")
_test_round_trip("-1 > x", "Bounds\n0 <= x <= -1\nEnd")
# Test equality
_test_round_trip("x == 1", "Bounds\nx = 1\nEnd")
_test_round_trip("x == 0", "Bounds\nx = 0\nEnd")
Expand Down
Loading