Skip to content
All library documents

Formulating Multi-Portfolio Minimum-Variance Allocation as a Quadratic Program

Article Quant Q&A · Author: uhrskov91

Summary

The document shows how to express a joint allocation across multiple portfolios as one quadratic program. It stacks each portfolio’s asset weights into a single decision vector, then writes constraints for distributing each asset’s total holdings, matching portfolio assets under management, and meeting portfolio return targets. It also illustrates a relative weight cap as a linear inequality and describes a block-diagonal covariance matrix for aggregating portfolio risk in the objective.

The setup fits a long-only minimum-variance allocation problem when expected returns, covariance estimates, holdings, and target constraints are supplied. The author points to a Python quadratic-programming library as an implementation option. The formulation assumes total asset holdings equal total portfolio assets under management; inconsistent totals make the equality constraints infeasible. The example does not provide data, a solved allocation, or guidance on checking feasibility and covariance estimates. Its return term is presented as a risk-adjusted objective, so users should distinguish that formulation from pure variance minimization subject to hard return constraints.

Key ideas

  • Stacking all portfolio weights creates a single decision vector for joint optimization.
  • Asset totals, portfolio assets under management, and target returns can be expressed as linear equalities.
  • Relative asset caps can be rewritten as linear inequalities in the portfolio weights.
  • A block-diagonal covariance matrix represents separate portfolio variance terms in a combined objective.
  • The constraints require total asset holdings and total portfolio assets under management to agree.

Tags

Full text
# Portfolio/sub-portfolio optimization


# Portfolio/sub-portfolio optimization












I have a finite amount of 26 assets, the total amount of these assets needs to be allocated to 9 portfolios. Each portfolio has its own required return which needs to be met, using a min-variance approach.

This is the optimization problem, subject to: - Each asset should be 100% allocated - Asset 1 and 2 are held constant (the sub-portfolios already holds some amount of these 26 assets) - Asset 3 must not weigh more than 20% within each portfolio - Asset 4 must not weigh more than 25% within each portfolio - Each portfolio has a given AuM which the new allocation must equal - No assets can have negative weight (long-only)

I have a dataset holding the 26 assets, expected returns and a covariance matrix.

I am able to optimize a single portfolio, the trick is when i want to optimize across the 9 portfolios. I have been looking into quadratic programming as a means to this problem, if anyone are able to point me in the right direction, maybe some useful links or something. I am coding in Python, so Python solutions is a plus, but i also have access to R and MatLab.

## Answer by Attack68 (score 2)

https://quant.stackexchange.com/a/49601

## Identifying your variables:

You will need a weight for each of the 26 assets in each of the 9 portfolios. Suppose you take each portfolio in turn and create a stacked vector:

$\mathbf{w} = [w_{1,1} \; .. \;w_{1,26} \; w_{2,1} \; .. \; w_{2,26} \; .. \;w_{9,26}]$

## Equality constraints:

- Each weight of an asset cross section has to sum to the holding, $W_j$:

$$ \sum_{i=1}^9 w_{i,j} = W_j \quad \forall \quad \text{assets }j $$

This is also easily expressed in matrix-vector notation,e.g. for a 2 portfolio x 3 assets:

$$ \begin{bmatrix} 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 \end{bmatrix} \mathbf{w}= \begin{bmatrix} W_1 \\ W_2 \\ W_3 \end{bmatrix} $$

- Each portfolio has a specified AuM:

$$ \begin{bmatrix} 1 & 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 \end{bmatrix} \mathbf{w}= \begin{bmatrix} AUM_1 \\ AUM_2\end{bmatrix} $$

Note these two constraints assume: $ \sum_{asset} W_{asset} = \sum_{portfolio} AUM_{portfolio} $

- Some portfolios have required (achievable) returns, e.g. portfolio 2: $$ \begin{bmatrix} 0 & 0 & 0 & u_1 & u_2 & u_3 \\ \end{bmatrix} \mathbf{w} =U_2 $$

## Inequality constraints:



- Asset 4 cannot weight more than 25% in portfolio 2:

$$ w_{2,2} \leq 0.25 \left ( w_{2,1} + w_{2,2} + w_{2,3} \right ) $$

$$ \begin{bmatrix} 0 & 0 & 0 & -0.25 & (1-0.25) & -0.25 \\ \end{bmatrix} \mathbf{w} \leq 0 $$

## Objective Function

I suppose you are now doing the traditional Variance-Return optimisation

$$ f(w) = \frac{1}{2}\mathbf{w^T 2\Sigma_p w} - \lambda \mathbf{u^T_p} \mathbf{w} $$

where $$ \mathbf{\Sigma_p} = \begin{bmatrix} \Sigma & 0 & ... & 0 \\ 0 & \Sigma & .. & 0 \\ ... \\ 0 & 0 & .. & \Sigma \end{bmatrix} $$

and $$ \mathbf{u^T_p} = [ \mathbf{u^T u^T .. u^T ]} $$

You could also tweak the $\lambda$ to impact individual portfolios rather than being a global risk-aversion parameter.

## Implementation

You can use the library cvxopt (https://cvxopt.org/userguide/coneprog.html#quadratic-programming) in python to solve this and the above formulations are organised to be directly compatible with the format.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.