Skip to content

Commit 62b88c8

Browse files
authored
[Bridges] fix supports_constraint for IndicatorSOS1Bridge (#2507)
1 parent fe4a36c commit 62b88c8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/Bridges/Constraint/bridges/indicator_sos.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ function bridge_constraint(
6060
end
6161

6262
function MOI.supports_constraint(
63-
::Type{<:IndicatorSOS1Bridge},
64-
::Type{<:MOI.AbstractVectorFunction},
63+
::Type{<:IndicatorSOS1Bridge{T}},
64+
::Type{MOI.VectorAffineFunction{T}},
6565
::Type{<:MOI.Indicator{MOI.ACTIVATE_ON_ONE,<:MOI.AbstractScalarSet}},
66-
)
66+
) where {T}
6767
return true
6868
end
6969

@@ -113,7 +113,7 @@ end
113113

114114
function concrete_bridge_type(
115115
::Type{<:IndicatorSOS1Bridge{T}},
116-
::Type{<:MOI.AbstractVectorFunction},
116+
::Type{MOI.VectorAffineFunction{T}},
117117
::Type{MOI.Indicator{MOI.ACTIVATE_ON_ONE,S}},
118118
) where {T,S}
119119
return IndicatorSOS1Bridge{T,S}

test/Bridges/Constraint/indicator_sos.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,20 @@ function test_runtests()
332332
[y, z] in SOS1([0.4, 0.6])
333333
""",
334334
)
335+
# Test that the bridge does nothing for VectorQuadraticFunctions
336+
MOI.Bridges.runtests(
337+
MOI.Bridges.Constraint.IndicatorSOS1Bridge,
338+
"""
339+
variables: x, z
340+
[z, 2.0 * x * x] in Indicator{ACTIVATE_ON_ONE}(LessThan(2.0))
341+
z in ZeroOne()
342+
""",
343+
"""
344+
variables: x, z
345+
[z, 2.0 * x * x] in Indicator{ACTIVATE_ON_ONE}(LessThan(2.0))
346+
z in ZeroOne()
347+
""",
348+
)
335349
return
336350
end
337351

0 commit comments

Comments
 (0)