Abstract
Mean–variance portfolio optimization problems often involve separable nonconvex terms, including penalties on capital gains, integer share constraints, and minimum nonzero position and trade sizes. We propose a heuristic algorithm for such problems based on the alternating direction method of multipliers (ADMM). This method allows for solve times in tens to hundreds of milliseconds with around 1000 securities and 100 risk factors. We also obtain a bound on the achievable performance. Our heuristic and bound are both derived from similar results for other optimization problems with a separable objective and affine equality constraints. We discuss a concrete implementation in the case where the separable terms in the objective are piecewise quadratic, and we empirically demonstrate its effectiveness for tax-aware portfolio construction.
Similar content being viewed by others
References
Bertsekas D (1999) Nonlinear programming, 3rd edn. Athena Scientifc, Nashua
Benidis K, Feng Y, Palomar D (2018) Optimization methods for financial index tracking: from theory to practice. Found Trends Optim 3(3):171–279
Boyd S, Busseti E, Diamond S, Kahn R, Nystrup P, Speth J (2017) Multi-Period Trading via Convex Optimization. Found Trends Optim 3(1):1–76
Boyd S, Parikh N, Chu E (2011) Distributed optimization and statistical learning via the alternating direction method of multipliers. Found Trends Mach Learn 3(1):1–122
Boyd S, Vandenberghe L (2004) Convex optimization. Cambridge University Press, Cambridge
Grinold R, Kahn R (1999) Active Portfolio management, 2nd edn. McGraw-Hill, New York
Gardiner B, Lucet Y (2010) Convex hull algorithms for piecewise linear-quadratic functions in computational convex analysis. Set-Valued Var Anal 18(3–4):467–482
Lobo M, Fazel M, Boyd S (2007) Portfolio optimization with linear and fixed transaction costs. Ann Oper Res 152(1):341–365
Markowitz H (1952) Portfolio selection. J Finance 7(1):7791
Markowitz H (1955) The optimization of a quadratic function subject to linear constraints. RAND Corporation Tech rep, Santa Monica
Moehle N, Kochenderfer MJ, Boyd S, Ang A (2021) Tax-aware portfolio construction via convex optimization. J Optim Theory Appl 189(2):364–383
Mansini R, Ogryczak W, Speranza MG (2015) Linear and mixed integer programming for portfolio optimization. Springer, Cham
Rockafellar R (1970) Convex analysis. Princeton University Press, Princeton
Sharpe W (1963) A simplifed model for portfolio analysis. Manag Sci 9(2):277293
Stellato B, Banjac G, Goulart P, Bemporad A, Boyd S (2020) OSQP: an operator splitting solver for quadratic programs. Math Program Comput 12:637–672
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
Appendix A Portfolio construction parameters
We can convert problem (7) into the separable–affine form (5). The variable is \(x = (h, c, y)\in \textbf{R}^{l+k+1}\). The affine constraint parameters are
The part of the separable function corresponding to asset i is
for \(i = 1,\dots , l\). The component of f corresponding to c is
The component of f corresponding to y is \(f_i(y_i) = y_i^2\), for \(i = l+2,\dots , l+k+1\).
Appendix B Convex envelope details
We can compute the convex envelope of a piecewise quadratic function as discussed in Sect. 6.3. To do this, we must compute the parameters \(\alpha \), \(\beta \), \(x_\varphi \), and \(x_\psi \) from (19). We do this making use of the following two facts.
The first fact is that candidate values of \(\alpha \), \(\beta \), \(x_\varphi \), and \(x_\psi \) are valid if and only if the function \(\alpha x + \beta \) is tangent to \(\psi ^i\) at \(x_\psi \) and to \(\varphi _i\) at \(x_\varphi \). This holds if and only if
where \(\partial \psi ^i\) and \(\partial \varphi _i\) are the subdifferentials of \(\psi ^i\) and \(\varphi _i\). These conditions can be easily checked given a set of candidate parameters \(\alpha \), \(\beta \), \(x_\psi \), and \(x_\varphi \).
The second fact is that (19) can be rewritten
where \({\tilde{a}}_1 \le {\tilde{b}}_i \le \dots \le {\tilde{a}}_j\) are the endpoints of the pieces of \(\psi ^i\). In other words, the function \(\psi ^{i+1}\) matches \(\psi ^i\) up to the jth piece of \(\psi ^i\), and after that, is equal to the convex envelope of the pointwise minimum of \(\psi ^i_j\) and \(\varphi _i\). This convex envelope (the last piece in (21)) is easy to compute, as \(\min \{\psi _j^i, \varphi _i\}\) is a piecewise quadratic with two pieces. (We discuss how to do this in Sect. 1.)
This means that once j is known, we can use (21) to compute \(\psi ^{i+1}\). To find j, we simply try all pieces of \(\psi ^i\), compute the right-hand side of (21), and check if the resulting parameters \(\alpha \), \(\beta \), \(x_\psi \) and \(x_\varphi \) satisfy the conditions (20).
1.1 Appendix B.1 Piecewise-quadratic functions with two pieces
The function \(\min \{\psi _j^i, \varphi _i\}\) in (21) is piecewise quadratic with two pieces. Here we discuss how to compute the convex envelope of such functions.
Let g(x) be a PWQ with two pieces: \(g_1(x) = p_1x^2 + q_1x + r_1\) on \([a_1, b_1]\), and \(g_2(x) = p_2x^2 + q_2x + r_2\) on \([a_2, b_2]\), with \(b_1 \le a_2\). In this case, \(g^{**}\) has the form
for some \(\alpha \), \(\beta \), \(x_1\), and \(x_2\). These parameters are real valued, but we allow for the case when \(x_1 = -\infty \) or \(x_2 = \infty \); in these cases, first or last interval is degenerate, and can be ignored.
Similarly to (20) above, it is necessary and sufficient for the parameters \(\alpha \), \(\beta \), \(x_1\), and \(x_2\) to satisfy
How these checks are carried out in practice depends on whether \(x_1\) (or \(x_2\)) are in the interior or boundary of the domain of \(g_1\) (or \(g_2\)), or whether \(x_1 = -\infty \) (or \(x_2 = \infty \)).
1.1.1 Appendix B.1.1 The midpoint-to-midpoint case
We first consider the case when \(x_1\) is in the interior of the domain of \(g_1\), i.e., \(a_1< x_1 < b_1\), and \(x_2\) is in the interior of the domain of g, i.e., \(a_2< x_2 < b_2\). In this case, we must have
By plugging in the values of the functions and their derivatives, we obtain
These four equations can be reduced to a single quadratic equation with a single unknown. This quadratic equation has at most two solutions, each corresponding to a set of candidate values of \(\alpha \), \(\beta \), \(x_1\), and \(x_2\). To see if these candidate values \(\alpha \), \(\beta \), \(x_1\), and \(x_2\) parameterize a valid convex envelope of g, we check if our initial assumption, that \(a_1< x_1 < b_1\) and \(a_2< x_2 < b_2\), holds.
1.1.2 Appendix B.1.2 The midpoint-to-endpoint case
Now we consider the case in which \(x_1\) is in the interior of the domain of \(g_1\), and \(x_2 \in \{a_2, b_2\}\). (We note that the case in which \(x_1 \in \{a_1, b_1\}\) and \(x_2\) in the interior of the domain of g can be handled similarly, and we do not discuss it further.)
Finite upper bound. We start with the case when \(x_2 < \infty \). To do this, we solve a slightly modified set of equations:
These are the first three equations of (25). As before, they can be reduced to a single quadratic equation with a single unknown. This quadratic equation has at most two solutions, each corresponding to a set of candidate values of \(\alpha \), \(\beta \), and \(x_1\).
To see if these candidate values parameterize a valid convex envelope, we verify that \(x_1\) is in the interior of the domain of \(g_1\), i.e., \(a_1< x_1 < b_1\), and also the second condition of (23). In the degenerate case in which \(g_2\) is defined over a single point, i.e., \(a_2 = b_2\), this second condition always holds; in the non-degenerate case \(a_2 < b_2\), the condition is equivalent to \(g_2'(x_2) = 2p_2x_2 + q_2 \le \alpha \) if \(x_2 = a_2\), and \(g_2'(x_2) = 2p_2x_2 + q_2 \ge \alpha \) if \(x_2 = b_2\).
Infinite upper bound. Next we consider the case of \(x_2 = \infty \), which may occur when \(x_2 = b_2 = \infty \), i.e., the domain of \(g_2\) is unbounded. In this case, we modify the last equation in (26), resulting in the equations
The last equation is equivalent to \(p_2 = 0\) and \(\alpha = q_2\). To find the corresponding candidate values of \(\beta \), and \(x_1\), we solve \(g_1(x_1) = h(x_1)\) and \(g_1'(x_1) = h'(x_1)\). To check the validity of the candidate values of \(\alpha \), \(\beta \), \(x_1\), and \(x_2\), we check that \(a_1< x_1 < b_1\) and \(p_2 = 0\).
1.1.3 Appendix B.1.3 The endpoint-to-endpoint case
Finally, we consider the case in which \(x_1 \in \{a_1, b_1\}\) and \(x_2\in \{a_2, b_2\}\).
Finite upper bound. First suppose \(a_1\), \(b_1\), \(a_2\), and \(b_2\) are all finite. Take h to be the line through the points \((x_1, g_1(x_1))\) and \((x_2, g_2(x_2))\), i.e., the parameters are \(\alpha = (g(x_2) - g_1(x_1))/(x_2 - x_1)\) and \(\beta = \alpha x_1 - g_1(x_1)\). Note that if \(x_1 = x_2\), then h is ill-defined, and these candidate values of \(x_1\) and \(x_2\) can be skipped.
To verify that these values of \(\alpha \), \(\beta \), \(x_1\), and \(x_2\) parameterize a valid convex envelope of f, we check condition (23). Recall that the first condition only need hold if \(a_1 < b_1\), and the second if \(a_2 < b_2\). For example, if \(a_1=b_1<a_2=b_2\), then any combination of \(x_1 \in \{a_1, b_1\}\) and \(x_2 \in \{a_2, b_2\}\) are immediately valid.
Infinite upper bound. Now we consider the case when \(x_2 = b_2 = \infty \). In this case, we require \(h'(\infty ) = g_2'(\infty )\), i.e., \(p_2 = 0\) and \(\alpha = q_2\). We then have \(\beta = g_1(x_1) - q_2 x_1\). To verify that \(\alpha \), \(\beta \), \(x_1\), and \(x_2\) parameterize a valid envelope of f, we need only check the first condition of (23).
Rights and permissions
About this article
Cite this article
Moehle, N., Gindi, J., Boyd, S. et al. Portfolio construction as linearly constrained separable optimization. Optim Eng 24, 1667–1687 (2023). https://doi.org/10.1007/s11081-022-09748-x
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11081-022-09748-x