Skip to content

[Bridges] pass variable names through ParameterToEqualToBridge #2821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

odow
Copy link
Member

@odow odow commented Aug 19, 2025

Closes #2762

But I'm not 100% sure we should merge this. It's really just a single special case. It isn't obvious what naming convention we should use if the map is y := Ax + b.

@odow
Copy link
Member Author

odow commented Aug 19, 2025

This is actually not as easy as I thought.

@odow odow requested review from joaquimg and blegat August 20, 2025 23:02
@odow
Copy link
Member Author

odow commented Aug 21, 2025

I'm not convinced we should merge this, but if we close this, we should also close #2762

Copy link
Member

@joaquimg joaquimg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the behavior. This is extremely useful for debugging models with parameters.

@odow
Copy link
Member Author

odow commented Aug 22, 2025

I'll let @blegat decide what we should do

@@ -1839,6 +1866,9 @@ function MOI.get(
end
vi_bridged = get(b.name_to_var, name, nothing)
MOI.Utilities.throw_if_multiple_with_name(vi_bridged, name)
if _get_variable_if_equivalent(b, vi_bridged) !== nothing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment explaining

@blegat
Copy link
Member

blegat commented Aug 23, 2025

I think that in general, bridge could optionally implement names, just the same way they can optionally implement any attribute.
The bridge optimizer could check if they support constraint names (for constraint bridges) or variable names (for variable bridges) and if so, it will set it.
For SetMapBridge, we know variable bridges create a unique variable in the scalar case so it's clear we can pass the name of that variable. But actually, when there is a nontrivial mapping, we like to give it a different name so we actually don't really want to pass the name along.
So I think that we should only pass the name along if it's mapped identically so this PR seems to do exactly what we should do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Printing models with parameters
3 participants