Skip to content

Implement names for constrained variables - #237

Open
joaquimg wants to merge 1 commit into
jg/dualname-mapping-masterfrom
jg/names-constrained-variables
Open

Implement names for constrained variables#237
joaquimg wants to merge 1 commit into
jg/dualname-mapping-masterfrom
jg/names-constrained-variables

Conversation

@joaquimg

@joaquimg joaquimg commented Sep 9, 2026

Copy link
Copy Markdown
Member

Closes #193. Follow-up to #236.

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

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.40%. Comparing base (423ed97) to head (c6c1aa7).

Files with missing lines Patch % Lines
src/dual_names.jl 95.65% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaquimg
joaquimg added this pull request to stack #238 September 9, 2026 22:36
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.

1 participant