|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: SDPA-SeDuMi Interconversion |
| 4 | +parent: SDP Formats |
| 5 | +nav_order: 2 |
| 6 | +--- |
| 7 | + |
| 8 | +# Interconversion between SDPA and SeDuMi Formats |
| 9 | + |
| 10 | +As discussed on the [SDPA Formats](index.html) page, the SDPA and SeDuMi formats are reverses of each other. |
| 11 | +In SDPA, the primal problem is a linear-matrix-inequality form while in SeDuMi, the dual problem is a linear-matrix-inequality form. |
| 12 | + |
| 13 | +It's also discussed that SDPA has the ability to solve the problem in either format. To this end, SDPA comes with a preprocessor directive `REVERSE_PRIMAL_DUAL`. |
| 14 | + |
| 15 | +- With `REVERSE_PRIMAL_DUAL = 1`, we use the SDPA form. This is the default setting (i.e. SDPA is configured to treat the primal problem as a linear-matrix-inequality form). |
| 16 | +- With `REVERSE_PRIMAL_DUAL = 0`, we use the SeDuMi form. |
| 17 | + |
| 18 | +Below we show how setting `REVERSE_PRIMAL_DUAL = 0` gives us the SeDuMi format. We start off by writing the primal-dual pair that SDPA solves with the default setting (i.e. with `REVERSE_PRIMAL_DUAL = 1`). |
| 19 | + |
| 20 | +$$ |
| 21 | +\begin{aligned} |
| 22 | +(\mathcal{P}) \min_{x}. \quad & c^T x\\ |
| 23 | +\textrm{s.t.} \quad & \sum_{i=1}^m F_i x_i - F_0 \succeq_{\mathbb{S}^n_+} 0 |
| 24 | +\end{aligned} |
| 25 | +$$ |
| 26 | + |
| 27 | +$$ |
| 28 | +\begin{aligned} |
| 29 | +(\mathcal{D}) \max_{Y}. \quad & F_0 \cdot Y\\ |
| 30 | +\textrm{s.t.} \quad & c_i - F_i \cdot Y = 0, \quad i = 1, ..., m \\ |
| 31 | + & Y \succeq_{\mathbb{S}_+} 0 |
| 32 | +\end{aligned} |
| 33 | +$$ |
| 34 | + |
| 35 | +The primal variable (i.e. vector $$x$$) with `REVERSE_PRIMAL_DUAL = 1` should become the dual variable with `REVERSE_PRIMAL_DUAL = 0` and the dual variable (i.e. the matrix $$Y$$) should become the primal variable. To this end, we will make the below substitutions. |
| 36 | + |
| 37 | +$$ |
| 38 | +\begin{aligned} |
| 39 | +x &\longrightarrow y\\ |
| 40 | +Y &\longrightarrow X\\ |
| 41 | +\end{aligned} |
| 42 | +$$ |
| 43 | + |
| 44 | +To achieve similarity with SeDuMi, we will also perform the below substitutions. |
| 45 | + |
| 46 | +$$ |
| 47 | +\begin{aligned} |
| 48 | +F_i &\longrightarrow -A_i\\ |
| 49 | +c &\longrightarrow -b\\ |
| 50 | +\end{aligned} |
| 51 | +$$ |
| 52 | + |
| 53 | +After these substitutions, we get the pair |
| 54 | + |
| 55 | +$$ |
| 56 | +\begin{aligned} |
| 57 | +(\mathcal{?}) \min_{y}. \quad & -b^T y\\ |
| 58 | +\textrm{s.t.} \quad & \sum_{i=1}^m -A_i y_i + A_0 \succeq_{\mathbb{S}^n_+} 0 |
| 59 | +\end{aligned} |
| 60 | +$$ |
| 61 | + |
| 62 | +$$ |
| 63 | +\begin{aligned} |
| 64 | +(\mathcal{?}) \max_{X}. \quad & -A_0 \cdot X\\ |
| 65 | +\textrm{s.t.} \quad & -b_i + A_i \cdot X = 0, \quad i = 1, ..., m \\ |
| 66 | + & X \succeq_{\mathbb{S}_+} 0 |
| 67 | +\end{aligned} |
| 68 | +$$ |
| 69 | + |
| 70 | +We can now flip the $$\min$$ and $$\max$$ and remove the minus signs from the objectives. Since by convention the primal problem is a minimization problem and the dual is a maximization problem, we also exchange their roles as primal and dual and create the pair corresponding to `REVERSE_PRIMAL_DUAL = 0` as below: |
| 71 | + |
| 72 | +$$ |
| 73 | +\begin{aligned} |
| 74 | +(\mathcal{P'}) \min_{X}. \quad & A_0 \cdot X\\ |
| 75 | +\textrm{s.t.} \quad & A_i \cdot X = b_i, \quad i = 1, ..., m \\ |
| 76 | + & X \succeq_{\mathbb{S}_+} 0 |
| 77 | +\end{aligned} |
| 78 | +$$ |
| 79 | + |
| 80 | +$$ |
| 81 | +\begin{aligned} |
| 82 | +(\mathcal{D'}) \max_{y}. \quad & b^T y\\ |
| 83 | +\textrm{s.t.} \quad & A_0 - \sum_{i=1}^m A_i y_i \succeq_{\mathbb{S}^n_+} 0 |
| 84 | +\end{aligned} |
| 85 | +$$ |
| 86 | + |
| 87 | +In general, conversion from matrices to vectors and vice versa can be obtained very easily using the $$\text{vec}(...)$$ and $$\text{vec}^{-1}(...)$$ operations. Knowing that $$\text{vec}(X)$$ in $$(\mathcal{P'})$$ above becomes $$x$$ in $$(\mathcal{P''})$$ below, and the fact that SDP cone is self dual (i.e. $$\mathbb{S}^n_+ = {\mathbb{S}^n_+}^*$$) we now see the similarity with [the SeDuMi format](index.html#sedumi-format): |
| 88 | + |
| 89 | +$$ |
| 90 | +\begin{aligned} |
| 91 | +(\mathcal{P''}) \min_{x}. \quad & c^T x\\ |
| 92 | +\textrm{s.t.} \quad & A x - b = 0\\ |
| 93 | + & x \succeq_K 0 |
| 94 | +\end{aligned} |
| 95 | +$$ |
| 96 | + |
| 97 | +$$ |
| 98 | +\begin{aligned} |
| 99 | +(\mathcal{D''}) \max_{y}. \quad & b^T y\\ |
| 100 | +\textrm{s.t.} \quad & c - A^T y \succeq_{K^*} 0 |
| 101 | +\end{aligned} |
| 102 | +$$ |
| 103 | + |
| 104 | +Another difference is that the cone $$K$$ supported by SeDuMi is a generalization of the SDP cone, in sense that it also supports SOCP constraints. |
0 commit comments