Second-order cone programming is one of the main methods for solving QCQP problems, which arises in applications such as portfolio construction. The standard form convex QCQP problem is:
where \(Q_{o},…, Q_{m} \) are positive semidefinite \(n X n\) matrices.
The feasible region of an SOCP problem (which may, for instance, be a transformed QCQP problem) can be seen in Figure 1. The feasible region here is the intersection of the green polyhedron and a cone. The curve represents the added quadratic information which makes SOCP more complicated, but at the same time more powerful than LP.
In terms of the implementation of NAG’s SOCP solver, a path-following homogeneous self-dual algorithm is used. This is both robust and efficient and can detect infeasibility and unboundedness of the model. Also, NAG exploits the sparsity pattern of the problem thoroughly which makes the solver efficient, especially on large and sparse problems. For more details on implementation, see the NAG Library routine documentation for NAG SOCP solver nag_opt_handle_solve_socp_ipm [1].
It is rare that a second-order cone (SOC) would appear naturally in the model, yet through a model reformulation, many portfolio optimization problems and constraints can be handled by SOCP. We discuss several of these below, for more examples see [2].

The leverage constraint:
The above norm constraint can be viewed as a special case of general p-norm constraint on a vector \(x
Where \(p = l / m \) is a positive rational number with \( l ≥ m \). Inequality constraints (1) have SOC representation since they are equivalent to inequalities involving rational powers.
The tracking error constraint
where \( P
since \( (1 / 2)x^TPx ≤ t \) is equivalent to \( || Fx||^2_{2} ≤ 2t\). Thus, adding auxiliary variables \( y = Fx \) will transform the quadratic constraint into a standard cone constraint.
For more details, see our mini article on QCQP and the python examples on portfolio optimization involving quadratic functions.
We have mentioned important SOC-representable functions above yet many more problems and constraints from portfolio optimization are SOC-representable. We list some below.
Maximize Sharpe ratio:
where \(e\) is the vector of all ones.
We encourage users to exploit their models thoroughly to reach a SOC-equivalent problem, thereby making the most of the versatility and practical performance of the NAG SOCP solver nag_opt_handle_solve_socp_ipm.
In this section, we show the performance of the NAG SOCP solver from the NAG Library for Python together with the NAG SOCP solver called from CVXPY and the default solver in CVXPY. While we used Python, the same NAG SOCP solver is available in many other environments (C, Java, Fortran, etc.). All solvers were at default settings with accuracy at and in single-threaded mode.
The solvers were used on classic portfolio optimization problems ranging from 1100 to 2900 assets. Randomly generated data was used in a Markowitz model whose objective involved a large covariance matrix and was subject to a long-only constraint and a budget constraint.
The computational time comparison can be found in Figure 2. Here it can be seen that the NAG solver called from CVXPY is faster than the standard CVXPY solver. Further, for smaller problems, the NAG solver called from Python is at least twice as fast as standard CVXPY, becoming as much as five times faster for larger problems.

Figure 2: Comparison of time on portfolio optimization problems.
In conclusion, SOCP is widely used in finance due to its powerful nature. At Mark 29.3, NAG introduces an updated SOCP solver (nag_opt_handle_solve_socp_ipm) that is highly performant on portfolio optimization problems. In some cases, reformulation of your problem is required, yet it is worth the effort. For further examples and reading visit our GitHub Local optimization page.