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: 2 additions & 12 deletions src/Test/test_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -801,12 +801,7 @@ function test_model_LowerBoundAlreadySet(
@requires _supports(config, MOI.delete)
x = MOI.add_variable(model)
lb = zero(T)
sets = [
MOI.EqualTo(lb),
MOI.Interval(lb, lb),
MOI.Semicontinuous(lb, lb),
MOI.Semiinteger(lb, lb),
]
sets = [MOI.EqualTo(lb), MOI.Interval(lb, lb)]
set2 = MOI.GreaterThan(lb)
for set1 in sets
if !MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
Expand Down Expand Up @@ -839,12 +834,7 @@ function test_model_UpperBoundAlreadySet(
x = MOI.add_variable(model)
ub = zero(T)
@requires MOI.supports_constraint(model, MOI.VariableIndex, MOI.LessThan{T})
sets = [
MOI.EqualTo(ub),
MOI.Interval(ub, ub),
MOI.Semicontinuous(ub, ub),
MOI.Semiinteger(ub, ub),
]
sets = [MOI.EqualTo(ub), MOI.Interval(ub, ub)]
set2 = MOI.LessThan(ub)
for set1 in sets
if !MOI.supports_constraint(model, MOI.VariableIndex, typeof(set1))
Expand Down
23 changes: 23 additions & 0 deletions test/Bridges/Constraint/semi_to_binary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,29 @@ function test_SemiToBinary()
return
end

"""
test_lower_bound_already_set()

The second call to `add_constraint` is broken because it should throw:
```julia
MOI.LowerBoundAlreadySet{
MOI.Semicontinuous{Float64},
MOI.GreaterThan{Float64},
}
```
See MathOptInterface issue #1431.
"""
function test_lower_bound_already_set()
model = MOI.Utilities.Model{Float64}()
bridged = MOI.Bridges.Constraint.SemiToBinary{Float64}(model)
x = MOI.add_variable(bridged)
MOI.add_constraint(bridged, x, MOI.Semicontinuous(1.0, 2.0))
@test_broken(
MOI.add_constraint(bridged, x, MOI.GreaterThan(0.0)) === nothing,
)
return
end

end # module

TestConstraintSemiToBinary.runtests()