# LION COMMUNITY USAGE CASE

### Asset portfolio selection in finance.

### The Portfolio Selection Problem: the "clean" classic approach.

The problem consists of selecting a set of assets and choosing the share of investment dedicated to each asset,
in order to follow the investor's desires regarding return and risk.

The classic and seminal approach to this problem is due to Markowitz (1952). Given

where

*w*is the vector of shares invested in each asset,

*r*the vector of the expected returns and Σ the covariance matrix, the problem can be stated as the following two-objectives optimization (maximize return and minimize risk): :

### The Pareto Efficient Frontier.

A portfolio A is dominated by another portfolio A' if A' has a greater expected gain * and * a lesser risk than A.
If no portfolio dominates A, A is a Pareto-optimal portfolio.

The set of Pareto-optimal * returns and risks * is called the ** Pareto Efficient Frontier for the Markowitz Portfolio selection problem**.
The figure shows a comparison between the Efficent Frontier determined by
LIONoso (left) and the performance of an equivalent number of
randomized portofolios (right),
for a simple problem with four assets. Risk is on the X axis, return on the Y axis. The advantage of using optimization is obvious.

Asset | Expected Return | Covariance | |||

1 | 15 | 400 | 266.8 | 105.84 | 9 |

2 | 18 | 266.8 | 529 | 47.334 | 117.208 |

3 | 8.50 | 105.84 | 47.334 | 96.04 | 22.05 |

4 | 12 | 9 | 117.208 | 22.05 | 225 |

### The "dirty" real-world: constraints and effects of errors on estimating returns and variances.

The "clean" Markowitz portfolio optimization can be routinely solved by Quadratic Programming. What makes the problems more difficult and challenging are additional contraints and modifications of the objective function.

In this real-world context the issue is not so much optimizing, but ** identifying a proper objective function
to be optimized**, which takes all rigid and soft constraints into account, and which is robust with respect to errors
in estimating returns and variances. ** This is a case for combining Learning and Optimization**, as advocated
by the LION (Learning and Intelligent OptimizatioN) approach.

The additional constraints are needed in order to follow the investor's preferences or, in some cases, the law limits which are imposed to avoid excessive exposure on specific assets. Some realistic constraints are for example:

- Cardinality constraints: the number of assets included in the portfolio is bounded. We have a vector
*z*of binary decision variables such that if asset i is in the solution, then*z*= 1. The bound on the number of assets is given by two values_{i}*k*and_{min}*k*._{max} - Quantity constraints: the quantity of each asset
*i*is bounded by two values ϵ_{i}and δ_{i} - Pre-assignements: it can be that certain assets are pre-asigned in the portfolio. This condition is given trough a binary vector
*p*, such that*p*= 1 if the asset_{i}*i*is pre-assigned in the portfolio.

The problem becomes more complicated, and this makes LIONoso more competitive with respect to
more traditional optimization schemes, for example ** contraints of arbitrary complexity can be taken
into account (in an heuristic manner), the investor preferences can be learned in an interactive manner ** while the selection scheme is running,
please contact us if you are interested in the details of this usage case.

### Parametric models in LIONoso: a realistic portfolio with 225 assets

Specific values of the number of assets, together with their returns and covariances, determine an**instance**of the generic portfolio optimization problem. Configuring an instance in LIONoso requires the following steps:

- Loading a parametric model which is prepared to accept a configuration table (like the
**"Stock portfolio planning"**model that you find in the**"Test functions"**folder. A warning message will remind you that the model has to be configured by connecting it to a data source before it can be used. - Loading a table containing return and covariance data from a CSV (like the portfolio225 table in the figure).
- Connecting the table to the model to complete its configuration. An arrow will appear and the warning message will disappear: you model is configured and ready to be used.

Now that the stock portfolio model is configured with data about specific stocks, you can connect it to the RSO optimizer tool. In the RSO properties window, specify that you want to minimize risk and maximize return (unless you are masochistic). Determine how many seconds to dedicate to search for each solution (in our example 3 seconds) and click start. The table with Pareto-optimal points and additional information (like values of the sharing weights w) will be produced. When compared with values of the efficient (Pareto-optimal) frontier derived by other researchers on the same 225 assets benchmark problem, the values obtained by LIONoso are actually slightly better (possibly because of a higher precision used in our optimization software). The comparison is shown in the figure below.

The above comparison is done quickly by combining different tools from the LION workbench: a filter to keep only the two risk and return columns, and a Merge table tool to create a single table with the benchmark data and our results.

**References:**

Markowitz, H.M. (March 1952). "Portfolio Selection". The Journal of Finance 7 (1): 77-91

Kaplan, P.D. (1998), "Asset Allocation Models Using the Markowitz Approach", technical report.

L. Di Gaspero, G. di Tollo, A. Roli, A. Schaerf. (2011) "Hybrid Metaheuristics for Constrained Portfolio Selection Problems". Quantitative Finance, Vol. 11, N.10

Portfolio225 is derived from the OR-Library maintained by J. E. Beasley. Their test problems are used in:

Chang, T.-J., Meade, N., Beasley, J.E. and Sharaiha, Y.M., "Heuristics for cardinality constrained portfolio optimisation" Comp. and Opns. Res. 27 (2000) 1271-1302.