Portfolio optimization

Assume that we have one unit of capital and \(n\) assets to invest on. The \(i\) th asset has an expected return rate \(\xi_i\ge 0\). Our goal is to find a portfolio with the minimal risk such that the expected return is no less than \(\lambda\). This problem can be formulated as

\[\begin{equation} \begin{array}{l} \min_x ~ \frac{1}{2} x^\top Q x, \\ \text{subject to}~ x\ge0, \sum_{i=1}^m x_i\le 1,\, \sum_{i=1}^m\xi_i x_i\ge \lambda, \end{array} \end{equation}\]

where \(Q\) is an \(n\) by \(n\) risk matrix. We solve the problem with TMAC by using three operator splitting method.

Data preparation

We consume \(Q\) in matrix market format. You can easily modify the code to deal with other types of matrices.

Usage

In the bin folder, the executable file tmac_3s_portfolio minimizes the Huber loss:

The usage for ./bin/tmac_3s_portfolio is:
--------------------------------------------------------------
./bin/tmac_3s_portfolio [options]
-data      <data file with matrix market format, size: n x n>
-label     <label file with matrix market format>
-nthread   <total number of threads, default is set to 2>
-epoch     <total number of epoch, default is set to 10>
--------------------------------------------------------------

Example

You can run the following command in the test directory to minimize the Huber loss for the large dense dataset:

./bin/tmac_3s_portfolio -data ./data/port_Q.mtx -label ./data/port_eps.mtx -epoch 100 -nthread 2 -lambda 0.02

Note

The datasets are not included in the source code, but you can download them from here.

You can expect to get output similar to the following:

Parameter settings:
---------------------------------
Problem size:               1000
TMAC step size:            0.5
Operator step size:         0.0018
Use controller:             false
---------------------------------
Computing time is: 0.0860848
Objective is: 6.09765e-05