Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 66fcd61

Browse files
committedJul 10, 2024·
Add set for low-rank constrained SDP
1 parent 2ae5939 commit 66fcd61

File tree

6 files changed

+90
-1
lines changed

6 files changed

+90
-1
lines changed
 

‎docs/src/background/duality.md

+3-1
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

+2
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

+2
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

+2
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ const LessThanIndicatorZero{T} =
792792
MOI.Scaled{MOI.PositiveSemidefiniteConeTriangle},
793793
MOI.RootDetConeTriangle,
794794
MOI.RootDetConeSquare,
795+
MOI.FrobeniusProductPostiviveSemidefiniteConeTriangle,
796+
MOI.LinearMatrixInequalityConeTriangle,
795797
MOI.LogDetConeTriangle,
796798
MOI.LogDetConeSquare,
797799
MOI.AllDifferent,

‎src/Utilities/results.jl

+26
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

+55
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,61 @@ function Base.getproperty(
17911791
end
17921792
end
17931793

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

0 commit comments

Comments
 (0)
Please sign in to comment.