jump-dev / JuMP.jl

Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)
http://jump.dev/JuMP.jl/
Other
2.17k stars 390 forks source link

Improve printing of symmetric matrices when used in constraints #3768

Closed odow closed 3 weeks ago

odow commented 3 weeks ago

Closes #3764

So there is an argument for this, especially if we merge https://github.com/jump-dev/JuMP.jl/pull/3766, because it will help distinguish when JuMP exploits symmetry.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

odow commented 3 weeks ago

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()
odow commented 3 weeks ago

Use of \cdot was added in https://github.com/jump-dev/JuMP.jl/pull/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 commented 3 weeks ago

Merging because I think this is a win, and it is needed for https://github.com/jump-dev/JuMP.jl/pull/3766