Skip to content

Commit 1492c02

Browse files
committed
Allow SetMapBridge to use bridge value
1 parent 902064f commit 1492c02

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/Bridges/Constraint/set_map.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function MOI.get(
102102
bridge::MultiSetMapBridge{T,S1,G},
103103
) where {T,S1,G}
104104
mapped_func = MOI.get(model, attr, bridge.constraint)
105-
func = MOI.Bridges.inverse_map_function(typeof(bridge), mapped_func)
105+
func = MOI.Bridges.inverse_map_function(bridge, mapped_func)
106106
return MOI.Utilities.convert_approx(G, func)
107107
end
108108

@@ -146,7 +146,7 @@ function MOI.get(
146146
if value === nothing
147147
return nothing
148148
end
149-
return MOI.Bridges.inverse_map_function(typeof(bridge), value)
149+
return MOI.Bridges.inverse_map_function(bridge, value)
150150
end
151151

152152
function MOI.set(
@@ -173,7 +173,7 @@ function MOI.get(
173173
if value === nothing
174174
return nothing
175175
end
176-
return MOI.Bridges.adjoint_map_function(typeof(bridge), value)
176+
return MOI.Bridges.adjoint_map_function(bridge, value)
177177
end
178178

179179
function MOI.set(
@@ -185,7 +185,7 @@ function MOI.set(
185185
if value === nothing
186186
MOI.set(model, attr, bridge.constraint, nothing)
187187
else
188-
mapped_value = MOI.Bridges.inverse_adjoint_map_function(BT, value)
188+
mapped_value = MOI.Bridges.inverse_adjoint_map_function(bridge, value)
189189
MOI.set(model, attr, bridge.constraint, mapped_value)
190190
end
191191
return

src/Bridges/set_map.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ the [`MOI.ConstraintPrimal`](@ref) and the
6161
"""
6262
function inverse_map_function end
6363

64+
function inverse_map_function(bridge::AbstractBridge, func)
65+
return inverse_map_function(typeof(bridge), func)
66+
end
67+
6468
"""
6569
adjoint_map_function(::Type{BT}, func) where {BT}
6670
@@ -71,6 +75,10 @@ used for getting the [`MOI.ConstraintDual`](@ref) and
7175
"""
7276
function adjoint_map_function end
7377

78+
function adjoint_map_function(bridge::AbstractBridge, func)
79+
return adjoint_map_function(typeof(bridge), func)
80+
end
81+
7482
"""
7583
inverse_adjoint_map_function(::Type{BT}, func) where {BT}
7684
@@ -81,3 +89,7 @@ Return the image of `func` through the inverse of the adjoint of the linear map
8189
[`MOI.ConstraintDualStart`](@ref) of constraint bridges.
8290
"""
8391
function inverse_adjoint_map_function end
92+
93+
function inverse_adjoint_map_function(bridge::AbstractBridge, func)
94+
return inverse_adjoint_map_function(typeof(bridge), func)
95+
end

0 commit comments

Comments
 (0)