Improve printing of SDP constraints #1857
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently all SDP constraints are displayed in their vectorized form
[...] in MOI.PositiveSemidefiniteCone...
even if in theshape
of the constraint, we have the information of whether it was constructed in this vectorized form or in matrix form.In this PR, the function and set of a constraint are reshaped before being passed to
function_string
andin_set_string
(hence the need to renamereshape_result
intoreshape_vector
since the function is not a result and the need to createreshape_set
).For PSD constraint, in case the constraint was created in matrix form, the vector is reshaped to a matrix and the set is replaced by
PSDCone()
.Finally, the PR implements the printing of matrices similarly to how it was done in JuMP v0.18 (except I couldn't find how it was done for the IJuliaMode). The
constraints_string
function had to be tweaked to work with multiline constraint string.