# RotatedSecondOrderCone() usage

Hi, how should I use RotatedSecondOrderCone() object when converting soc constraint x^2 + y^2 <= wz where w>=0, z>= 0 ?

I tried to resemble the constraint to given syntax in the manual . However, I am not sure if I am doing correctly in JuMP syntax as follows

2x^2 + 2y^2 <= 2wz where w>=0, z>= 0

 @constraint(model, [w, z, 2x, 2y] in RotatedSecondOrderCone())

Almost, but using 2x, you will rather have (2x)^2 hence 4x^2 so you should rather use sqrt(2) * x. Another option is to use w/2 or z/2.

Just to confirming how RotatedSecondOrderCone() object transforms x^2 + y^2 <= wz as particular JuMP syntax

1. @constraint(model, [w, z, sqrt(2)x, sqrt(2)y] in RotatedSecondOrderCone())
OR
2. @constraint(model, [w/2, z/2, x, y] in RotatedSecondOrderCone())

However, I am still confused with (1) and (2) when x^2 + y^2 <= wz is written as below
x^2 + y^2 + [ (w-z) / 2 ]^2 <= [ (w+z) / 2 ]^2
4x^2 + 4y^2 + (w-z)^2 <= (w+z)^2
norm( [2x, 2y, (w-z)] ) <= (w+z)
which is also representing the same rotated SOCP cone in R^4.

How RotatedSecondOrderCone() takes norm operation for x^2 + y^2 <= wz expression is still unclear to me.

Formulation 1. is correct but 2. is not.

The RSOC constraint (t, u, v) \in RSOC translates to

t, u \geq 0, 2 \times t \times u \geq x_{1}^{2} + ... + x_{n}^{2}

Thus, to have w \times z \geq x^{2} + y^{2}, you can write:

• [w, z, x*sqrt(2), y*sqrt(2)] in RSOC()
• [w/2, z, x, y] in RSOC()
• [w, z/2, x, y] in RSOC()
• [w/sqrt(2), z/sqrt(2), x, y] in RSOC()

All these formulations are equivalent, i.e., they represent the same set.

To answer the second part your last post: this relation comes from the fact that a Rotated Second-Order Cone can be obtained… by rotating a second-order cone (see the Mosek modeling cookbook).
Specifically, the rotation matrix is

\begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ && 1\\ &&& \ddots\\ &&&& 1 \end{bmatrix}

Apply this change of coordinate to the SOC constraint \| 2x, 2y, w-z\| \leq (w+z)^{2} and you’ll recover the original RSOC constraint.

3 Likes

When I apply the norm operator to representations given in bullet-(1,3), it yields 2 \times w z \geq x^2 + y^2 and bullet-(2,4) yield (1/2)*w z \geq x^2 + y^2.

Why wouldn’t it be written [w,z,x,y] in RSOC ?

What are “bullet-(1,3)” and “bullet-(2,4)” here?

Bullets

Woops, the first one should have been [w, z, x*sqrt(2), y*sqrt(2)] in RSOC(). I just corrected that.

All (corrected) formulations are equivalent and express the constraint you initially stated, i.e., wz \geq x^{2} + y^{2}, w\geq 0, z \geq 0.
Recall the definition of rotated second-order cones as per my previous post and the MOI documentation. Don’t forget the 2 factor!

Noted. Thanks for all the clarifications