Skip to content

Commit 48495f4

Browse files
committed
Add interconversion between SDPA and SeDuMi
1 parent 7f87d84 commit 48495f4

File tree

2 files changed

+110
-4
lines changed

2 files changed

+110
-4
lines changed

docs/formats/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ The SeDuMi solver solves the following primal ($$\mathcal{P}$$) and dual ($$\mat
6868
$$
6969
\begin{aligned}
7070
(\mathcal{P}) \min_{x}. \quad & c^T x\\
71-
\textrm{s.t.} \quad & x \succeq_K 0\\
72-
& A x - b = 0
71+
\textrm{s.t.} \quad & A x - b = 0\\
72+
& x \succeq_K 0
7373
\end{aligned}
7474
$$
7575

@@ -93,6 +93,8 @@ A commonly used dataset for problems in SeDuMi format is the [DIMACS](http://arc
9393

9494
The primal-dual pair in SeDuMi is the reverse of that in SDPA. In SeDuMi, the dual problem is a linear-matrix-inequality form.
9595

96+
To see the relationship between SDPA and SeDuMi formats, please see the subsection on the [Interconversion between SDPA and SeDuMi Formats](sdpa_sedumi.html).
97+
9698
# CLP Format
9799

98100
SDPAP (of which this wrapper is a fork) introduced a third format, called CLP that stands for Conic-form Linear Optimization Problems. The official specification of this format is given in the [user manual of SDPAP](https://sourceforge.net/projects/sdpa/files/sdpa-p/sdpap_manual.pdf) on the [official SDPA website](http://sdpa.sourceforge.net/download.html).
@@ -102,8 +104,8 @@ The CLP format is defined both as a file format, as well as an in memory represe
102104
$$
103105
\begin{aligned}
104106
(\mathcal{P}) \min_{x}. \quad & c^T x\\
105-
\textrm{s.t.} \quad & x \succeq_K 0\\
106-
& A x - b \succeq_J 0
107+
\textrm{s.t.} \quad & A x - b \succeq_J 0\\
108+
& x \succeq_K 0
107109
\end{aligned}
108110
$$
109111

docs/formats/sdpa_sedumi.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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

Comments
 (0)