diff --git a/src/Bridges/Constraint/bridges/table.jl b/src/Bridges/Constraint/bridges/table.jl index 764c891b2a..96de3ef0d1 100644 --- a/src/Bridges/Constraint/bridges/table.jl +++ b/src/Bridges/Constraint/bridges/table.jl @@ -72,7 +72,11 @@ function bridge_constraint( end assign_f = MOI.ScalarAffineFunction(terms, zero(T)) assign_f = MOI.Utilities.operate!(-, T, assign_f, fi) - ci = MOI.add_constraint(model, assign_f, MOI.EqualTo(zero(T))) + ci = MOI.Utilities.normalize_and_add_constraint( + model, + assign_f, + MOI.EqualTo(zero(T)), + ) push!(assignment, ci) end return TableToMILPBridge{T,F}(z, unity, assignment, f, s) diff --git a/test/Bridges/Constraint/table.jl b/test/Bridges/Constraint/table.jl index 9c345e1567..7a82cf4580 100644 --- a/test/Bridges/Constraint/table.jl +++ b/test/Bridges/Constraint/table.jl @@ -40,6 +40,24 @@ function test_runtests() a4 in ZeroOne() """, ) + MOI.Bridges.runtests( + MOI.Bridges.Constraint.TableToMILPBridge, + """ + variables: x, y + [x, y, 1] in Table(Float64[1 1 0; 0 1 1; 1 0 1; 1 1 1]) + """, + """ + variables: x, y, a1, a2, a3, a4 + a1 + a2 + a3 + a4 == 1.0 + a1 + a3 + a4 + -1.0 * x == 0.0 + a1 + a2 + a4 + -1.0 * y == 0.0 + a2 + a3 + a4 == 1.0 + a1 in ZeroOne() + a2 in ZeroOne() + a3 in ZeroOne() + a4 in ZeroOne() + """, + ) return end