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

Softly deprecate PSD by removing it from the docs #3959

Closed
wants to merge 2 commits into from
Closed

Conversation

odow
Copy link
Member

@odow odow commented Mar 11, 2025

x-ref #3955 (comment)

Thoughts?

@@ -158,7 +158,7 @@ function example_k_means_clustering()
end
model = Model(Clarabel.Optimizer)
set_silent(model)
@variable(model, Z[1:m, 1:m] >= 0, PSD)
@variable(model, Z[1:m, 1:m] >= 0, set = PSDCone())
Copy link
Member Author

Choose a reason for hiding this comment

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

This one is a reason not to stop using PSD. It's clunky, and I can see people getting tripped up over it.

Copy link
Member

Choose a reason for hiding this comment

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

I like it with the "set", the PSD one does not look better to me

Copy link
Member

Choose a reason for hiding this comment

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

Would you think its clearer if we replace ">=0" by "lower_bound=0".
I would not mind.

Copy link
Member Author

Choose a reason for hiding this comment

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

No I want to keep this as it was... We have nice syntax. There's no need to use lower_bound=0 like we're a Python library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Was the main reason to stop using PSD because VariableInSet is confusing?

Copy link
Member

Choose a reason for hiding this comment

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

I dont agree that
x >= 0, PSD
Is better than
x >= 0, set = ...

We should decide if its legacy or not.
For me it felt like it was.
For @blegat the same.

We can keep it, but if we do, we should have PSDRef.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can keep it, but if we do, we should have PSDRef.

We have VariableInSetRef though?

What about #3960

Copy link
Member

Choose a reason for hiding this comment

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

I agree that x >= 0, set = PSDCone() is nice and I'm not missing x >= 0, PSD.
With , PSD, you're saving a few keystrokes but then it's unclear how to adapt it to hermitian, SOC, etc...
At least, with set = PSDCone() the user learns something that is transferrable

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm missing x >= 0, PSD). I vote we leave as-is and wait for more people to ask how to get the dual of a variable constraint.

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (02fabbf) to head (84136a8).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3959   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           43        43           
  Lines         6054      6085   +31     
=========================================
+ Hits          6054      6085   +31     

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

@odow
Copy link
Member Author

odow commented Mar 11, 2025

I'm not convinced that this is a good idea.

@joaquimg
Copy link
Member

I would not mind adding a note to the variable macro docstring asking to use "set =..."

@mlubin
Copy link
Member

mlubin commented Mar 13, 2025

It's kinda weird to be completely removing syntax from the docs. What if someone is trying to read existing code?

@odow
Copy link
Member Author

odow commented Mar 13, 2025

What if someone is trying to read existing code?

I think this is especially true because it is magic syntax in the macro. You can't look it up as ? PSD or something like that.

@odow
Copy link
Member Author

odow commented Mar 13, 2025

Closing because I don't particularly want to do this. Let's see how VariableInSetRef beds in for a while.

@odow odow closed this Mar 13, 2025
@odow odow deleted the od/PSD branch March 13, 2025 04:37
@joaquimg
Copy link
Member

My suggestion was to remove PSD everywhere, except from the @variable docstring. So it is findable.
Moreover, in that docstring it would say that the syntax is not recommended and users should use "set = ..."

@blegat
Copy link
Member

blegat commented Mar 13, 2025

We could at least use in PSDCone() most of the time in the docs as it's the preferred way.

@@ -1082,13 +1082,13 @@ julia> model[:x]

## Semidefinite variables

Declare a square matrix of JuMP variables to be positive semidefinite by passing
Copy link
Member

Choose a reason for hiding this comment

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

We could just say here that there are the two possibilities at least, we should reopen and merge part of the changes of this PR.

@odow
Copy link
Member Author

odow commented Mar 13, 2025

most of the time in the docs as it's the preferred way

Is it though?

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