Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve printing of symmetric matrices when used in constraints #3768

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

odow
Copy link
Member

@odow odow commented Jun 4, 2024

Closes #3764

So there is an argument for this, especially if we merge #3766, because it will help distinguish when JuMP exploits symmetry.

src/print.jl Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.38%. Comparing base (886a652) to head (ebb8b4d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3768   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files          44       44           
  Lines        5879     5885    +6     
=======================================
+ Hits         5784     5790    +6     
  Misses         95       95           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow
Copy link
Member Author

odow commented Jun 4, 2024

What about some other options:

julia> c = @constraint(model, x == 0)
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
 ↙       x[2,2]  x[2,3]  x[2,4]
 ↙       ↙       x[3,3]  x[3,4]
 ↙       ↙       ↙       x[4,4]]  Zeros()

julia> c = @constraint(model, x == 0)
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
        x[2,2]  x[2,3]  x[2,4]
               x[3,3]  x[3,4]
                      x[4,4]]  Zeros()

julia> c
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
        x[2,2]  x[2,3]  x[2,4]
               x[3,3]  x[3,4]
                      x[4,4]]  Zeros()

julia> c
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
 ⤯       x[2,2]  x[2,3]  x[2,4]
 ⤯       ⤯       x[3,3]  x[3,4]
 ⤯       ⤯       ⤯       x[4,4]]  Zeros()

julia> c
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
        x[2,2]  x[2,3]  x[2,4]
               x[3,3]  x[3,4]
                      x[4,4]]  Zeros()

julia> c
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
 ⇗       x[2,2]  x[2,3]  x[2,4]
 ⇗       ⇗       x[3,3]  x[3,4]
 ⇗       ⇗       ⇗       x[4,4]]  Zeros()

julia> c
[x[1,1]  x[1,2]  x[1,3]  x[1,4]
        x[2,2]  x[2,3]  x[2,4]
               x[3,3]  x[3,4]
                      x[4,4]]  Zeros()

src/print.jl Outdated Show resolved Hide resolved
@odow
Copy link
Member Author

odow commented Jun 5, 2024

Use of \cdot was added in #1857 without discussion. I think we can use (\cdots) for now.

It hints at "something else is here" and avoids confusion with and 0.0.

@odow
Copy link
Member Author

odow commented Jun 5, 2024

Merging because I think this is a win, and it is needed for #3766

@odow odow merged commit b369f5b into master Jun 5, 2024
11 checks passed
@odow odow deleted the od/print-symmetric branch June 5, 2024 20:53
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.

function_string of Symmetric matrix includes the entire matrix
1 participant