Skip to content

Add the PSD cone #194

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

Merged
merged 1 commit into from
Jun 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/apireference.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ NonPositive
Zero
Interval
SecondOrderCone
PositiveSemidefiniteConeTriangle
PositiveSemidefiniteConeScaled
Integers
Binaries
SOS1
Expand Down
51 changes: 50 additions & 1 deletion src/SolverInterface/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,56 @@ struct SecondOrderCone <: AbstractSet
end

#ExponentialCone
#PositiveSemidefiniteCone

"""
PositiveSemidefiniteConeTriangle(n)

The cone of symmetric ``n \\times n`` matrices that are positive semidefinite.
The dimension of the cone is ``n(n+1)/2`` since the matrices are symmetric.
The entries of the upper triangular part of the matrix are given row by row (or equivalently, the entries of the lower triangular part are given column by column).
The scalar product is the sum of the pairwise product of the diagonal entries plus twice the sum of the pairwise product of the upper diagonal entries.

### Examples

The matrix
```math
\\begin{bmatrix}
1 & 2 & 3\\\\
2 & 4 & 5\\\\
3 & 5 & 6
\\end{bmatrix}
```
corresponds to ``(1, 2, 3, 4, 5, 6)`` for `PositiveSemidefiniteConeTriangle`
"""
struct PositiveSemidefiniteConeTriangle <: AbstractSet
dim::Int
end

"""
PositiveSemidefiniteConeScaled(n)

The cone of symmetric ``n \\times n`` matrices that are positive semidefinite.
The dimension of the cone is ``n(n+1)/2`` since the matrices are symmetric.
The entries of the upper triangular part of the matrix are given row by row (or equivalently, the entries of the lower triangular part are given column by column).
The off-diagonal entries of the matrices of both the cone and its dual are scaled by ``\\sqrt{2}`` and the scalar product is simply the sum of the pairwise product of the entries.

### Examples

The matrix
```math
\\begin{bmatrix}
1 & 2 & 3\\\\
2 & 4 & 5\\\\
3 & 5 & 6
\\end{bmatrix}
```
and to ``(1, 2\\sqrt{2}, 3\\sqrt{2}, 4, 5\\sqrt{2}, 6)`` for `PositiveSemidefiniteConeScaled`.
"""
struct PositiveSemidefiniteConeScaled <: AbstractSet
dim::Int
end

dimension(s::Union{PositiveSemidefiniteConeScaled, PositiveSemidefiniteConeTriangle}) = (s.dim * (s.dim + 1)) / 2

"""
Integers(n)
Expand Down