← Blog

Transforming a QP Problem to an SOCP Problem

By Ken Yiu ·

A Quadratic Programming problem (QP) in the form of

minimizex12xTHx+pTxsubject toAeqx=beqAx≥b\begin{aligned} & \underset{x}{\text{minimize}} & & \frac{1}{2} x^T H x + p^T x \\ & \text{subject to} \\ & & & A_{eq} x = b_{eq} \\ & & & A x \geq b \end{aligned}

where H∈ℜn×n,A∈ℜm×n,p,x∈ℜn,b∈ℜmH \in \Re^{n \times n}, A \in \Re^{m \times n}, p, x \in \Re^n, b \in \Re^m , can be transformed to a Second-Order Cone Programming (SOCP) problem in the form of

minimizexfTxsubject to∥Aix+bi∥2≤ciTx+di,  i=1,…,m\begin{aligned} & \underset{x}{\text{minimize}} & & f^T x \\ & \text{subject to} \\ & & & \left \| A_i x + b_i \right \|_2 \leq c_i^T x + d_i, \; i = 1, \ldots, m \end{aligned}

Consider y=∥Fx–c∥y = \left \| F x – c \right \|, and

y2=∥Fx–c∥2=(Fx–c)T(Fx–c)=xTFTFx–2cTFx+cTc\begin{aligned} y^2 & = \left \| F x – c \right \|^2 \\ & = (F x – c)^T (F x – c) \\ & = x^T F^T F x – 2 c^T F x + c^T c \end{aligned}

As cTcc^T c is non-negative, minimizing xTFTFx–2cTFxx^T F^T F x – 2 c^T F x is equivalent to minimizing y2y^2, and hence is equivalent to minimizing yy.

If we have H=2FTFH = 2 F^T F and p=−2FTcp = -2 F^T c, then the objective function in QP 12xTHx+pTx\frac{1}{2} x^T H x + p^T x can be written as xTFTFx–2cTFxx^T F^T F x – 2 c^T F x . We can thus minimize yy.

Thus, the QP problem can now be written as

minimizeyysubject to∥Fx–c∥≤yAeqx=beqAx≥b\begin{aligned} & \underset{y}{\text{minimize}} & & y \\ & \text{subject to} \\ & & & \left \| F x – c \right \| \leq y \\ & & & A_{eq} x = b_{eq} \\ & & & A x \geq b \end{aligned}

As HH, by definition of QP, is symmetric, a symmetric FF can be found such that H2=FTF=F2\frac{H}{2} = F^T F = F^2. If the QP is assumed to be a convex QP, HH is positive semidefinite, applying Cholesky factorization gives H2=UTU\frac{H}{2} = U^T U (or LLTL L^T). In this case, F=UF = U (or LTL^T).

Next, as ∥⋅∥2\left \| \cdot \right \|_2 is always non-negative, the equality constraint Aeqx=beqA_{eq} x = b_{eq} can be written as

∥Aeqx–beq∥≤0\left \| A_{eq} x – b_{eq} \right \| \leq 0

Finally, each row in the inequality constraint Ax≥bA x \geq b can be written as

aix–bi≥0,  i=1,…,ma_i x – b_i \geq 0, \; i = 1, \ldots, m

where aia_i is the i-th row of AA, and bib_i is the i-th element of bb.

Therefore, a QP problem can be transformed to an equivalent SOCP problem in the following way. We need to introduce a few variables first.

  • y=xn+1y = x_{n+1}
  • c=−12F−Tpc = -\frac{1}{2} F^{-T} p

minimizexfTxsubject to∥A1x+b1∥2≤c1Tx+d1∥A2x+b2∥2≤c2Tx+d2∥A3x+b3∥2≤c3Tx+d3⋮∥Am+2x+bm+2∥2≤cm+2Tx+dm+2wheref=(0,…,0,1)Tx=(x1,…,xn,xn+1)TA1=[F,0],b1=12F−Tp,c1=(0,…,0,1)T,d1=0,(H2)=FTFA2=[Aeq,0],b2=−beq,c2=0,d2=0Ai+2=0,bi+2=0,ci+2=the i-th row of A,di+2=−(the i-th element of b),  i=1,…,mf,x,c1,…,cm+2∈ℜn+1\begin{aligned} & \underset{x}{\text{minimize}} & & f^T x \\ & \text{subject to} \\ & & & \left \| A_1 x + b_1 \right \|_2 \leq c_1^T x + d_1 \\ & & & \left \| A_2 x + b_2 \right \|_2 \leq c_2^T x + d_2 \\ & & & \left \| A_3 x + b_3 \right \|_2 \leq c_3^T x + d_3 \\ & & & \vdots \\ & & & \left \| A_{m+2} x + b_{m+2} \right \|_2 \leq c_{m+2}^T x + d_{m+2} \\ & \text{where} \\ & & f & = (0, \ldots, 0, 1)^T \\ & & x & = (x_1, \ldots, x_n, x_{n+1})^T \\ & & A_1 & = \left [ F, 0 \right ], b_1 = \frac{1}{2} F^{-T} p, c_1 = (0, \ldots, 0, 1)^T, d_1 = 0, \left (\frac{H}{2} \right ) = F^T F \\ & & A_2 & = \left [ A_{eq}, 0 \right ], b_2 = -b_{eq}, c_2 = 0, d_2 = 0 \\ & & A_{i+2} & = 0, b_{i+2} = 0, c_{i+2} = \text{the i-th row of }A, d_{i+2} = -(\text{the i-th element of }b), \; i = 1, \ldots, m \\ & & & f, x, c_1, \ldots, c_{m+2} \in \Re^{n+1} \end{aligned}

The sub-vector with the first nn elements in the solution of the transformed SOCP problem is the solution of the original QP problem.

SuanShu has implementations to solve both SOCP and QP problems.