@@ -11,12 +11,19 @@ abstract type AbstractBridgeOptimizer <: MOI.AbstractOptimizer end
11
11
"""
12
12
isbridged(b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})::Bool
13
13
14
- Return a `Bool` indicating whether `b` bridges `F`-in-`S` constraints.
14
+ Return a `Bool` indicating whether `b` tries to bridge `F`-in-`S` constraints instead of passing it as is to its internal model .
15
15
"""
16
16
function isbridged end
17
17
# Syntactic sugar
18
18
isbridged (b:: AbstractBridgeOptimizer , :: Type{CI{F, S}} ) where {F, S} = isbridged (b, F, S)
19
19
20
+ """
21
+ supportsbridgingconstraint(b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})::Bool
22
+
23
+ Return a `Bool` indicating whether `b` supports bridging `F`-in-`S` constraints.
24
+ """
25
+ supportsbridgingconstraint (:: AbstractBridgeOptimizer , :: Type{<:MOI.AbstractFunction} , :: Type{<:MOI.AbstractSet} ) = false
26
+
20
27
"""
21
28
bridgetype(b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
22
29
@@ -176,14 +183,14 @@ MOI.get(b::AbstractBridgeOptimizer, IdxT::Type{<:MOI.Index}, name::String) = MOI
176
183
# Constraints
177
184
function MOI. supportsconstraint (b:: AbstractBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
178
185
if isbridged (b, F, S)
179
- MOI. supportsconstraint (b. bridged, F, S)
186
+ supportsbridgingconstraint (b, F, S) && MOI. supportsconstraint (b. bridged, F, S)
180
187
else
181
188
MOI. supportsconstraint (b. model, F, S)
182
189
end
183
190
end
184
191
function MOI. canaddconstraint (b:: AbstractBridgeOptimizer , F:: Type{<:MOI.AbstractFunction} , S:: Type{<:MOI.AbstractSet} )
185
192
if isbridged (b, F, S)
186
- MOI. canaddconstraint (b. bridged, F, S)
193
+ supportsbridgingconstraint (b, F, S) && MOI. canaddconstraint (b. bridged, F, S) && all (C -> MOI . canaddconstraint (b, C ... ), addedconstrainttypes ( bridgetype (b, F, S), F, S) )
187
194
else
188
195
MOI. canaddconstraint (b. model, F, S)
189
196
end
0 commit comments