@@ -22,3 +22,101 @@ MOI.side_dimension(::PositiveSemidefinite2x2ConeTriangle) = 2
2222function Base. copy (set:: Union{EmptyCone,PositiveSemidefinite2x2ConeTriangle} )
2323 return set
2424end
25+
26+ function matrix_cone (
27+ S:: Type{<:MOI.AbstractSymmetricMatrixSetTriangle} ,
28+ side_dimension,
29+ )
30+ if iszero (side_dimension)
31+ # Some solvers such as Mosek does not support 0-dimensional PSD cone
32+ return EmptyCone ()
33+ elseif isone (side_dimension)
34+ # PSD constraints on 1x1 matrices are equivalent to the nonnegativity
35+ # of the only entry.
36+ return MOI. Nonnegatives (1 )
37+ elseif side_dimension == 2
38+ # PSD constraints on 2x2 matrices are SOC representable.
39+ return PositiveSemidefinite2x2ConeTriangle ()
40+ else
41+ # PSD constraints on nxn matrices with n ≥ 3 is not SOC representable,
42+ # see [F18].
43+ #
44+ # [F18] Fawzi, Hamza
45+ # On representing the positive semidefinite cone using the second-order
46+ # cone.
47+ # Mathematical Programming (2018): 1-10.
48+ return S (side_dimension)
49+ end
50+ end
51+
52+ """
53+ struct DiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
54+ side_dimension::Int
55+ end
56+
57+ See [Ahmadi2017; Definition 4](@cite) for a precise definition of the last two items.
58+ """
59+ struct DiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
60+ side_dimension:: Int
61+ end
62+
63+ function matrix_cone (S:: Type{DiagonallyDominantConeTriangle} , side_dimension)
64+ if iszero (side_dimension)
65+ return EmptyCone ()
66+ elseif isone (side_dimension)
67+ return MOI. Nonnegatives (1 )
68+ else
69+ # With `side_dimension` = 2, we want to avoid using SOC and only use LP
70+ return S (side_dimension)
71+ end
72+ end
73+
74+ """
75+ struct ScaledDiagonallyDominantConeTriangle <: MOI.AbstractSymmetricMatrixSetTriangle
76+ side_dimension::Int
77+ end
78+
79+ See [Ahmadi2017; Definition 4](@cite) for a precise definition of the last two items.
80+ """
81+ struct ScaledDiagonallyDominantConeTriangle < :
82+ MOI. AbstractSymmetricMatrixSetTriangle
83+ side_dimension:: Int
84+ end
85+
86+ function matrix_cone (
87+ S:: Type{ScaledDiagonallyDominantConeTriangle} ,
88+ side_dimension,
89+ )
90+ if iszero (side_dimension)
91+ return EmptyCone ()
92+ elseif isone (side_dimension)
93+ return MOI. Nonnegatives (side_dimension)
94+ elseif side_dimension == 2
95+ return PositiveSemidefinite2x2ConeTriangle ()
96+ else
97+ return S (side_dimension)
98+ end
99+ end
100+
101+ # isbits types, nothing to copy
102+ function Base. copy (
103+ set:: Union {
104+ DiagonallyDominantConeTriangle,
105+ ScaledDiagonallyDominantConeTriangle,
106+ },
107+ )
108+ return set
109+ end
110+
111+ struct SOSPolynomialSet{
112+ DT<: AbstractSemialgebraicSet ,
113+ MT<: MP.AbstractMonomial ,
114+ MVT<: AbstractVector{MT} ,
115+ CT<: Certificate.AbstractCertificate ,
116+ } <: MOI.AbstractVectorSet
117+ domain:: DT
118+ monomials:: MVT
119+ certificate:: CT
120+ end
121+ MOI. dimension (set:: SOSPolynomialSet ) = length (set. monomials)
122+ Base. copy (set:: SOSPolynomialSet ) = set
0 commit comments