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

Direct input of PSD constraints #3153

Closed
cgois opened this issue Jun 27, 2022 · 1 comment · Fixed by #3154
Closed

Direct input of PSD constraints #3153

cgois opened this issue Jun 27, 2022 · 1 comment · Fixed by #3154

Comments

@cgois
Copy link

cgois commented Jun 27, 2022

Although a variable can be declared to belong in the PSD cone (e.g., foo = @variable(problem, [1:dim, 1:dim] in COI.HermitianPSDCone())), I have not yet found a way to directly input PSD constraints.

For example, I frequently would like to impose things of the sort @constraint(problem, operation(foo) in COI.HermitianPSDCone()), where operation is any transformation on the variable.

My current workaround is to introduce a new variable in the PSD cone and enforce equality constraints, for instance:

"""
Enforce PSD constraint on the input matrix.
Uses dummy vars. to enforce PSD (not possible directly in ComplexOptInterface?).
"""
function ispsd(problem::Model, A::AbstractMatrix)
    @assert size(A,1) == size(A,2) "Matrix must be square."
    @assert length(size(A)) == 2 "Matrix must be bidimensional."

    dim = size(A, 1)
    PSD = @variable(problem, [1:dim, 1:dim] in ComplexOptInterface.HermitianPSDCone())
    @constraint(problem, A .== PSD)
end

then call ispsd(problem, operation(foo)).

Is there a more economic way to do this? Or maybe does ComplexOptInterface already support PSD constraints directly?

@blegat
Copy link
Member

blegat commented Jul 8, 2022

This is not possible yet but I'm going to add this feature when we merge this package into JuMP as part of https://jump.dev/announcements/2022/04/19/small-development-grant/

@blegat blegat transferred this issue from jump-dev/ComplexOptInterface.jl Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants