J. Indones. Math. Soc. Vol. No. , pp. 282Ae291. A MULTI-OBJECTIVE FIREFLY ALGORITHM FOR PRACTICAL PORTFOLIO OPTIMIZATION PROBLEM INDANA LAZULFA1 Informatics Engineering. Hasyim AsyAoari University Jombang. Indonesia indanazulf@gmail. Abstract. Portfolio optimization is the process of allocating capital among a universe of assets to achieve better risk return trade-off. Portfolio optimization is a solution for investors to get the return as large as possible and make the risk as small as possible. Due to the dynamic nature of financial markets, the portfolio needs to be rebalanced to retain the desired risk-return characteristics. This study proposed multi objective portfolio optimization model with risk, return as the objective function. For multi objective portfolio optimization problems will be used mean-variance model as risk measures. All these portfolio optimization problems will be solved by Firefly Algorithm (FA). Key words and Phrases: Portfolio optimization, mean-variance, multi-objective, firefly algorithm. Abstrak. Optimisasi portofolio merupakan proses mengalokasikan kapital diantara kumpulan saham untuk meraih risiko-return yang lebih baik. Optimisasi portofolio juga solusi untuk investor untuk mendapatkan return sebesar mungkin dan risiko sekecil mungkin. Melihat dinamisnya pasar keuangan, portfolio membutuhkan keseimbangan yang menyesuaikan karakteristik risiko-return yang diinginkan. Penelitian ini bertujuan merumuskan model optimisasi portofolio multi-objektif, dengan risiko dan return sebagai fungsi objektifnya. Untuk masalah optimisasi portofolio multi-objektif ini menggunakan model Mean-Varian sebagai ukuran risiko. Semua masalah optimisasi portofolio ini akan diselesaikan dengan Algoritma Firefly (FA). Kata kunci: Optimisasi portofolio, mean-varian, multi-objektif, algoritma firefly. Introduction Arguably, one of the most studied topic in the history of mathematics is the Optimization is a branch of applied mathematics that derives its 2000 Mathematics Subject Classification: 62P05 Received: 01-11-2018, accepted: 01-04-2019. A Firefly algorithm for portfolio optimization importance both the wide variety of its applications and from the availability of efficient algorithms. Mathematically, it refers to the minimization or maximization of a given objective function of several decision variables that satisfy functional Optimization models play an increasingly important role in financial Many computational finance problems ranging from asset allocation to risk management, from option pricing to model calibration can be solved efficiently using modern optimization techniques. Modern finance has become increasingly technical, requiring the use of sophisticated mathematical tools in both research and practice. Many find the roots of this trend in the portfolio selection models and methods of this trend in the portfolio selection models and methods described by Markowitz in the 1950Aos . Markowitz . provided a foundational framework of mean-variance optimization for constructing an optimal portfolio. A Portfolio is a set of finance assets such as bonds, stocks, and cash equivalents. Portfolios are held directly by investors and/or managed by financial professionals. Portfolio optimization (PO) is the process of allocating capital among a universe of assets to achieve better risk return trade-off. PO is a solution for investors to get the return as large as possible and make the risk as small as possible. But in fact, the desire to get a high return must go along with a high Due to the dynamic nature of financial markets, the portfolio needs to be rebalanced to retain the desired risk-return characteristics. One of the most used model in PO is the Mean-Variance Model. This model determines the composition of a portfolio asset or allocates many assets in order to minimize the risk while achieving a predetermined level of expected return. The classical mean-variance model relies on the perfect knowledge of the expected returns of the assets and the variance-covariance matrix . Using this, we determine an optimal asset allocated according to mean-variance model. Fact, in arranging a portfolio, we are not only focuses on minimizing risk or maximizing return, but also some constraints that are come along with it like buy-in thresholds and cardinality constraints. In the previous study . , three multi-objective evolutionary algorithms are adapted for the proposed models. A tri-objective portfolio selection model is proposed with risk, return and transaction costs as objectives. Meghwani and Takur . used three different models with different risk measures - variance. VaR (Valueat-Ris. and CVaR (Conditional Value-at-Ris. Recently. Lazulfa et al. solved Portfolio Optimization (PO) problem using simulated annealing (SA) algorithm. The performance of the tested SA was good enough to solve single objective using mean-variance as risk measure. The result provided by SA for single objective case is near optimal solution. Besides, the purpose of minimizing the objective function still had not satisfied, because value of the objective function still large. In this study, we use one of nature-inspired algorithm called Firefly Algorithm (FA) to solve PO problem. FA was based on the flashing patterns and behavior of fireflies. FA wa first developed by Xin-She Yang in late 2007 and published in 2008 . Based on previous study . , a total number of 76 publications are examined in years from 2006 to April 2017. Distribution of Swarm Intelligence techniques adopted for Portfolio Optimization (PO) is demonstrated in those paper Lazulfa . Particle swarm optimization (PSO) algorithm is the most adopted swarm based methodology for PO . %) while firefly algorithm (FA) has 4% applications in portfolio optimization literature. Since single objective function cannot be optimal with SA during portfolio optimization in previous paper . , so in those paper there is no result for multi objective function. In the other paper . they used genetic algorithm (GA) to solve PO problem. We can see good result from good distribution along the Pareto Front. And then minimizing objective function in those paper is generational distance (GD). This paper proposes a two-objective model in risk and returns objectives. The proposed model offers an additional advantage to decision makers or investors so that that they can examine the trade-offs between risk and return while choosing a portfolio from the efficient frontier. In this paper, we will see different result and comparing performance of portfolio selection problem using some Swarm Intelligence like SA. GA from other paper and we try FA to solve this PO problem. All optimization problem will be solved by FA. We also present some result of simulation like the tested metaheuristic algorithm, some details of implementation and computational experiments. Models For Portfolio Optimization In this section, we briefly present one of the PO model . ean-varianc. and additional constraints for realistic portfolio management . uy-in threshold and cardinalit. The theory of optimal selection of portfolios was developed by Harry Markowitz in the 1950Aos. His work formalized the diversification principle in portfolio selection and, as mentioned above, earned him the 1990 Nobel prize for Economics . Here we give a brief description of the model and relate it to Quadratic Programming (QP). In the Mean-Variance (M-V) model, the portfolio risk is measured by the variance of stock prices. In general, covariance matrix among individual stocks and expected return of stocks are estimated using the historical data . M-V model was developed by Markowitz in the 1952. This model is also called MarkowitzAos model . MarkowitzAos theory of mean-variance (M-V) optimization provides a mechanism for the selection of portfolios of securities . r asset classe. in a manner that trades off the expected returns and the risk of potential portfolios. We use this M-V model from previous paper . in this section. Suppose we have a history of percentage returns, over m time periods, for each group of n assets . uch as shares, bonds, etc. We can use this information as a guide to future investments. As an example, consider the following data for n assets over m periods . The expected portfolio return is given by rEi yi j = 1, 2, . , m A Firefly algorithm for portfolio optimization Table 1. Periodly rates of return on n assets Asset 1 Asset 2 Period 1 Period 2 a a a Period m Asset n a The risk associated with particular portfolio is determined from variances and covariances that can be calculated from the history of returns rij . The variance of asset i is j=1 . ij Oe rEi ) . Ei = while the covariance of assets i and k is j=1 . ij Oe rEi ). kj Oe rEk ) Eik = . The variance of the portfolio defined by the investment fractions y1 , . , yn is V = Ei2 yi2 2 nOe1 Eij yi yj i=1 j=i 1 where the variance-covariance matrix Q is defined by E11 E12 A A A E1n E21 E22 A A A E2n Q= . En1 En2 a . Enn and Eik = Aik Ei Ek and Aik is correlation coefficient of asset i . = 1, 2, . , . with asset k . = 1, 2, . , . Generally, total return isnAot same in each period. R1 6= R2 6= A A A 6= Rm . particular, looking at the history of m time periods of the risk-free portfolio, we would like y1 , y2 . A A A , yn to satisfy . 1j Oe rE1 )y1 . 2j Oe rE2 )y2 A A A . nj Oe rEn )yn = 0 j = 1, 2, . , m. But if we cannot satisfy . exactly then the next best thing would be to make the residuals of the equations as small as possible. Let A denote the m y n matrix whose elements aji are defined by aji = rij Oe rEi . Then . is equivalent to the system Ay = 0 and we want to choose y to minimize some norm kAyk. It is convenient to use the two-norm kAyk2 = yT AT Ay Lazulfa By the rules of matrix multiplication the diagonal elements of AT A are . ij Oe rEi )2 , for i = 1, 2, . , n. The off-diagonal . , . -th element of AT A is given by aji ajk = . ij Oe rEi ). kj Oe rEk ). Comparison with . shows that the i-th diagonal element of AT A is mEi2 and that the . , . -th off-diagonal is mEik . Hence AT A = mQ where Q is given by . Since the multiplying factor is irrelevant, we see that the problem of minimizing the risk function yT Qy is equivalent to minimizing the two-norm of the residuals of the system . Multi Objective Optimization Problem Optimization problem can involve more than one objective function. The optimization problem is called multi objective optimization. Generally, we can write multi objective problem below Minimize/Maximize fs . subject to gj . Ou 0 hc . = 0 O xi O xmax s = 1, 2, . j = 1, 2, . c = 1, 2, . i = 1, 2, . , n . In optimization problem . , there are some S objective function that will be minimized or maximized. Maximizing problem will be minimizing problem after multiplied with Oe1. So we have the same target of each objective function, which is minimizing. The solution which is satisfy constrained is called feasible solution. And the set of feasible solution is called feasible region. The set of optimal solution in feasible region is called Pareto optimal set or Pareto Front. One of the most studied method in multi-objective optimization is the weight sum method. This method is give a weight scale for each objective function which will be solved. After that, the objective function will be transformed to single-objective function. Choosing this weighting parameter is depend on priority level of each objective We can write multi-objective problem such as. Minimize s=1 ws fs . subject to gj . Ou 0 j = 1, 2, . = 0 c = 1, 2, . O xi O xmax i = 1, 2, . , n where ws OO . , . is the weight for s-th objective function and s=1 ws = 1. The weight method is one of simple method to solve multiobjective optimization problem. But this method only can use for convex objective function, like M-V model and MAD model. A Firefly algorithm for portfolio optimization A multi-objective portfolio optimization will optimize two objective function, to minimize the risk and to maximize the return. Hence the M-V modelAos multi objective problem is Minimize V = yT Qy Maximize R = rET y subject to eT y = 1 zi ymin O yi O zi , i = 1, 2, . , n i = 1, 2, . , n i OO 0, 1, i=1 i . By using weight sum method, we get the multi objective problem of M-V model such as Minimize w1 yT Qy Oe w2 rET y subject to eT y = 1 zi ymin O yi O zi , i = 1, 2, . , n . OO i=1 zi = K where w1 and w2 is a weighting parameter which has given and w1 w2 = 1. Firefly Algorithms (FA) Firefly Algorithm (FA) was first developed by Xin-She Yang in late 2007 and published in 2008. FA was based on the flashing patterns and behavior of fireflies. There are about 2000 firefly species, and most fireflies produce short, rhythmic The pattern of flashes is often unique for a particular species. The flashing light is produced by a process of bioluminescence. However, two fundamental functions of such flashes are to attract mating partners . and to attract potential prey . In addition, flashing may also serve as a protective warning mechanism to remind potential predators of the bitter taste of fireflies. The rhythmic flash, the rate of flashing, and the amount of time between flashes form part of the signal system that brings both sexes together. Females respond to a maleAos unique pattern of flashing in the same species. Now we can idealize some of the flashing characteristics of fireflies so as to develop firefly-inspired algorithms. For simplicity in describing the standard FA, we now use the following three idealized rules . A Attractiveness is proportional to a fireflyAos brightness. Thus for any two flashing fireflies, the less brighter one will move to the brighter one. The attractiveness is proportional to the brightness, both of which decrease as their distance increases. If there is no brighter one than a particular firefly, it will move randomly. A All fireflies are unisex, so one firefly will be attracted to other fireflies, regardless of their sex. A The brightness of a firefly is affected or determined by the landscape of the objective function. Lazulfa Figure 1. Pseudocode of the firefly algorithm (FA) In the firefly algorithm, there are two important issues: the variation of light intensity and formulation of the attractiveness of a firefly is determined by its brightness, which in turn is associated with the encoded objective function. The distance between two fireflies i and j at xi and xj , respectively Cartesian rij = kxi Oe xj k = t . i,k Oe xj,k )2 where xi,k is the kth component of the spatial coordinate xi of ith firefly. According to . , the movement of a firefly i attracted to another, more attractive . firefly j is determined by = xti 0 eOerij . tj Oe xti ) ti where the second term is due to the attraction. The third term is randomization, with being the randomization parameter, and i is a vector of random numbers drawn from a Gaussian distribution or uniform distribution. It is worth pointing out that . is a random walk. We use LeAvy flights . for Firefly Algorithm (FA). The parameter characterizes the variation of the attractiveness, and its value is crucially important in determining the speed of the convergence and how the FA behaves. In theory. OO . ,O), but for most application it typically varies 001 to 1000 . Portfolio Optimization Result for Multi Objective In the multi-objective portfolio optimization, there are two goals. to minimize the risk and to maximize the return. The weight w1 varies from . , 0. 05, . , . and w2 =Oo1 Oe w1 . For one set of weight . 1 , w2 ) will get one set point (E. R) where E = V . So, for 20 sets of weight, we also get 20 sets of point (E. R) at M-V Model. A Firefly algorithm for portfolio optimization We use LQ45 dataset for simulation. If we choose the minimum proportion of asset 01 and the total proportion is 1. The selected asset K, in this simulation is 10, 15 and 20. Figure 2. Pareto front of M-V model LQ45 datasets. K = 10 We had tried about 20 attempts for each 1 set of weight . 1 , w2 ). We get Pareto front of M-V model for LQ45 dataset. Figure 3. Pareto front of M-V model LQ45 datasets. K = 15 Pareto front is formed of 20 sets of weight that produce 20 set of risk (E) and return (R). Pareto front of multi objective mean-variance (M-V) for LQ45 datasets and K = 10 in Figure 2. In Figure 3 we plot pareto front of multi objective M-V model for LQ45 datasets and K = 15. To compute one set of weight . 1 , w2 ), it 8 seconds for each attempt. All attempts take about 514789. 2 seconds. The result of multi objective M-V for LQ45 datasets and K = 20 can be seen in Figure 4. From those pareto front, we can say that the greater value of K then pareto front is shorter. In Figure 2-4 we show these comparisons for mean-variance (M-V) model, where efficient frontier resulted from three different K values are arranged by 1 Oe 3 rows individually. These three groups of data under evaluation reach similar results in mean-variance (M-V) model, at least from our macroscopic point of view. These three figures make a comparison based on different K values. As a result, the efficient frontier or pareto front becomes shorter following increase of K value. Lazulfa Figure 4. Pareto front of M-V model LQ45 datasets. K = 20 Various studies show that PSO can better than GA . And also other conventional algorithms for solving many optimisation problems especially PO. Now we will compare the FA with LeAvy Flight and GA. We also see the result from other paper . After implementing these algorithms using Matlab, we have carried out simulations and each algorithm has been run about 20 times. The results are summarized in the following table . ee Table . Table 2. Comparison of Algorithm Performance To MultiObjective PO Problem Functions V of GA Buy in Threshold Cardinality Multiobjective K = 5 0. Multiobjective K = 10 0. Multiobjective K = 15 0. V of FA We can see . ee Table . that FA with LeAvy Flight is more efficient in finding global optimum. In this term, global optimum is minimize the objective function. The portfolio risk. V of FA is much smaller than GA in all function and computational time also smaller than GA. It is also effective for solving the portfolio optimization problems in different risk measures. FA prominent advantage over other exact search methods is its flexibility and its ability to easily obtain a good solution to a problem where the other deterministic methods cannot achieve optimality in an easy manner. The multiobjective PO problem with FA algorithm in this paper can provide an efficient and convenient tool for investors. With different risk tendencies, investors are able to find efficient frontier based on a fixed amount of assets, as well as a lower bound of each asset to avoid minor investment which might increase transaction costs. A Firefly algorithm for portfolio optimization CONCLUDING REMARKS In this paper we have carried out simulations some function of multi objective portfolio optimization and each algorithm of GA and FA has been run about 20 We then implemented and compared these algorithms. Our simulation results for finding the global optimum of various function s suggest that FA often outperforms GA in terms of risk value. V . This implies that FA with LeAvy Flight is potentially more powerful in solving PO problems or NP problems which will be investigated further in future studies. The FA with LeAvy Flight is efficient enough. A further improvement on the convergence of the algorithm is carryout sensitivity aspect by varying various parameters such as 0 , and . These indicated that a sensible approach and selected parameter was to pool their results and could form important topics for further study. REFERENCES