How to formulate the following constraints in JuMP

I have a following constraint

\left\| \begin{array}{c} x\\ y\\ \end{array} \right\| _2\leqslant z \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;(1)

where x, y, and z are all non-negative variables, it’s said that (1) is a SOC relaxation of the following constraint

x^2 = z^2-y^2 \;\;\;\;\;\;\;\;\;\;\;\;\;\;(2)

and I have two questions that have puzzled me:

  1. how to transform (1) into (2), though (1) is relaxed.
  2. how to formulate (1) in JuMP?

Thanks in advance.

See

Thanks for your reply, if constraints (1) and (2) are equivalent, is there a performance difference when modeling (1) and (2), separately?

It depends on the solver. In most cases, JuMP will reformulate (1) into (2) or (2) into (1) to best support the solver so it doesn’t matter.

But in general, modeling as a SecondOrderCone is better.

One reason is that the quadratic constraint:

@constraint(model, x^2 + y^2 <= z^2)

is actually non-convex, so it depends on JuMP or the solver figuring out that if there is that quadratic constraint, and z >= 0, then it is actually convex and equivalent to a SecondOrderCone.

(Also note that your equation (2) is not quite right. It needs <= instead of =.)

1 Like

Thanks, that really helps me.

1 Like