Skip to content

Commit

Permalink
[Bridges] fix supports_constraint for IndicatorSOS1Bridge (#2507)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored May 26, 2024
1 parent fe4a36c commit 62b88c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Bridges/Constraint/bridges/indicator_sos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ function bridge_constraint(
end

function MOI.supports_constraint(
::Type{<:IndicatorSOS1Bridge},
::Type{<:MOI.AbstractVectorFunction},
::Type{<:IndicatorSOS1Bridge{T}},
::Type{MOI.VectorAffineFunction{T}},
::Type{<:MOI.Indicator{MOI.ACTIVATE_ON_ONE,<:MOI.AbstractScalarSet}},
)
) where {T}
return true
end

Expand Down Expand Up @@ -113,7 +113,7 @@ end

function concrete_bridge_type(
::Type{<:IndicatorSOS1Bridge{T}},
::Type{<:MOI.AbstractVectorFunction},
::Type{MOI.VectorAffineFunction{T}},
::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,S}},
) where {T,S}
return IndicatorSOS1Bridge{T,S}
Expand Down
14 changes: 14 additions & 0 deletions test/Bridges/Constraint/indicator_sos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,20 @@ function test_runtests()
[y, z] in SOS1([0.4, 0.6])
""",
)
# Test that the bridge does nothing for VectorQuadraticFunctions
MOI.Bridges.runtests(
MOI.Bridges.Constraint.IndicatorSOS1Bridge,
"""
variables: x, z
[z, 2.0 * x * x] in Indicator{ACTIVATE_ON_ONE}(LessThan(2.0))
z in ZeroOne()
""",
"""
variables: x, z
[z, 2.0 * x * x] in Indicator{ACTIVATE_ON_ONE}(LessThan(2.0))
z in ZeroOne()
""",
)
return
end

Expand Down

0 comments on commit 62b88c8

Please sign in to comment.