[Bridges] fix support for nested final_touch bridges#3027
Open
odow wants to merge 2 commits into
Open
Conversation
blegat
reviewed
Jul 26, 2026
| # vector, and then we insert the bridge into the vector. This is an O(N) | ||
| # operation in the number of new bridges, but it's a pretty rare edge-case, | ||
| # and the number of new bridges should be small. (And in most common bridges | ||
| # that need final touch, like the ToMILP bridges, N=0.) |
Member
There was a problem hiding this comment.
Since it's a Vector{Any, can't we just do push!(map.needs_final_touch, nothing) here and then replace it ?
Member
Author
There was a problem hiding this comment.
Because we might not need to
blegat
reviewed
Jul 26, 2026
| n_final_touch = length(map.needs_final_touch) | ||
| bridge = Constraint.bridge_constraint(BridgeType, recursive_model(b), f, s) | ||
| if MOI.Bridges.needs_final_touch(bridge) | ||
| insert!(map.needs_final_touch, n_final_touch + 1, bridge) |
Member
There was a problem hiding this comment.
I prefer doing these things in Constraint/map.jl, bridge_optimizer.jl
Member
Author
There was a problem hiding this comment.
Feel free to make a PR with some changes. This seemed simplest place to put it for me but I might be missing something.
blegat
reviewed
Jul 26, 2026
| # vector, and then we insert the bridge into the vector. This is an O(N) | ||
| # operation in the number of new bridges, but it's a pretty rare edge-case, | ||
| # and the number of new bridges should be small. (And in most common bridges | ||
| # that need final touch, like the ToMILP bridges, N=0.) |
Member
Author
There was a problem hiding this comment.
They don’t add any bridges that themselves need final touch
Clarify comments regarding bridge insertion and final touch requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that I understand the fix in #3025, this is a hopefully simpler fix.
Closes #1980!
Closes #3025