Skip to content

Unique names don't require underscores#161

Closed
matbesancon wants to merge 7 commits into
jump-dev:masterfrom
matbesancon:uniquenames
Closed

Unique names don't require underscores#161
matbesancon wants to merge 7 commits into
jump-dev:masterfrom
matbesancon:uniquenames

Conversation

@matbesancon
Copy link
Copy Markdown
Contributor

All models end up marking each variable group with _$i, even though the variables themselves are often in containers.

This typically ends up with a double indexing scheme in JuMP:

: π[6]_1 ≥ -8006.0
 : π[5]_1 ≥ -8005.0

This PR adapts it to avoid the _i if the variable name is unique

@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.76%. Comparing base (14edeae) to head (a00761a).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
+ Coverage   94.73%   94.76%   +0.02%     
==========================================
  Files          13       13              
  Lines         703      707       +4     
==========================================
+ Hits          666      670       +4     
  Misses         37       37              

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread src/dual_model_variables.jl Outdated
func = get_function(primal_model, ci)
set = get_set(primal_model, ci)
for (i, vi) in enumerate(vis)
unique_var = length(vis) == 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be moved one line above outside the for loop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread src/dual_model_variables.jl Outdated
i::Int,
ci_name::String,
prefix::String,
unique_var::Bool = false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need a default value if we set this value everywhere we use this function. Otherwise that just adds a chance to forget to set this and have a silent bug

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

was to avoid breaking things but fine with no default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine, we can always tag v0.6, we haven't hit v1 yet

Comment thread src/dual_model_variables.jl Outdated
i::Int,
ci_name::String,
prefix::String,
unique_var::Bool,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about ; ensure_unique::Bool = true,.

If this is a public method, then we don't need to break things. Appending a false isn't very informative for the caller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sounds good. It's not super important since this is internal anyway

@joaquimg
Copy link
Copy Markdown
Member

replaced by #184

@joaquimg joaquimg closed this Apr 29, 2025
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.

4 participants