Skip to content

Maintain order of expression generators when calling flatten!#4196

Open
odow wants to merge 4 commits into
masterfrom
od/flatten-order
Open

Maintain order of expression generators when calling flatten!#4196
odow wants to merge 4 commits into
masterfrom
od/flatten-order

Conversation

@odow

@odow odow commented Jul 9, 2026

Copy link
Copy Markdown
Member

Erwin points out in https://yetanothermathprogrammingconsultant.blogspot.com/2026/03/experience-with-nlp-solvers-on-simple.html that we don't maintain the order. (This is more cosmetic than changing actual model behaviour, but it's a nice quality of life improvement for users looking at the expressions.)

The prior result here was 1, 3, 2 instead of 1, 2, 3.

julia> using JuMP

julia> model = Model();

julia> @variable(model, x[1:3]);

julia> f = sum(log(x[i]) for i in 1:3) |> flatten!
log(x[1]) + log(x[3]) + log(x[2])

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.93%. Comparing base (b0fc1a7) to head (19a1ac9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4196   +/-   ##
=======================================
  Coverage   99.93%   99.93%           
=======================================
  Files          42       42           
  Lines        6278     6281    +3     
=======================================
+ Hits         6274     6277    +3     
  Misses          4        4           

☔ 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.

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