Skip to content

Commit 9bb6619

Browse files
committed
Add set for low-rank constrained SDP
1 parent f88f78b commit 9bb6619

File tree

6 files changed

+90
-1
lines changed

6 files changed

+90
-1
lines changed

docs/src/background/duality.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ and similarly, the dual is:
113113

114114
The scalar product is different from the canonical one for the sets
115115
[`PositiveSemidefiniteConeTriangle`](@ref), [`LogDetConeTriangle`](@ref),
116-
[`RootDetConeTriangle`](@ref).
116+
[`RootDetConeTriangle`](@ref),
117+
[`FrobeniusProductPostiviveSemidefiniteConeTriangle`](@ref) and
118+
[`LinearMatrixInequalityConeTriangle`](@ref).
117119

118120
If the set ``C_i`` of the section [Duality](@ref) is one of these three cones,
119121
then the rows of the matrix ``A_i`` corresponding to off-diagonal entries are

docs/src/manual/standard_form.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ The matrix-valued set types implemented in MathOptInterface.jl are:
100100
| [`HermitianPositiveSemidefiniteConeTriangle(d)`](@ref MathOptInterface.HermitianPositiveSemidefiniteConeTriangle) | The cone of Hermitian positive semidefinite matrices, with
101101
`side_dimension` rows and columns. |
102102
| [`Scaled(S)`](@ref MathOptInterface.Scaled) | The set `S` scaled so that [`Utilities.set_dot`](@ref MathOptInterface.Utilities.set_dot) corresponds to `LinearAlgebra.dot` |
103+
| [`FrobeniusProductPostiviveSemidefiniteConeTriangle(d, A)`](@ref MathOptInterface.FrobeniusProductPostiviveSemidefiniteConeTriangle) | The cone of positive semidefinite matrices, with `side_dimension` rows and columns and their Frobenius inner product with the matrices in `A`. |
104+
| [`LinearMatrixInequalityConeTriangle(d, A)`](@ref MathOptInterface.LinearMatrixInequalityConeTriangle) | The cone of vector `y` and symmetric `C`, with `side_dimension` rows and columns such that ``\sum_i y_i A_i + C`` is positive semidefinite. |
103105

104106
Some of these cones can take two forms: `XXXConeTriangle` and `XXXConeSquare`.
105107

docs/src/reference/standard_form.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,6 @@ LogDetConeTriangle
153153
LogDetConeSquare
154154
RootDetConeTriangle
155155
RootDetConeSquare
156+
FrobeniusProductPostiviveSemidefiniteConeTriangle
157+
LinearMatrixInequalityConeTriangle
156158
```

src/Utilities/model.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ const LessThanIndicatorZero{T} =
806806
MOI.Scaled{MOI.PositiveSemidefiniteConeTriangle},
807807
MOI.RootDetConeTriangle,
808808
MOI.RootDetConeSquare,
809+
MOI.FrobeniusProductPostiviveSemidefiniteConeTriangle,
810+
MOI.LinearMatrixInequalityConeTriangle,
809811
MOI.LogDetConeTriangle,
810812
MOI.LogDetConeSquare,
811813
MOI.AllDifferent,

src/Utilities/results.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,29 @@ function get_fallback(
498498
f = MOI.get(model, MOI.ConstraintFunction(), ci)
499499
return _variable_dual(T, model, attr, ci, f)
500500
end
501+
502+
function set_dot(
503+
x::AbstractVector,
504+
y::AbstractVector,
505+
set::Union{
506+
MOI.FrobeniusProductPostiviveSemidefiniteConeTriangle,
507+
MOI.LinearMatrixInequalityConeTriangle,
508+
},
509+
)
510+
m = length(set.matrices)
511+
return LinearAlgebra.dot(view(x, 1:m), view(y, 1:m)) +
512+
triangle_dot(x, y, set.side_dimension, m)
513+
end
514+
515+
516+
function set_dot(
517+
a::AbstractVector,
518+
set::Union{
519+
MOI.FrobeniusProductPostiviveSemidefiniteConeTriangle,
520+
MOI.LinearMatrixInequalityConeTriangle,
521+
},
522+
)
523+
b = copy(a)
524+
triangle_coefficients!(b, set.side_dimension, length(set.matrices))
525+
return b
526+
end

src/sets.jl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,61 @@ function Base.getproperty(
18031803
end
18041804
end
18051805

1806+
"""
1807+
FrobeniusProductPostiviveSemidefiniteConeTriangle{M}(side_dimension::Int, matrices::Vector{M})
1808+
1809+
Given `m` symmetric matrices `A_1`, ..., `A_m` given in `matrices`, the frobenius inner
1810+
product of positive semidefinite matrices is the convex cone:
1811+
``\\{ ((\\langle A_1, X \\rangle, ..., \\langle A_m, X \\rangle, X) \\in \\mathbb{R}^{m + d(d+1)/2} : X \\text{ postive semidefinite} \\}``,
1812+
where the matrix `X` is represented in the same symmetric packed format as in
1813+
the [`PositiveSemidefiniteConeTriangle`](@ref).
1814+
"""
1815+
struct FrobeniusProductPostiviveSemidefiniteConeTriangle{M} <: AbstractVectorSet
1816+
side_dimension::Int
1817+
matrices::Vector{M}
1818+
end
1819+
1820+
function dimension(s::FrobeniusProductPostiviveSemidefiniteConeTriangle)
1821+
return length(s.matrices) + s.side_dimension^2
1822+
end
1823+
1824+
function dual_set(s::FrobeniusProductPostiviveSemidefiniteConeTriangle)
1825+
return LinearMatrixInequalityConeTriangle(s.side_dimension, s.matrices)
1826+
end
1827+
1828+
function dual_set_type(
1829+
::Type{FrobeniusProductPostiviveSemidefiniteConeTriangle{M}},
1830+
) where {M}
1831+
return LinearMatrixInequalityConeTriangle
1832+
end
1833+
1834+
"""
1835+
LinearMatrixInequalityConeTriangle{M}(side_dimension::Int, matrices::Vector{M})
1836+
1837+
Given `m` symmetric matrices `A_1`, ..., `A_m` given in `matrices`, the linear
1838+
matrix inequality cone is the convex cone:
1839+
``\\{ ((y, C) \\in \\mathbb{R}^{m + d(d+1)/2} : \\sum_{i=1}^m y_i A_i + C \\text{ postive semidefinite} \\}``,
1840+
where the matrix `C` is represented in the same symmetric packed format as in
1841+
the [`PositiveSemidefiniteConeTriangle`](@ref).
1842+
"""
1843+
struct LinearMatrixInequalityConeTriangle{M} <: AbstractVectorSet
1844+
side_dimension::Int
1845+
matrices::Vector{M}
1846+
end
1847+
1848+
dimension(s::LinearMatrixInequalityConeTriangle) = length(s.matrices) + s.side_dimension^2
1849+
1850+
function dual_set(s::LinearMatrixInequalityConeTriangle)
1851+
return FrobeniusProductPostiviveSemidefiniteConeTriangle(
1852+
s.side_dimension,
1853+
s.matrices,
1854+
)
1855+
end
1856+
1857+
function dual_set_type(::Type{LinearMatrixInequalityConeTriangle{M}}) where {M}
1858+
return FrobeniusProductPostiviveSemidefiniteConeTriangle
1859+
end
1860+
18061861
"""
18071862
SOS1{T<:Real}(weights::Vector{T})
18081863

0 commit comments

Comments
 (0)