Implement names for constrained variables - #237
Open
joaquimg wants to merge 1 commit into
Open
Conversation
Closes #193. Naming a dual model built from a vector of constrained variables used to emit "dual names for constrained vector of variables not supported yet" and leave the dual constraint unnamed. The dual object is a single constraint while the primal side is a vector of variables, so one name has to be derived from several. Note that `@variable(model, x[1:3] in SecondOrderCone())` names the variables `x[1]`, `x[2]` and `x[3]` and leaves the name of the constraint empty, so the name of the primal constraint is not an option here. The name of the container is used when every variable is an entry of the same one, which covers the common case: @variable(model, x[1:3] in SecondOrderCone()) dualize(model; dual_names = DualNames(; constraint_prefix = "dc_")) # the dual constraint is named `dc_x` Otherwise the name of the first variable is used, and a vector of unnamed variables leaves the dual constraint unnamed instead of naming it with the sole prefix.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## jg/dualname-mapping-master #237 +/- ##
==============================================================
+ Coverage 95.38% 95.40% +0.02%
==============================================================
Files 17 17
Lines 888 914 +26
==============================================================
+ Hits 847 872 +25
- Misses 41 42 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
joaquimg
added this pull request to stack #238
September 9, 2026 22:36
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.
Closes #193. Follow-up to #236.