Cones
The cone \(\mathcal{K}\) can be any Cartesian product of the following primitive cones.
Name |
Description |
Entries in ScsCone |
Number of rows in \(A, b\) |
---|---|---|---|
Zero cone |
\(\{s \mid s = 0 \}\) |
|
|
Positive (or linear) cone |
\(\{s \mid s \geq 0 \}\) |
|
|
Box cone |
\(\{(t, s) \in \mathbf{R} \times \mathbf{R}^k \mid t l \leq s \leq t u \}\) |
|
|
Second-order cone |
\(\{(t, s) \in \mathbf{R} \times \mathbf{R}^k \mid \|s\|_2 \leq t \}\) |
|
\(\displaystyle \sum_{i=1}^{\text{qsize}} q_i\) |
Positive semidefinite cone |
\(\{ s \in \mathbf{R}^{k(k+1)/2} \mid \text{mat}(s) \succeq 0 \}\) (See note) |
|
\(\displaystyle \sum_{i=1}^{\text{ssize}} \frac{s_i(s_i+1)}{2}\) |
Complex positive semidefinite cone |
\(\{ s \in \mathbf{R}^{k^2} \mid \text{mat}(s) \succeq 0 \}\) (See note) |
|
\(\displaystyle \sum_{i=1}^{\text{cssize}} cs_i^2\) |
Exponential cone |
\(\{ (x,y,z) \in \mathbf{R}^3 \mid y e^{x/y} \leq z, y>0 \}\) |
|
\(3 \times\) |
Dual exponential cone |
\(\{ (u,v,w)\in \mathbf{R}^3 \mid -u e^{v/u} \leq e w, u<0 \}\) |
|
\(3 \times\) |
Power cone |
\(\{ (x,y,z) \in \mathbf{R}^3 \mid x^p y^{1-p} \geq |z|\}\) |
|
\(3 \times\) |
Dual power cone |
\(\{ (u,v,w)\in \mathbf{R}^3 \mid \left(\frac{u}{p}\right)^p \left(\frac{v}{1-p}\right)^{1-p} \geq |w|\}\) |
|
\(3 \times\) |
Note: The rows of the data matrix \(A\) correspond to the cones in \(\mathcal{K}\). The rows of \(A\) must be in the order of the cones given above, i.e., first come the rows that correspond to the zero cones, then those that correspond to the positive orthants, then the box cone, etc.
Within a cone the rows should be ordered to agree with the mathematical
description of the cone as given above. For instance, the box cone is defined
as \(\{(t, s) \in \mathbf{R} \times \mathbf{R}^k \mid t l \leq s \leq t u
\}\) and consequently the variable vector is stacked as [t;s]
, ie,
t
comes first then s
. Similarly, the exponential cone is
defined as \(\{ (x,y,z) \in \mathbf{R}^3 \mid y e^{x/y} \leq z, y>0 \}\)
and therefore the variable vector is stacked as [x, y, z]
, etc.
Semidefinite cones
The real positive semidefinite cone of matrices is the set
and the complex positive semidefinite cone is the set
and for short we use \(S \succeq 0\) to denote membership. SCS vectorizes these cones in a special way which we detail here.
SCS assumes that the input data corresponding to positive semidefinite cones have been vectorized by scaling the off-diagonal entries by \(\sqrt{2}\) and stacking the real parameters of the lower triangle column-wise. For a \(k \times k\) real matrix variable (or data matrix) this operation creates a vector of length \(k(k+1)/2\), whereas for a \(k \times k\) complex matrix it creates a vector of length \(k^2\). Scaling by \(\sqrt{2}\) is required to preserve the inner-product.
This must be done for the rows of both \(A\) and \(b\) that correspond to semidefinite cones and must be done independently for each semidefinite cone.
More explicitly, we want to express \(\text{Trace}(Y^\dagger S)\) as \(\text{vec}(Y)^\dagger \text{vec}(S)\), where the \(\text{vec}\) operation takes the \(k \times k\) matrix
and produces a vector consisting of the lower triangular real parameters scaled and re-arranged. In the real case, the result is
whereas in the complex case the result is
To recover the matrix solution this operation must be inverted on the components of the vectors returned by SCS corresponding to each semidefinite cone. That is, the off-diagonal entries must be scaled by \(1/\sqrt{2}\) and the upper triangular entries are filled in by copying the values of lower triangular entries. Explicitly, in the real case the inverse operation takes vector \(s \in \mathbf{R}^{k(k+1)/2}\) and produces the matrix
whereas in the complex case the inverse operation takes vector \(s \in \mathbf{R}^{k^2}\) and produces the matrix
So the cone definitions that SCS uses are
Example
For a concrete example in Python see Low-Rank Matrix Completion. Here we consider the real positive semidefinite cone constraint over variables \(x \in \mathbf{R}^n\) and \(S \in \mathbf{R}^{k \times k}\)
where data \(B, \mathcal{A}_1, \ldots, \mathcal{A}_n \in \mathbf{R}^{k \times k}\) are symmetric. We can write this in the canonical form over a new variable \(s \in \mathcal{S}_+^k\):
using the fact that \(\text{vec}\) is linear, where \(b = \text{vec}(B)\) and
i.e., the vectors \(\text{vec}(\mathcal{A}_i)\) stacked columnwise. This is in a form that we can input into SCS. To recover the matrix solution from the optimal solution returned by SCS, we simply use \(S^\star = \text{mat}(s^\star)\).