Mean-Variance Trade-Off in Portfolio Optimization

LP and QP > Applications > Back | Portfolio Optimization | Next

Portfolio optimization with sign constraints

We return to the portfolio optimization problem. This time, we assume that shorting is not allowed. In other words, we can only invest in any given asset, or decide not to invest; but we can't borrow and hold any negative position. The problem we have introduced now takes the form

 min_x : x^T Sigma x ~:~ hat{r}^Tx = mu, ;; x ge 0,

where mu is our target for the nominal return, and Sigma is a positive semi-definite matrix that contains information about the uncertainty on the assets’ returns (see here). The above is a QP.

CVX implementation
cvx_begin
    variable x(n,1);
    minimize( x'*S*x );
    subject to
       rhat'*x == mu;
       x >= 0;
cvx_end

Other constraints

We can add other linear or affine inequality constraints to the problem.

Sector bounds

For example, we can put upper bounds on some elements of x, to limit the amount of investment in any single asset. We can also require that the total sum invested in a given sector (corresponding to say, the first k assets) does not exceed a fraction alpha of the total sum invested. This can be modeled by

 min_x : x^T Sigma x ~:~ hat{r}^Tx = mu, ;; x ge 0, ;; sum_{i=1}^k x_ i le alpha left( sum_{i=1}^n x_i right).

Again, the above is a QP, with just one more affine inequality.

Diversification

We can also impose some diversification constraints. For example, we may impose that no group of k (with k<n) assets contain more than 80% of the total invested. We write this as

  s_k(x) := sum_{i=1}^k x_{[i]} le 0.8 sum_{i=1}^n x_i,

where x_{[i]} is the i-th largest component of x, so that s_k(x) is the sum of the k largest elements in x. The function s_k(x) is convex, since it is the point-wise maximum of linear functions (hence it is polyhedral):

  s_k(x) = max_{(i_1,ldots,i_k) in {1,ldots,n}^k} : x_{i_1} + ldots + x_{i_k}.

The function s_k is implemented in CVX by invoking sum_largest.

CVX implementation
cvx_begin
    variable x(n,1);
    minimize( x'*S*x );
    subject to
       rhat'*x == mu;
       x >= 0;
       sum_largest(x,10) <= 0.8*sum(x);
cvx_end

The above expression for s_k simply states that the function s_k is the pointwise maximum of the C_{n,k} (n choose k) linear functions obtained by choosing any subset of k indices in {1,ldots,n}. For example, with k=2 and n=3:

 s_2(x) = max(x_1+x_2,x_2+x_3,x_3+x_1).

Since s_k is polyhedral, we can definitely represent the constraint s_k(x) le 0.8 sum_i x_i as a finite set of affine inequality constraints, that is, a polyhedron. However the list of constraints is huge: for n=100, k=10, we have to list more than 10^{13} constraints!

A more efficient way is based in the following expression, proven here:

  s_k(x) = min_t : kt + sum_{i=1}^n max(0, x_i-t).

In this form, the diversification constraint can be expressed as: there exist a scalar t and a n-vector u such that

     	kt + sum_{i=1}^n u_i le 0.8 sum_{i=1}^n x_i, ;; u ge 0, ;; u ge x- t mathbf{1}.

In the above, mathbf{1} is the vector of ones in mathbf{R}^n. Here, t,u are additional variables that allow a QP representation with a moderate number of variables and constraints:

 	min_{u,t,x} : x^TSigma x ~:~  	begin{array}[t]{l}     	  hat{r}^Tx = mu, ;; x ge 0,  		kt + displaystylesum_{i=1}^n u_i le 0.8 displaystylesum_{i=1}^n x_i,  	  u ge 0, ;; u ge x- t mathbf{1}.                   	end{array}

The lesson here is that a polyhedron in a n-dimensional space, with an exponential number of facets, can be represented as a polyhedron in a higher dimensional space (in our case, with dimension 2n+1), with a moderate number of facets (precisely 2n+1 facets). By adding just a few dimensions to the problem we are able to deal (implicitly) with a very high number of constraints.