diff --git a/src/Bridges/Constraint/bridge.jl b/src/Bridges/Constraint/bridge.jl index 0320db5e1f..4337336b03 100644 --- a/src/Bridges/Constraint/bridge.jl +++ b/src/Bridges/Constraint/bridge.jl @@ -36,9 +36,9 @@ Return a `Bool` indicating whether the bridges of type `BT` support bridging constraint types that the bridge implements. """ function MOI.supports_constraint( - ::Type{<:AbstractBridge}, - ::Type{<:MOI.AbstractFunction}, - ::Type{<:MOI.AbstractSet}, + @nospecialize(BT::Type{<:AbstractBridge}), + @nospecialize(F::Type{<:MOI.AbstractFunction}), + @nospecialize(S::Type{<:MOI.AbstractSet}), ) return false end diff --git a/src/Bridges/Constraint/single_bridge_optimizer.jl b/src/Bridges/Constraint/single_bridge_optimizer.jl index 5839ac7c1a..496447f25e 100644 --- a/src/Bridges/Constraint/single_bridge_optimizer.jl +++ b/src/Bridges/Constraint/single_bridge_optimizer.jl @@ -105,9 +105,9 @@ function MOI.Bridges.supports_bridging_constrained_variable( end function MOI.Bridges.supports_bridging_constraint( - ::SingleBridgeOptimizer{BT}, - F::Type{<:MOI.AbstractFunction}, - S::Type{<:MOI.AbstractSet}, + @nospecialize(b::SingleBridgeOptimizer{BT}), + @nospecialize(F::Type{<:MOI.AbstractFunction}), + @nospecialize(S::Type{<:MOI.AbstractSet}), ) where {BT} return MOI.supports_constraint(BT, F, S) end diff --git a/src/Bridges/lazy_bridge_optimizer.jl b/src/Bridges/lazy_bridge_optimizer.jl index cc4387467f..62041b3d90 100644 --- a/src/Bridges/lazy_bridge_optimizer.jl +++ b/src/Bridges/lazy_bridge_optimizer.jl @@ -155,9 +155,9 @@ end Return the list of `VariableNode` that would be added if `BT` is used in `b`. """ function _variable_nodes( - b::LazyBridgeOptimizer, - ::Type{BT}, -) where {BT<:AbstractBridge} + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(BT), +) return map(added_constrained_variable_types(BT)) do (S,) return node(b, S)::VariableNode end @@ -169,9 +169,9 @@ end Return the list of `ConstraintNode` that would be added if `BT` is used in `b`. """ function _constraint_nodes( - b::LazyBridgeOptimizer, - ::Type{BT}, -) where {BT<:AbstractBridge} + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(BT), +) return ConstraintNode[ node(b, F, S) for (F, S) in added_constraint_types(BT) ] @@ -183,7 +183,11 @@ end Return the `Edge` or `ObjectiveEdge` in the hyper-graph associated with the bridge `BT`, where `index` is the index of `BT` in the list of bridges. """ -function _edge(b::LazyBridgeOptimizer, index::Int, BT::Type{<:AbstractBridge}) +function _edge( + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(index::Int), + @nospecialize(BT::Type{<:AbstractBridge}), +) return Edge( index, _variable_nodes(b, BT), @@ -247,7 +251,10 @@ end Return the `VariableNode` associated with set `S` in `b`. """ -function node(b::LazyBridgeOptimizer, S::Type{<:MOI.AbstractSet}) +function node( + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(S::Type{<:MOI.AbstractSet}), +) # If we support the set, the node is 0. if ( S <: MOI.AbstractScalarSet && @@ -304,9 +311,9 @@ end Return the `ConstraintNode` associated with constraint `F`-in-`S` in `b`. """ function node( - b::LazyBridgeOptimizer, - F::Type{<:MOI.AbstractFunction}, - S::Type{<:MOI.AbstractSet}, + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(F::Type{<:MOI.AbstractFunction}), + @nospecialize(S::Type{<:MOI.AbstractSet}), ) # If we support the constraint type, the node is 0. if MOI.supports_constraint(b.model, F, S) @@ -377,8 +384,8 @@ function _bridge_types( end function _bridge_types( - b::LazyBridgeOptimizer, - ::Type{<:Constraint.AbstractBridge}, + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(BT::Type{<:Constraint.AbstractBridge}), ) return b.constraint_bridge_types end @@ -395,7 +402,10 @@ end Enable the use of the bridges of type `BT` by `b`. """ -function add_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge}) +function add_bridge( + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(BT::Type{<:AbstractBridge}), +) if !has_bridge(b, BT) push!(_bridge_types(b, BT), BT) _reset_bridge_graph(b) @@ -427,7 +437,10 @@ end Return a `Bool` indicating whether the bridges of type `BT` are used by `b`. """ -function has_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge}) +function has_bridge( + @nospecialize(b::LazyBridgeOptimizer), + @nospecialize(BT::Type{<:AbstractBridge}), +)::Bool return findfirst(isequal(BT), _bridge_types(b, BT)) !== nothing end diff --git a/src/Test/Test.jl b/src/Test/Test.jl index 3332e3cc3c..18e8d5d0a2 100644 --- a/src/Test/Test.jl +++ b/src/Test/Test.jl @@ -500,9 +500,9 @@ function _test_attribute_value_type( end function _test_attribute_value_type( - model::MOI.ModelLike, - attribute::MOI.AbstractConstraintAttribute, - ci::MOI.ConstraintIndex, + @nospecialize(model::MOI.ModelLike), + @nospecialize(attribute::MOI.AbstractConstraintAttribute), + @nospecialize(ci::MOI.ConstraintIndex), ) T = MOI.attribute_value_type(attribute) @test @inferred(T, MOI.get(model, attribute, ci)) isa T diff --git a/src/Utilities/model.jl b/src/Utilities/model.jl index 184488c3b8..62125a41eb 100644 --- a/src/Utilities/model.jl +++ b/src/Utilities/model.jl @@ -303,10 +303,10 @@ function MOI.is_valid(model::AbstractModel, ci::MOI.ConstraintIndex) end function MOI.supports_constraint( - model::AbstractModel, - ::Type{F}, - ::Type{S}, -) where {F<:MOI.AbstractFunction,S<:MOI.AbstractSet} + @nospecialize(model::AbstractModel), + @nospecialize(F::Type{<:MOI.AbstractFunction}), + @nospecialize(S::Type{<:MOI.AbstractSet}), +) return MOI.supports_constraint(model.constraints, F, S) end diff --git a/src/constraints.jl b/src/constraints.jl index 081b4235d2..e98ad116b4 100644 --- a/src/constraints.jl +++ b/src/constraints.jl @@ -18,9 +18,9 @@ supported in specific circumstances, for example, `F`-in-`S` constraints cannot combined with another type of constraint, it should still return `true`. """ function supports_constraint( - ::ModelLike, - ::Type{<:AbstractFunction}, - ::Type{<:AbstractSet}, + @nospecialize(::ModelLike), + @nospecialize(F::Type{<:AbstractFunction}), + @nospecialize(S::Type{<:AbstractSet}), ) return false end