Skip to content

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 blegat and joaquimg 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

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.

@odow
Copy link
Member Author

odow commented Aug 25, 2025

I think that in general, bridge could optionally implement names, just the same way they can optionally implement any attribute.

This seems reasonable.

@odow odow closed this Aug 25, 2025
@odow odow deleted the od/fix-2762 branch August 25, 2025 03:38
@blegat
Copy link
Member

blegat commented Aug 25, 2025

Sorry if I wasn't clear, I meant that since it only makes sense to implement it for a bridge that maps a function identically, this PR is the way to go

@odow
Copy link
Member Author

odow commented Aug 25, 2025

I went for the explicit support option in #2822

@odow
Copy link
Member Author

odow commented Aug 26, 2025

Closing in favor of #2822

@odow odow closed this Aug 26, 2025
@odow odow deleted the od/fix-2762 branch September 21, 2025 21:39
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