diff --git a/src/Bridges/bridgeoptimizer.jl b/src/Bridges/bridgeoptimizer.jl index ca7b9290b0..1444dc71c7 100644 --- a/src/Bridges/bridgeoptimizer.jl +++ b/src/Bridges/bridgeoptimizer.jl @@ -227,18 +227,42 @@ function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.AbstractConstraintAttribute, ci::CI) if is_bridged(b, typeof(ci)) - if MOI.is_set_by_optimize(attr) - MOI.get(b, attr, bridge(b, ci)) - else - MOI.get(b.bridged, attr, ci) - end + return MOI.get(b, attr, bridge(b, ci)) + else + return MOI.get(b.model, attr, ci) + end +end +function MOI.supports(b::AbstractBridgeOptimizer, + attr::MOI.AbstractConstraintAttribute, + IndexType::Type{CI{F, S}}) where {F,S} + if is_bridged(b, IndexType) + return MOI.supports(b, attr, concrete_bridge_type(b, F, S)) + else + return MOI.supports(b.model, attr, IndexType) + end +end + +function MOI.set(b::AbstractBridgeOptimizer, + attr::MOI.AbstractConstraintAttribute, + index::CI, value) + if is_bridged(b, typeof(index)) + return MOI.set(b, attr, bridge(b, index), value) + else + return MOI.set(b.model, attr, index, value) + end +end +## Getting and Setting names +function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName, + constraint_index::CI) + if is_bridged(b, typeof(constraint_index)) + return MOI.get(b.bridged, attr, constraint_index) else - MOI.get(b.model, attr, ci) + return MOI.get(b.model, attr, constraint_index) end end -## Setting names + function MOI.supports(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName, - Index::Type{<:CI}) + Index::Type{CI{F,S}}) where {F,S} if is_bridged(b, Index) return MOI.supports(b.bridged, attr, Index) else @@ -253,6 +277,22 @@ function MOI.set(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName, MOI.set(b.model, attr, constraint_index, name) end end +## Getting functions and sets +function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintSet, ci::CI) + if is_bridged(b, typeof(ci)) + return MOI.get(b.bridged, attr, ci) + else + return MOI.get(b.model, attr, ci) + end +end +function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintFunction, + ci::CI) + if is_bridged(b, typeof(ci)) + return MOI.get(b.bridged, attr, ci) + else + return MOI.get(b.model, attr, ci) + end +end ## Setting functions and sets function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintSet, constraint_index::CI{F, S}, set::S) where {F, S}