6464Return a list of bridges that may be needed to bridge `F`-in-`S` constraints but
6565not the bridges that may be needed by constraints added by the bridges.
6666"""
67- bridges (:: Type{<:MOI.AbstractFunction} , :: Type{<:MOI.AbstractSet} ) = []
67+ bridges (:: Type{<:MOI.AbstractFunction} , :: Type{<:MOI.AbstractSet} ) =
68+ Tuple{Type,Type}[]
6869
6970"""
7071 bridges(S::Type{<:MOI.AbstractSet})
@@ -79,21 +80,27 @@ function bridges(
7980 F:: Type{<:MOI.AbstractVectorFunction} ,
8081 :: Type{<:ZeroPolynomialSet{SS.FullSpace}} ,
8182)
82- return [(Bridges. Constraint. ZeroPolynomialBridge, _coef_type (F))]
83+ return Tuple{Type,Type}[(
84+ Bridges. Constraint. ZeroPolynomialBridge,
85+ coefficient_type_or_float (F),
86+ )]
8387end
8488
8589function bridges (
8690 F:: Type{<:MOI.AbstractVectorFunction} ,
8791 :: Type{<:ZeroPolynomialSet{<:SS.AbstractAlgebraicSet}} ,
8892)
89- return [(
93+ return Tuple{Type,Type} [(
9094 Bridges. Constraint. ZeroPolynomialInAlgebraicSetBridge,
91- _coef_type (F),
95+ coefficient_type_or_float (F),
9296 )]
9397end
9498
9599function bridges (F:: Type{<:MOI.AbstractVectorFunction} , :: Type{<:PlusMinusSet} )
96- return [(Bridges. Constraint. PlusMinusBridge, _coef_type (F))]
100+ return Tuple{Type,Type}[(
101+ Bridges. Constraint. PlusMinusBridge,
102+ coefficient_type_or_float (F),
103+ )]
97104end
98105
99106"""
@@ -143,8 +150,13 @@ function bridgeable(c::JuMP.AbstractConstraint, S::Type{<:MOI.AbstractSet})
143150 return c
144151end
145152
146- _coef_type (:: Type{<:MOI.AbstractFunction} ) = Float64
147- _coef_type (:: Type{<:MOI.Utilities.TypedLike{T}} ) where {T} = T
153+ # TODO If `JuMP.value_type` is not `Float64`, we should
154+ # redo `bridgeable`, `bridges` etc... in `JuMP.model_convert`
155+ # the most important is that `MOI.Bridges.concrete_bridge_type`
156+ # works so we should stick to the same coefficient type if there is
157+ # one. If there is none, `Float64` should be fine.
158+ coefficient_type_or_float (:: Type{<:MOI.AbstractFunction} ) = Float64
159+ coefficient_type_or_float (:: Type{<:MOI.Utilities.TypedLike{T}} ) where {T} = T
148160
149161function bridgeable (
150162 c:: JuMP.AbstractConstraint ,
0 commit comments