| # Facility Location Consider the problem of locating a warehouse to serve a number of service locations. The design variable is the location of the warehouse, , while the service locations are given by the vector , . ### Minimizing the maximum distance
| One possible objective function for this problem involves the maximum distance from the warehouse to any location. This is the problem which can be cast as the SOCP
This can be coded up with the CVX applet: CVX syntax
    % pts is a 2 x n matrix of n points
    cvx_begin
        variable x(2,1);
        variable t(n,1);
        minimize( max(t) )
        subject to
            for i = 1:n,
                t(i) >= norm(x-pts(:,i));
            end
    cvx_end
### Minimizing the average distance
| Often, the average distance is a good measure of the transportation costs involved. This leads to the problem which can be cast as the SOCP
This can be coded up with the CVX applet: CVX syntax
    % pts is a 2 x n matrix of n points
    cvx_begin
        variable x(2,1);
        variable t(n,1);
        minimize( max(t) )
        subject to
            for i = 1:n,
                t(i) >= norm(x-pts(:,i));
            end
    cvx_end