Skip to content

Commit

Permalink
Add FirstBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat authored and odow committed Nov 6, 2023
1 parent ccba3eb commit 3f5db1b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Bridges/bridge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,26 @@ julia> MOI.Bridges.bridging_cost(
```
"""
bridging_cost(::Type{<:AbstractBridge}) = 1.0

"""
struct FirstBridge <: MOI.AbstractConstraintAttribute end
Returns the first bridge used to bridge the constraint.
!!! warning
The indices of the bridge correspond to internal indices and may not
correspond to indices of the model this attribute is got from.
"""
struct FirstBridge <: MOI.AbstractConstraintAttribute end

MOI.is_set_by_optimize(::FirstBridge) = true

MOI.get(::MOI.ModelLike, ::FirstBridge, b::MOI.Bridges.AbstractBridge) = b

function MOI.Utilities.map_indices(
::Function,
::FirstBridge,
b::MOI.Bridges.AbstractBridge,
)
return b
end

0 comments on commit 3f5db1b

Please sign in to comment.