# How to solve a second order cone program (SOCP) in TFOCS

I want to solve a SOCP for facility location problem. For a small instance my problem is as following.

Minimize z1 + z2 + z3
subject to
z1 >= ||x-b1||_2
z2 >= ||x-b2||_2
z3 >= ||x-b3||_2

where
zi :distance between demand point i and facility location x
bi :coordinates of demand point i
I cannot determine inputs of tfocs function. Thank you for your help in advance.

Derya.

Can I ask why you would use TFOCS instead of CVX here? TFOCS is really not built to handle models like this well.

I solved the problem with CVX. However, my problem instances are very large so computation time of CVX does not seem acceptable. I thought that TFOCS would be faster than CVX since it uses first order algorithms to solve problems.

I solved the problem with CVX. However, my problem instances are very large so computation time of CVX does not seem acceptable. I thought that TFOCS would be faster than CVX since it uses first order algorithms to solve problems.

Unfortunately TFOCS does not support this model exactly. TFOCS_SCD can approximate it, I think; what it would minimize is something like \mu \|x\|_2^2 + \sum_i \|x-b_i\|_2. So for sufficiently small \mu it could come close. But I think a custom method might be appropriate instead.

One approach would be to transform the problem into a smooth problem by the variational characterization
$$||x-b|| = \frac{1}{2} \min_{u\in\mathbb{R}^*_+} \big{\frac{||x-b||^2}{u} + u \big}$$ and implement a smooth_quad_over_lin function (see Section 3.1.2 on TFOCS user guide).

As Michael said, a custom implementation will be the most efficient. But we can handle it with TFOCS, and I have a new second-order-cone function that will be in the next release of TFOCS (hopefully this week). In your case, it will used with the smoothing approach in tfocs_SCD (rather than directly using tfocs.m)