@@ -149,54 +149,52 @@ function _reset_bridge_graph(b::LazyBridgeOptimizer)
149149 return
150150end
151151
152- @nospecialize
153152"""
154153 _variable_nodes(b::LazyBridgeOptimizer, ::Type{BT}) where {BT}
155154
156155Return the list of `VariableNode` that would be added if `BT` is used in `b`.
157156"""
158157function _variable_nodes (
159- b:: LazyBridgeOptimizer ,
160- :: Type{BT} ,
161- ) where {BT <: AbstractBridge }
158+ @nospecialize ( b:: LazyBridgeOptimizer ) ,
159+ @nospecialize (BT :: Type{<:AbstractBridge} ) ,
160+ )
162161 return map (added_constrained_variable_types (BT)) do (S,)
163162 return node (b, S):: VariableNode
164163 end
165164end
166- @specialize
167165
168- @nospecialize
169166"""
170167 _constraint_nodes(b::LazyBridgeOptimizer, ::Type{BT}) where {BT}
171168
172169Return the list of `ConstraintNode` that would be added if `BT` is used in `b`.
173170"""
174171function _constraint_nodes (
175- b:: LazyBridgeOptimizer ,
176- :: Type{BT} ,
177- ) where {BT <: AbstractBridge }
172+ @nospecialize ( b:: LazyBridgeOptimizer ) ,
173+ @nospecialize (BT :: Type{<:AbstractBridge} ) ,
174+ )
178175 return ConstraintNode[
179176 node (b, F, S) for (F, S) in added_constraint_types (BT)
180177 ]
181178end
182- @specialize
183179
184- @nospecialize
185180"""
186181 _edge(b::LazyBridgeOptimizer, index::Int, BT::Type{<:AbstractBridge})
187182
188183Return the `Edge` or `ObjectiveEdge` in the hyper-graph associated with the
189184bridge `BT`, where `index` is the index of `BT` in the list of bridges.
190185"""
191- function _edge (b:: LazyBridgeOptimizer , index:: Int , BT:: Type{<:AbstractBridge} )
186+ function _edge (
187+ @nospecialize (b:: LazyBridgeOptimizer ),
188+ @nospecialize (index:: Int ),
189+ @nospecialize (BT:: Type{<:AbstractBridge} ),
190+ )
192191 return Edge (
193192 index,
194193 _variable_nodes (b, BT),
195194 _constraint_nodes (b, BT),
196195 bridging_cost (BT),
197196 )
198197end
199- @specialize
200198
201199# Method for objective bridges because they produce ObjectiveEdge.
202200function _edge (
310308Return the `ConstraintNode` associated with constraint `F`-in-`S` in `b`.
311309"""
312310function node (
313- b:: LazyBridgeOptimizer ,
314- F:: Type{<:MOI.AbstractFunction} ,
315- S:: Type{<:MOI.AbstractSet} ,
311+ @nospecialize ( b:: LazyBridgeOptimizer ) ,
312+ @nospecialize ( F:: Type{<:MOI.AbstractFunction} ) ,
313+ @nospecialize ( S:: Type{<:MOI.AbstractSet} ) ,
316314)
317315 # If we support the constraint type, the node is 0.
318316 if MOI. supports_constraint (b. model, F, S)
@@ -382,14 +380,12 @@ function _bridge_types(
382380 return b. variable_bridge_types
383381end
384382
385- @nospecialize
386383function _bridge_types (
387- b:: LazyBridgeOptimizer ,
388- :: Type{<:Constraint.AbstractBridge} ,
384+ @nospecialize ( b:: LazyBridgeOptimizer ) ,
385+ @nospecialize (BT :: Type{<:Constraint.AbstractBridge} ) ,
389386)
390387 return b. constraint_bridge_types
391388end
392- @specialize
393389
394390function _bridge_types (
395391 b:: LazyBridgeOptimizer ,
@@ -398,20 +394,21 @@ function _bridge_types(
398394 return b. objective_bridge_types
399395end
400396
401- @nospecialize
402397"""
403398 add_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
404399
405400Enable the use of the bridges of type `BT` by `b`.
406401"""
407- function add_bridge (b:: LazyBridgeOptimizer , BT:: Type{<:AbstractBridge} )
402+ function add_bridge (
403+ @nospecialize (b:: LazyBridgeOptimizer ),
404+ @nospecialize (BT:: Type{<:AbstractBridge} ),
405+ )
408406 if ! has_bridge (b, BT)
409407 push! (_bridge_types (b, BT), BT)
410408 _reset_bridge_graph (b)
411409 end
412410 return
413411end
414- @specialize
415412
416413"""
417414 remove_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
@@ -432,16 +429,17 @@ function remove_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
432429 return
433430end
434431
435- @nospecialize
436432"""
437433 has_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
438434
439435Return a `Bool` indicating whether the bridges of type `BT` are used by `b`.
440436"""
441- function has_bridge (b:: LazyBridgeOptimizer , BT:: Type{<:AbstractBridge} ):: Bool
437+ function has_bridge (
438+ @nospecialize (b:: LazyBridgeOptimizer ),
439+ @nospecialize (BT:: Type{<:AbstractBridge} ),
440+ ):: Bool
442441 return findfirst (isequal (BT), _bridge_types (b, BT)) != = nothing
443442end
444- @specialize
445443
446444# It only bridges when the constraint is not supporting, hence the name "Lazy"
447445function is_bridged (b:: LazyBridgeOptimizer , S:: Type{<:MOI.AbstractScalarSet} )
0 commit comments