Skip to content

Commit ec19690

Browse files
authored
Merge pull request #508 from JuliaOpt/bl/renamebridges
Rename bridges
2 parents 5b9e114 + 10dac5d commit ec19690

13 files changed

+65
-65
lines changed

docs/src/apireference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ Bridges.AbstractBridge
326326
Bridges.AbstractBridgeOptimizer
327327
Bridges.SingleBridgeOptimizer
328328
Bridges.LazyBridgeOptimizer
329-
Bridges.addbridge!
329+
Bridges.add_bridge
330330
```
331331

332332
Below is the list of bridges implemented in this package.

src/Bridges/Bridges.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ Returns a `LazyBridgeOptimizer` bridging `model` for every bridge defined in thi
3232
"""
3333
function fullbridgeoptimizer(model::MOI.ModelLike, ::Type{T}) where T
3434
bridgedmodel = MOIB.LazyBridgeOptimizer(model, AllBridgedConstraints{T}())
35-
addbridge!(bridgedmodel, MOIB.SplitIntervalBridge{T})
36-
addbridge!(bridgedmodel, MOIB.GeoMeanBridge{T})
37-
addbridge!(bridgedmodel, MOIB.SquarePSDBridge{T})
38-
addbridge!(bridgedmodel, MOIB.LogDetBridge{T})
39-
addbridge!(bridgedmodel, MOIB.RootDetBridge{T})
40-
addbridge!(bridgedmodel, MOIB.RSOCBridge{T})
41-
addbridge!(bridgedmodel, MOIB.RSOCtoPSDBridge{T})
42-
addbridge!(bridgedmodel, MOIB.SOCtoPSDBridge{T})
35+
add_bridge(bridgedmodel, MOIB.SplitIntervalBridge{T})
36+
add_bridge(bridgedmodel, MOIB.GeoMeanBridge{T})
37+
add_bridge(bridgedmodel, MOIB.SquarePSDBridge{T})
38+
add_bridge(bridgedmodel, MOIB.LogDetBridge{T})
39+
add_bridge(bridgedmodel, MOIB.RootDetBridge{T})
40+
add_bridge(bridgedmodel, MOIB.RSOCBridge{T})
41+
add_bridge(bridgedmodel, MOIB.RSOCtoPSDBridge{T})
42+
add_bridge(bridgedmodel, MOIB.SOCtoPSDBridge{T})
4343
bridgedmodel
4444
end
4545

src/Bridges/bridge.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ Return a `Bool` indicating whether the bridges of type `BT` support bridging `F`
3838
MOI.supports_constraint(::Type{<:AbstractBridge}, ::Type{<:MOI.AbstractFunction}, ::Type{<:MOI.AbstractSet}) = false
3939

4040
"""
41-
addedconstrainttypes(BT::Type{<:AbstractBridge}, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})::Bool
41+
added_constraint_types(BT::Type{<:AbstractBridge}, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})::Bool
4242
4343
Return a list of the types of constraints that bridges of type `BT` add for
4444
bridging an `F`-in-`S` constraints.
4545
46-
addedconstrainttypes(BT::Type{<:AbstractBridge})::Bool
46+
added_constraint_types(BT::Type{<:AbstractBridge})::Bool
4747
4848
Return a list of the types of constraints that bridges of concrete type `BT` add
4949
for `F`-in-`S` constraints.
5050
"""
51-
function addedconstrainttypes(BT::Type{<:AbstractBridge},
51+
function added_constraint_types(BT::Type{<:AbstractBridge},
5252
F::Type{<:MOI.AbstractFunction},
5353
S::Type{<:MOI.AbstractSet})
54-
addedconstrainttypes(concrete_bridge_type(BT, F, S))
54+
added_constraint_types(concrete_bridge_type(BT, F, S))
5555
end
5656

5757

src/Bridges/bridgeoptimizer.jl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ abstract type AbstractBridgeOptimizer <: MOI.AbstractOptimizer end
1616
# AbstractBridgeOptimizer interface
1717

1818
"""
19-
isbridged(b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction},
19+
is_bridged(b::AbstractBridgeOptimizer, F::Type{<:MOI.AbstractFunction},
2020
S::Type{<:MOI.AbstractSet})::Bool
2121
2222
Return a `Bool` indicating whether `b` tries to bridge `F`-in-`S` constraints
2323
instead of passing it as is to its internal model.
2424
"""
25-
function isbridged end
25+
function is_bridged end
2626
# Syntactic sugar
27-
function isbridged(b::AbstractBridgeOptimizer, ::Type{CI{F, S}}) where {F, S}
28-
return isbridged(b, F, S)
27+
function is_bridged(b::AbstractBridgeOptimizer, ::Type{CI{F, S}}) where {F, S}
28+
return is_bridged(b, F, S)
2929
end
3030
# We don't bridge variables.
31-
isbridged(b::AbstractBridgeOptimizer, ::Type{VI}) = false
31+
is_bridged(b::AbstractBridgeOptimizer, ::Type{VI}) = false
3232

3333
"""
34-
supportsbridgingconstraint(b::AbstractBridgeOptimizer,
34+
supports_bridging_constraint(b::AbstractBridgeOptimizer,
3535
F::Type{<:MOI.AbstractFunction},
3636
S::Type{<:MOI.AbstractSet})::Bool
3737
3838
Return a `Bool` indicating whether `b` supports bridging `F`-in-`S` constraints.
3939
"""
40-
function supportsbridgingconstraint(::AbstractBridgeOptimizer,
40+
function supports_bridging_constraint(::AbstractBridgeOptimizer,
4141
::Type{<:MOI.AbstractFunction},
4242
::Type{<:MOI.AbstractSet})
4343
return false
@@ -49,7 +49,7 @@ end
4949
S::Type{<:MOI.AbstractSet})
5050
5151
Return the `AbstractBridge` type to be used to bridge `F`-in-`S` constraints.
52-
This function should only be called if `isbridged(b, F, S)`.
52+
This function should only be called if `is_bridged(b, F, S)`.
5353
"""
5454
function bridge_type end
5555

@@ -94,15 +94,15 @@ end
9494
# References
9595
MOI.is_valid(b::AbstractBridgeOptimizer, vi::VI) = MOI.is_valid(b.model, vi)
9696
function MOI.is_valid(b::AbstractBridgeOptimizer, ci::CI)
97-
if isbridged(b, typeof(ci))
97+
if is_bridged(b, typeof(ci))
9898
return MOI.is_valid(b.bridged, ci)
9999
else
100100
return MOI.is_valid(b.model, ci)
101101
end
102102
end
103103
MOI.delete(b::AbstractBridgeOptimizer, vi::VI) = MOI.delete(b.model, vi)
104104
function MOI.delete(b::AbstractBridgeOptimizer, ci::CI)
105-
if isbridged(b, typeof(ci))
105+
if is_bridged(b, typeof(ci))
106106
if !MOI.is_valid(b, ci)
107107
throw(MOI.InvalidIndex(ci))
108108
end
@@ -117,7 +117,7 @@ end
117117
# Attributes
118118
function MOI.get(b::AbstractBridgeOptimizer,
119119
attr::MOI.ListOfConstraintIndices{F, S}) where {F, S}
120-
if isbridged(b, F, S)
120+
if is_bridged(b, F, S)
121121
list = MOI.get(b.bridged, attr)
122122
else
123123
list = MOI.get(b.model, attr)
@@ -145,7 +145,7 @@ function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.NumberOfVariables)
145145
end
146146
function MOI.get(b::AbstractBridgeOptimizer,
147147
attr::MOI.NumberOfConstraints{F, S}) where {F, S}
148-
if isbridged(b, F, S)
148+
if is_bridged(b, F, S)
149149
# The constraints contained in `b.bridged` may have been added by
150150
# bridges
151151
return _numberof(b, b.bridged, attr)
@@ -209,7 +209,7 @@ end
209209
function MOI.get(b::AbstractBridgeOptimizer,
210210
attr::MOI.AbstractConstraintAttribute,
211211
ci::CI)
212-
if isbridged(b, typeof(ci))
212+
if is_bridged(b, typeof(ci))
213213
if MOIU.is_result_attribute(attr)
214214
MOI.get(b, attr, bridge(b, ci))
215215
else
@@ -222,15 +222,15 @@ end
222222
## Setting names
223223
function MOI.supports(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName,
224224
Index::Type{<:CI})
225-
if isbridged(b, Index)
225+
if is_bridged(b, Index)
226226
return MOI.supports(b.bridged, attr, Index)
227227
else
228228
return MOI.supports(b.model, attr, Index)
229229
end
230230
end
231231
function MOI.set(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName,
232232
constraint_index::CI, name::String)
233-
if isbridged(b, typeof(constraint_index))
233+
if is_bridged(b, typeof(constraint_index))
234234
MOI.set(b.bridged, attr, constraint_index, name)
235235
else
236236
MOI.set(b.model, attr, constraint_index, name)
@@ -240,7 +240,7 @@ end
240240
function MOI.supports(b::AbstractBridgeOptimizer,
241241
attr::Union{MOI.ConstraintFunction, MOI.ConstraintSet},
242242
::Type{CI{F, S}}) where {F, S}
243-
if isbridged(b, CI{F, S})
243+
if is_bridged(b, CI{F, S})
244244
return MOI.supports(b.bridged, attr, CI{F, S}) &&
245245
MOI.supports(b, attr, concrete_bridge_type(b, F, S))
246246
else
@@ -249,7 +249,7 @@ function MOI.supports(b::AbstractBridgeOptimizer,
249249
end
250250
function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintSet,
251251
constraint_index::CI{F, S}, set::S) where {F, S}
252-
if isbridged(b, typeof(constraint_index))
252+
if is_bridged(b, typeof(constraint_index))
253253
MOI.set(b, MOI.ConstraintSet(), bridge(b, constraint_index), set)
254254
MOI.set(b.bridged, MOI.ConstraintSet(), constraint_index, set)
255255
else
@@ -258,7 +258,7 @@ function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintSet,
258258
end
259259
function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintFunction,
260260
constraint_index::CI{F, S}, func::F) where {F, S}
261-
if isbridged(b, typeof(constraint_index))
261+
if is_bridged(b, typeof(constraint_index))
262262
MOI.set(b, MOI.ConstraintFunction(), bridge(b, constraint_index), func)
263263
MOI.set(b.bridged, MOI.ConstraintFunction(), constraint_index, func)
264264
else
@@ -269,7 +269,7 @@ end
269269
# Name
270270
function MOI.get(b::AbstractBridgeOptimizer, IdxT::Type{<:MOI.Index},
271271
name::String)
272-
if isbridged(b, IdxT)
272+
if is_bridged(b, IdxT)
273273
return MOI.get(b.bridged, IdxT, name)
274274
else
275275
return MOI.get(b.model, IdxT, name)
@@ -292,16 +292,16 @@ end
292292
function MOI.supports_constraint(b::AbstractBridgeOptimizer,
293293
F::Type{<:MOI.AbstractFunction},
294294
S::Type{<:MOI.AbstractSet})
295-
if isbridged(b, F, S)
296-
return supportsbridgingconstraint(b, F, S) &&
295+
if is_bridged(b, F, S)
296+
return supports_bridging_constraint(b, F, S) &&
297297
MOI.supports_constraint(b.bridged, F, S)
298298
else
299299
return MOI.supports_constraint(b.model, F, S)
300300
end
301301
end
302302
function MOI.add_constraint(b::AbstractBridgeOptimizer, f::MOI.AbstractFunction,
303303
s::MOI.AbstractSet)
304-
if isbridged(b, typeof(f), typeof(s))
304+
if is_bridged(b, typeof(f), typeof(s))
305305
ci = MOI.add_constraint(b.bridged, f, s)
306306
@assert !haskey(b.bridges, ci)
307307
b.bridges[ci] = concrete_bridge_type(b, typeof(f), typeof(s))(b, f, s)
@@ -312,7 +312,7 @@ function MOI.add_constraint(b::AbstractBridgeOptimizer, f::MOI.AbstractFunction,
312312
end
313313
function MOI.modify(b::AbstractBridgeOptimizer, ci::CI,
314314
change::MOI.AbstractFunctionModification)
315-
if isbridged(b, typeof(ci))
315+
if is_bridged(b, typeof(ci))
316316
MOI.modify(b, bridge(b, ci), change)
317317
MOI.modify(b.bridged, ci, change)
318318
else

src/Bridges/detbridge.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function LogDetBridge{T}(model, f::MOI.VectorAffineFunction{T}, s::MOI.LogDetCon
8787
end
8888

8989
MOI.supports_constraint(::Type{LogDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.LogDetConeTriangle}) where T = true
90-
addedconstrainttypes(::Type{LogDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.LogDetConeTriangle}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle), (MOI.VectorAffineFunction{T}, MOI.ExponentialCone), (MOI.ScalarAffineFunction{T}, MOI.LessThan{T})]
90+
added_constraint_types(::Type{LogDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.LogDetConeTriangle}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle), (MOI.VectorAffineFunction{T}, MOI.ExponentialCone), (MOI.ScalarAffineFunction{T}, MOI.LessThan{T})]
9191

9292
"""
9393
sublog(model, x::MOI.VariableIndex, z::MOI.VariableIndex, ::Type{T}) where T
@@ -179,7 +179,7 @@ function RootDetBridge{T}(model, f::MOI.VectorAffineFunction{T}, s::MOI.RootDetC
179179
end
180180

181181
MOI.supports_constraint(::Type{RootDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RootDetConeTriangle}) where T = true
182-
addedconstrainttypes(::Type{RootDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RootDetConeTriangle}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle), (MOI.VectorAffineFunction{T}, MOI.GeometricMeanCone)]
182+
added_constraint_types(::Type{RootDetBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RootDetConeTriangle}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle), (MOI.VectorAffineFunction{T}, MOI.GeometricMeanCone)]
183183

184184
# Attributes, Bridge acting as an model
185185
MOI.get(b::RootDetBridge, ::MOI.NumberOfVariables) = length(b.Δ)

src/Bridges/geomeanbridge.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function MOI.supports_constraint(::Type{GeoMeanBridge{T}},
100100
::Type{MOI.GeometricMeanCone}) where T
101101
return true
102102
end
103-
function addedconstrainttypes(::Type{GeoMeanBridge{T, F, G}}) where {T, F, G}
103+
function added_constraint_types(::Type{GeoMeanBridge{T, F, G}}) where {T, F, G}
104104
return [(F, MOI.LessThan{T}), (G, MOI.RotatedSecondOrderCone)]
105105
end
106106
function concrete_bridge_type(::Type{<:GeoMeanBridge{T}},

src/Bridges/intervalbridge.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function SplitIntervalBridge{T, F}(model, f::F, s::MOI.Interval{T}) where {T, F}
1414
end
1515

1616
MOI.supports_constraint(::Type{SplitIntervalBridge{T}}, ::Type{<:MOI.AbstractScalarFunction}, ::Type{MOI.Interval{T}}) where T = true
17-
function addedconstrainttypes(::Type{SplitIntervalBridge{T, F}}) where {T, F}
17+
function added_constraint_types(::Type{SplitIntervalBridge{T, F}}) where {T, F}
1818
return [(F, MOI.GreaterThan{T}), (F, MOI.LessThan{T})]
1919
end
2020
function concrete_bridge_type(::Type{<:SplitIntervalBridge},

src/Bridges/lazybridgeoptimizer.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
LazyBridgeOptimizer{OT<:MOI.ModelLike, MT<:MOI.ModelLike} <: AbstractBridgeOptimizer
44
5-
The `LazyBridgeOptimizer` combines several bridges, which are added using the [`addbridge!`](@ref) function.
5+
The `LazyBridgeOptimizer` combines several bridges, which are added using the [`add_bridge`](@ref) function.
66
Whenever a constraint is added, it only attempts to bridge it if it is not supported by the internal model (hence its name `Lazy`).
77
When bridging a constraint, it selects the minimal number of bridges needed.
88
For instance, a constraint `F`-in-`S` can be bridged into a constraint `F1`-in-`S1` (supported by the internal model) using bridge 1 or
@@ -43,9 +43,9 @@ function update_dist!(b::LazyBridgeOptimizer, constraints)
4343
changed = false
4444
for BT in b.bridgetypes
4545
for (F, S) in constraints
46-
if MOI.supports_constraint(BT, F, S) && all(C -> MOI.supports_constraint(b, C[1], C[2]), addedconstrainttypes(BT, F, S))
46+
if MOI.supports_constraint(BT, F, S) && all(C -> MOI.supports_constraint(b, C[1], C[2]), added_constraint_types(BT, F, S))
4747
# Number of bridges needed using BT
48-
dist = 1 + sum(C -> _dist(b, C[1], C[2]), addedconstrainttypes(BT, F, S))
48+
dist = 1 + sum(C -> _dist(b, C[1], C[2]), added_constraint_types(BT, F, S))
4949
# Is it better that what can currently be done ?
5050
if dist < _dist(b, F, S)
5151
b.dist[(F, S)] = dist
@@ -69,7 +69,7 @@ function fill_required_constraints!(required::Set{Tuple{DataType, DataType}}, b:
6969
push!(required, (F, S))
7070
for BT in b.bridgetypes
7171
if MOI.supports_constraint(BT, F, S)
72-
for C in addedconstrainttypes(BT, F, S)
72+
for C in added_constraint_types(BT, F, S)
7373
fill_required_constraints!(required, b, C[1], C[2])
7474
end
7575
end
@@ -84,22 +84,22 @@ function update_constraint!(b::LazyBridgeOptimizer, F::Type{<:MOI.AbstractFuncti
8484
end
8585

8686
"""
87-
addbridge!(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
87+
add_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
8888
8989
Enable the use of the bridges of type `BT` by `b`.
9090
"""
91-
function addbridge!(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
91+
function add_bridge(b::LazyBridgeOptimizer, BT::Type{<:AbstractBridge})
9292
push!(b.bridgetypes, BT)
9393
# Some constraints (F, S) in keys(b.best) may now be bridged
9494
# with a less briges than `b.dist[(F, S)] using `BT`
9595
update_dist!(b, keys(b.best))
9696
end
9797

9898
# It only bridges when the constraint is not supporting, hence the name "Lazy"
99-
function isbridged(b::LazyBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
99+
function is_bridged(b::LazyBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
100100
!MOI.supports_constraint(b.model, F, S)
101101
end
102-
function supportsbridgingconstraint(b::LazyBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
102+
function supports_bridging_constraint(b::LazyBridgeOptimizer, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet})
103103
update_constraint!(b, F, S)
104104
(F, S) in keys(b.best)
105105
end

src/Bridges/rsocbridge.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function MOI.supports_constraint(::Type{RSOCBridge{T}},
4242
::Type{MOI.RotatedSecondOrderCone}) where T
4343
return true
4444
end
45-
function addedconstrainttypes(::Type{RSOCBridge{T, F}}) where {T, F}
45+
function added_constraint_types(::Type{RSOCBridge{T, F}}) where {T, F}
4646
return [(F, MOI.SecondOrderCone)]
4747
end
4848
function concrete_bridge_type(::Type{<:RSOCBridge{T}},

src/Bridges/singlebridgeoptimizer.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function SingleBridgeOptimizer{BT, MT}(model::OT) where {BT, MT, OT <: MOI.Model
1313
SingleBridgeOptimizer{BT, MT, OT}(model, MT(), Dict{CI, BT}())
1414
end
1515

16-
isbridged(b::SingleBridgeOptimizer, ::Type{<:MOI.AbstractFunction}, ::Type{<:MOI.AbstractSet}) = false
16+
is_bridged(b::SingleBridgeOptimizer, ::Type{<:MOI.AbstractFunction}, ::Type{<:MOI.AbstractSet}) = false
1717
bridge_type(b::SingleBridgeOptimizer{BT}, F::Type{<:MOI.AbstractFunction}, S::Type{<:MOI.AbstractSet}) where BT = BT
1818

1919
# :((Zeros, SecondOrderCone)) -> (:(MOI.Zeros), :(MOI.SecondOrderCone))
@@ -38,14 +38,14 @@ bridgedmodel = SplitInterval(model)
3838
will additionally support `ScalarAffineFunction`-in-`Interval`.
3939
"""
4040
macro bridge(modelname, bridge, ss, sst, vs, vst, sf, sft, vf, vft)
41-
bridgedmodelname = Symbol(string(modelname) * "Instance")
42-
bridgedfuns = :(Union{$(_tuple_prefix_moi(sf)...), $(_tuple_prefix_moi(sft)...), $(_tuple_prefix_moi(vf)...), $(_tuple_prefix_moi(vft)...)})
43-
bridgedsets = :(Union{$(_tuple_prefix_moi(ss)...), $(_tuple_prefix_moi(sst)...), $(_tuple_prefix_moi(vs)...), $(_tuple_prefix_moi(vst)...)})
41+
bridged_model_name = Symbol(string(modelname) * "Instance")
42+
bridged_funs = :(Union{$(_tuple_prefix_moi(sf)...), $(_tuple_prefix_moi(sft)...), $(_tuple_prefix_moi(vf)...), $(_tuple_prefix_moi(vft)...)})
43+
bridged_sets = :(Union{$(_tuple_prefix_moi(ss)...), $(_tuple_prefix_moi(sst)...), $(_tuple_prefix_moi(vs)...), $(_tuple_prefix_moi(vst)...)})
4444

4545
esc(quote
46-
$MOIU.@model $bridgedmodelname $ss $sst $vs $vst $sf $sft $vf $vft
47-
const $modelname{T, OT<:MOI.ModelLike} = $MOIB.SingleBridgeOptimizer{$bridge{T}, $bridgedmodelname{T}, OT}
48-
isbridged(::$modelname, ::Type{<:$bridgedfuns}, ::Type{<:$bridgedsets}) = true
49-
supportsbridgingconstraint(::$modelname, ::Type{<:$bridgedfuns}, ::Type{<:$bridgedsets}) = true
46+
$MOIU.@model $bridged_model_name $ss $sst $vs $vst $sf $sft $vf $vft
47+
const $modelname{T, OT<:MOI.ModelLike} = $MOIB.SingleBridgeOptimizer{$bridge{T}, $bridged_model_name{T}, OT}
48+
is_bridged(::$modelname, ::Type{<:$bridged_funs}, ::Type{<:$bridged_sets}) = true
49+
supports_bridging_constraint(::$modelname, ::Type{<:$bridged_funs}, ::Type{<:$bridged_sets}) = true
5050
end)
5151
end

src/Bridges/soctopsdbridge.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ _SOCtoPSDaff(f::MOI.VectorOfVariables, ::Type{T}) where T = _SOCtoPSDaff(MOI.Vec
6565
_SOCtoPSDaff(f::MOI.VectorAffineFunction, ::Type) = _SOCtoPSDaff(f, MOIU.eachscalar(f)[1])
6666

6767
MOI.supports_constraint(::Type{SOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.SecondOrderCone}) where T = true
68-
addedconstrainttypes(::Type{SOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.SecondOrderCone}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle)]
68+
added_constraint_types(::Type{SOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.SecondOrderCone}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle)]
6969

7070
function MOI.get(instance::MOI.AbstractOptimizer, a::MOI.ConstraintPrimal, c::SOCtoPSDBridge)
7171
MOI.get(instance, a, c.cr)[trimap.(1:c.dim, 1)]
@@ -115,7 +115,7 @@ struct RSOCtoPSDBridge{T} <: AbstractBridge
115115
end
116116

117117
MOI.supports_constraint(::Type{RSOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RotatedSecondOrderCone}) where T = true
118-
addedconstrainttypes(::Type{RSOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RotatedSecondOrderCone}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle)]
118+
added_constraint_types(::Type{RSOCtoPSDBridge{T}}, ::Type{<:Union{MOI.VectorOfVariables, MOI.VectorAffineFunction{T}}}, ::Type{MOI.RotatedSecondOrderCone}) where T = [(MOI.VectorAffineFunction{T}, MOI.PositiveSemidefiniteConeTriangle)]
119119

120120
function RSOCtoPSDBridge{T}(instance, f, s::MOI.RotatedSecondOrderCone) where T
121121
d = MOI.dimension(s)-1

0 commit comments

Comments
 (0)