# SOCP implementation

I’m trying to implement the optimization below in cvx, but I’m getting unexpected results and sometimes no results at all.

\min_x(\|y+Ax\|_\infty) ~~ \text{s.t}~~ \|u+Dx\|_2\leq \beta \|u\|_2 ~~\text{&&}~~ \|y+Ax\|_2 \leq \epsilon

The only unknown is x and the problem is a second-order cone program (SOCP).

I tried two different implementations, the first is

cvx_begin quiet
variable x(n);
minimize(norm((y + A*x),inf));
subject to
norm(u+D*x) <= beta* norm(u);
norm(y+A*x) <= epsilon;
cvx_end


The second implementation is

cvx_begin quiet
variables x(n) t
minimize(t);
subject to
norm(y + A*x, inf) <= t;
norm(u+D*x) <= beta*norm(u);
norm(y+A*x) <= epsilon;
t >= 0;
cvx_end


I’m not an expert in cvx or optimization for that matter, so I don’t know which one is correct. I have seen many SOCPs expressed as the second implementation above. Why can’t the problem be implemented in it’s original form.

Also the values I’m getting for the vector x are real, although all other variables in the problem are complex, is that possible? Any help is much appreciated.

Not sure if this is in the code you ran, but your 2 versions as posted are not equivalent because you forgot to specify inf in norm(y + A*x) <= t. Also, t >= 0 is redundant, but should be harmless. Also, don’t use quiet until everything is under control and understood.

Isn’t norm (y+Ax,inf) <= t equivalent to norm((y+Ax))_i <=t. i is the index of each entry in (y+Ax).

Your equivalency may be correct (see comment below), but neither are equivalent to the 2 norm (which is the default if not specified in norm). Your 2nd implementation would correspond to your first implementation having minimize (norm(y+Ax))), or equivalently, minimize(norm(y+Ax,2)).

Your equivalency above is correct depending on what you mean by norm((y+Ax))_i. It would be correct if you mean norm((y+Ax)_i), i.e., the norm of the ith component of y+A*x.

Thank you. I edited my second implementation. Can I say now that the second implementation is a correct implementation of the optimization problem?

After your edit, your 2 implementations now look equivalent to me and correspond to your mathematical specification. However, I defer to others as to whether the problems passed to the solver by CVX are identical between the 2, or whether they may differ in numerical behavior or efficiency.

You have not declared x(n) as complex, so it is a real vector, and values will be real. If it should be complex, declare it as variable x(n) complex.

Thank you. I just want to add that I’m getting strange or no results at all with the first implementation. I sometimes need to restart Matlab to get results, which is a bit unusual.

Thank you for the comment about the complex variable declaration. I was not aware of that, I assumed cvx will take care of that by default. This may be a big factor in the results I’m getting.

With CVX, as long as you follow its rules, you don’t need to input problems in any particular standard form, since CVX does any needed transformations internally. So you could just use your 1st formulation, which directly corresponds to your mathematical specification (with complex if needed).