Lecture / Ponencia xx Solving the Portfolio Optimization Problem under realistic constraints R. Kizys1, A.A. Juan2, B. Sawik3 and A. Linares2 1 University of Portsmouth, Department of Economics and Finance, UK, renatas.kizys@port.ac.uk 2 IN3 – Open University of Catalonia, Department of Computer Science, Spain, {ajuanp, alinaresz}@uoc.edu 3 AGH University of Science & Technology, Faculty of Management, Department of Applied Computer Science, Poland, b_sawik@cal.berkeley.edu Abstract A hybrid algorithm for realistic portfolio optimization is introduced in this paper. Our matheuristic algorithm combines quadratic programming with a metaheuristic framework in order to solve complex variants of the meanvariance portfolio optimization problem. Thus, it is able to quickly generate near-optimal asset-allocation solutions –in terms of minimum risk for a given expected return rate– under realistic conditions. These realistic conditions include the well-known cardinality, pre-assignment, and quantity constraints. The algorithm proceeds in two steps. First, a feasible initial solution is constructed by allocating portfolio weights according to the individual return rate. Secondly, an iterated local search process gradually improves the initial solution throughout an iterative combination of a perturbation stage and a local search stage, which includes quadratic programming optimization. According to the experimental results obtained, our approach is competitive when compared against existing state-of-theart approaches, both in terms of the quality of the best solution generated as well as in terms of the computational times required to obtain it. 1. Introduction Mean-variance optimization has become the workhorse model for portfolio selection since Markowitz (1952). An important assumption underlying this model is that investors are concerned about both the expected returns from their investment and the risk from that investment, where risk is defined as the variance of future returns. By optimally allocating appropriate weights to imperfectly correlated risky assets, investors can reduce the variance of future portfolio returns and thus diversify their investment. An optimal 1 allocation of assets produces the so-called unconstrained efficient frontier (UEF), which consists of a 2D plot representation of portfolio configurations with a minimum degree of risk (horizontal axis) for each level of expected return (vertical axis) (Figure 1). Figure 1: 2D plot representing the UEF. Since the mean-variance portfolio formulation, an enormous amount of papers have been published extending or modifying the basic model in three directions (Sawik 2013). The first path goes to simplification of the amount or the type of input data. The second path focuses on the introduction of an alternative measure of risk. The third path involves incorporation of the additional criteria and constraints. Traditional optimization methods include, among others, linear programming (Mansini et al. 2014) and also quadratic programming (Sawik 2012). Unfortunately, the complexity of the meanvariance model for portfolio optimization increases dramatically upon adding additional constraints that are needed to provide a realistic representation of the investor’s portfolio choice, which reduces the efficiency of exact methods in other than small-size instances. Metaheuristic approaches have been proposed in the literature as a way to surpass these limitations (Maringer 2005). This paper focuses on the single-period version of the so-called constrained mean-variance portfolio optimization problem. We will assume that all assets are risky assets (stocks). However, the solving approach introduced here could be also used for similar optimization problems regarding commodities, futures, options and swaps. The objective function is the portfolio variance, which is considered to be the measure of risk on investment in the portfolio. It is obtained as a weighted average of return co-variances between each pair of assets included in the portfolio. The decision problem involves minimizing the portfolio variance while ensuring a return level not inferior to the one required by the investor. Portfolio weights add up to one and are 2 constrained to take on non-negative values only. Real-world portfolio selection problems may involve additional constraints. The adoption of an initial solution that is based on a well-chosen criterion makes our solver more flexible when solving tight instances. Also, the rate of return on an individual asset is used as a main criterion to construct the initial solution. It is worth noting that this criterion provides the best possible solution in terms of guarantying feasibility of the requested portfolio return –i.e., if this initial solution is not feasible, then the problem has no feasible solution. By contrast, in most of the existing approaches, an initial solution is randomly drawn and, hence, the feasibility of these initial solutions cannot be guaranteed. Finally, our solver features several efficient sub-procedures that seek to avoid getting trapped into a local optimum. For a comprehensive overview of the formulations of the portfolio selection problem, see Di Tollo and Rolli (2008). 2. Formal description of the problem A set of n assets is given by the market, A a1 , a2 ,..., an , where: i 1, 2,..., n , ai has a known expected return, ri 0 . i, j 1, 2,..., n , the pair ai , a j has a known expected risk index, ij ji R . Expected return constraint: a user-provided value, R 0 , represents the minimum expected return from the investment. A portfolio is a vector X x1 , x2 ,..., xn such that each xi represents the fraction of the total budget invested in asset ai , i.e., 0 xi 1 and n x i 1 i 1. i 1, 2,..., n , zi 1 otherwise. Cardinality constraint: the number of assets in the portfolio, if xi 0 (i.e., ai in portfolio) and zi 0 n z i 1 i , is bounded by user-defined values, kmin and kmax . Quantity constraints: for each asset ai , its associated quantity in the portfolio, xi , is bounded by user-defined values, i and i . Pre-assignment constraints: the user can pre-select certain assets to be included in the portfolio. i 1, 2,..., n , pi 1 if ai is preassigned in portfolio (i.e., xi 0 ) and pi 0 otherwise Then, the problem consist in selecting the optimal combination of fractions of each asset, so that the overall variance (risk) is minimized while satisfying all the aforementioned constraints. More formally: 3 n n min f ( X ) ij xi x j i 1 j 1 n subject to: rx i 1 i i n x i 1 i R (1) 1 (2) n kmin zi kmax (3) 0 xi 1 , i 1, 2,..., n (4) i zi xi i zi , i 1, 2,..., n (5) xi zi pi , i 1, 2,..., n (6) zi 0,1 , i 1, 2,..., n (7) i 1 3. Solving Approach The proposed matheuristic makes use of an Iterated Local Search (ILS) framework (Lourenço et al. 2003). ILS is a conceptually simple yet powerful metaheuristic that has proven to be very efficient in solving complex combinatorial optimization problems. The underlying idea behind ILS is to narrow the search for candidate local optimal solutions returned by some embedded algorithm, typically a local search heuristic. At some stages of the ILS, a quadratic programming optimizer is called as a local search in order to improve the investment levels assigned to each of the assets in the current portfolio. Figure 2 provides a high-level description of our approach (the low-level details are not included here due to space limitations). 01 Procedure Matheuristic(inputs) 02 baseSol <- generateInitialSolution % generate a feasible solution 03 bestSol <- baseSol 04 while {elapsedTime <= maxTime} do % modify portfolio configuration without losing feasibility 05 newSol <- perturbate(baseSol) % improve assets levels via quadratic programming 06 newSol <- localSearch(newSol) 07 if {risk(newSol) < risk(baseSol)} then 08 baseSol <- newSol 09 if {risk(newSol) < risk(bestSol)} then 10 bestSol <- newSol 11 end if 12 end if 13 % (optional) include an acceptance criterion 14 end while 15 return bestSol 16 end procedure Figure 2: Overview of our matheuristic approach. 4 4. Computational experiments The algorithm has been implemented as a Java application. A standard personal computer, Intel Core i5 CPU at 3.2 GHz and 4 GB RAM with Linux Ubuntu, was used to perform all tests. In this research, we experiment with sets of stock market data already used in previous studies by MoralEscudero et al. (2006) and Di Gaspero et al. (2011). The data set comprises constituents of five stock market indices, Hang Seng (Hong Kong), DAX 100 (Germany), FTSE 100 (United Kingdom), S&P 100 (United States) and NIKKEI 225 (Japan). Figure 3 shows a comparative among different approaches, where gap refers to the gap with respect to the unconstrained problem –lowerbound for the optimal solution of the constrained problem. Notice that our algorithm is able to outperform the other approaches in 4 out of the 5 sets. Figure 3: Visual comparison among different approaches. 5. Conclusion We have proposed hybrid algorithm, combining a metaheuristic framework with quadratic programming, to efficiently deal with the constrained meanvariance optimization problem. The specific constraints we use in our tests include the cardinality and quantity constraints. The ensuing complexity of the problem rules out closed-form solutions and conventional optimization methods. Specifically, the cardinality and quantity constraints render the problem computationally expensive to solve real-world instances. 5 Therefore, the use of metaheuristics –that handle such problems more flexibly and efficiently– is needed. According to the computational experiments, our solver outperforms –in terms of average percentage loss– some of the most recent approaches in the literature. Acknowledgements This work has been partially supported by the Spanish Ministry of Economy and Competitiveness (grant TRA2013-48180-C3-3-P) and FEDER. Likewise we want to acknowledge the support received by the Department of Universities, Research & Information Society of the Catalan Government (Grant 2014-CTP-00001) and by the NCN grant (6459/B/T02/2011/ 40). References Di Gaspero, L., Di Tollo, G., Roli, A., and Schaerf, A. (2011). Hybrid metaheuristics for constrained portfolio selection problems. Quantitative Finance 11(10), 1473–1487. Di Tollo, G., and Roli, A. (2008). Metaheuristics for the portfolio selection problem. International Journal of Operations Research, 5(1), 13–35. Lourenço, H.R., Martin, O.C., and Stützle, T. (2003). Iterated local search. In: Handbook of Metaheuristics, 321–353. Kluwer. Norwell, MA. Mansini, R., Ogryczak, W., and Speranza, M.G. (2014). Twenty years of linear programming based portfolio optimization. European Journal of Operational Research, 234(2), 518–535. Maringer, D. (2005). Portfolio management with heuristic optimization. Springer. Markowitz, H.M. (1952). Portfolio selection. Journal of Finance, 7(1), 77–91. Moral-Escudero, R., Ruiz-Torrubiano, R., and Suárez, A. (2006). Selection of optimal investment portfolios with cardinality constraints. In: IEEE Congress on Evolutionary Computation, 2382–2388. Sawik, B. (2012), Bi-Criteria Portfolio Optimization Models with Percentile and Symmetric Risk Measures by Mathematical Programming. Przeglad Elektrotechniczny, 88(10B), 176–180. Sawik, B. (2013). Survey of multi-objective portfolio optimization by linear and mixed integer programming. In: Applications of Management Science, 16, 55–79. 6