The standard mean-variance portfolio optimization models have the form:
| Model M1 |
|---|
| \[\begin{align}\min\>&\color{darkred}{\mathit{Risk}}=\color{darkred}x^T\color{darkblue}Q\color{darkred}x\\ & \color{darkblue}r^T\color{darkred}x \ge \color{darkblue}{\mathit{MinimumReturn}} \\ &\sum_i \color{darkred}x_i = 1\\ & \color{darkred}x \ge 0\end{align}\] |
or may be:
| Model M2 |
|---|
| \[\begin{align}\min\>&\color{darkred}z=\color{darkred}x^T\color{darkblue}Q\color{darkred}x - \color{darkblue}\lambda \cdot\color{darkblue}r^T\color{darkred}x\\ &\sum_i \color{darkred}x_i = 1\\ & \color{darkred}x \ge 0\end{align}\] |
where
- \(\color{darkblue}Q\) is a variance-covariance matrix (we assume here it is positive semi-definite [1]),
- \(\color{darkblue}\lambda\) is an exogenous constant that sometimes is varied to draw an efficient frontier, and
- \(\color{darkblue}r\) are the returns.
The last variant is:
| Model M3 |
|---|
| \[\begin{align}\max\>&\color{darkred}{\mathit{Return}}=\color{darkblue}r^T\color{darkred}x\\ & \color{darkred}x^T\color{darkblue}Q\color{darkred}x \le\color{darkblue}{\mathit{MaximumRisk}}\\ &\sum_i \color{darkred}x_i = 1 \\ & \color{darkred}x \ge 0\end{align}\] |
I almost see never this model M3 being used. This is a convex quadratically constrained problem, which can be solved quite easily using modern solvers. Note that the minimum-risk constraint must be an inequality in order for the model to stay convex. (In model M1 we could have replaced the minimum return constraint with an equality constraint. But for quadratic constraints this is not the case: any nonlinear equality constraint is non-convex.)
I can invent two reasons why this model is not very popular:
- Traditionally, models like M1 and M2 have been solved with QP (Quadratic Programming) solvers. QP models have linear constraints and a (convex) quadratic objective. Solvers for quadratically constrained problems are newer. Nowadays, QP problems maybe even reformulated into a second-order cone representation. (All models discussed here are SOCP representable [2].) Essentially things have turned around: moderns solvers may like to have the risk in the constraints.
- It may not be so easy to know a reasonable numeric value for the risk. So having the risk as a constraint may not be very intuitive.
My question: is a QP formulation (model M1) still faster than a QCP (Quadratically Constrained Problem) model (i.e. model M3)? I have no clue. Let's make a small experiment.
Experiment 1
Here we solve a single model M1 and model M3 and compare results. They look like:
---- 140 PARAMETER results
M1 M3
MinReturn 0.500
MaxRisk 0.098
num assets 350.000350.000
vars 351.000351.000
equs 3.0003.000
status Optimal Optimal
obj 0.0980.500
time 0.8750.469
The exogenous value for minReturn is 0.5 (this was return over 4 years). The value for MaxRisk in model M3 was set to optimal risk in model M1. (So we should get as optimal objective in M3 our initial MinReturn=0.5).
A bug in GAMS does not allow me to retrieve the iteration counts, but they were 16 and 15 interior-point iterations (and not 0 as reported by GAMS). This comparison does not say much: the problem is too easy.
Experiment 2
Here we add a cardinality constraint to the problem: allow just 10 assets in our portfolio. This makes the problem an integer programming problem: I added binary variables to the model.
The models are:
| Model M1mip | Model M3mip |
|---|---|
| \[\begin{align}\min\>&\color{darkred}{\mathit{Risk}}=\color{darkred}x^T\color{darkblue}Q\color{darkred}x\\ & \color{darkblue}r^T\color{darkred}x \ge \color{darkblue}{\mathit{MinimumReturn}} \\ &\sum_i \color{darkred}x_i = 1\\ &\color{darkred}x \le \color{darkred}\delta \\& \sum_i \color{darkred}\delta_i = 10 \\ & \color{darkred}x \ge 0\\ & \color{darkred}\delta \in \{0,1\}\end{align}\] | \[\begin{align}\max\>&\color{darkred}{\mathit{Return}}=\color{darkblue}r^T\color{darkred}x\\ & \color{darkred}x^T\color{darkblue}Q\color{darkred}x \le\color{darkblue}{\mathit{MaximumRisk}}\\ &\sum_i \color{darkred}x_i = 1 \\ &\color{darkred}x \le \color{darkred}\delta \\& \sum_i \color{darkred}\delta_i = 10 \\ & \color{darkred}x \ge 0\\ & \color{darkred}\delta \in \{0,1\}\end{align}\] |
Here are the results:
---- 160 PARAMETER results
M1 M3 M1mip M3mip
MinReturn 0.5000.500
MaxRisk 0.0980.099
num assets 350.000350.000350.000350.000
vars 351.000351.000701.000701.000
discr 350.000350.000
equs 3.0003.000354.000354.000
status Optimal Optimal Optimal Optimal
obj 0.0980.5000.0990.500
time 0.8750.4693.17215.203
nodes 559.0006845.000
iterations 1588.00084589.000
Here we see that the M1mip model is doing a bit better than the M3mip model. Just one observation, so not sure whether we can draw conclusions from this. It could be that the quadratic objective helps the branch-and-bound process a bit.
Conclusions
- Modern quadratic solvers have no problem with convex quadratically constrained models. When coming from non-linear programming this is a bit different: for general NLP models, we often prefer to have the nonlinearities to be in the objective.
- But the devil is in the details. Our little MIP example seems to prefer a quadratic objective above a quadratic constraint.
References
- Covariance Matrix not positive definite in portfolio models, https://yetanothermathprogrammingconsultant.blogspot.com/2018/04/covariance-matrix-not-positive-definite.html
- Second-order Cone Programming, https://en.wikipedia.org/wiki/Second-order_cone_programming