Skip to content

[Bridges] fix supports_constraint for IndicatorSOS1Bridge #2507

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 2 commits into from
May 26, 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
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
Loading