resolving multi objective stock portfolio optimization problem using genetic algorithm

6
40 Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm Hoklie Department of Industrial Engineering University Al Azhar Indonesia (UAI) Jakarta, Indonesia e-mail: [email protected] Lavi Rizki Zuhal Department of Industrial Engineering University Al Azhar Indonesia (UAI) Jakarta, Indonesia e-mail: [email protected] AbstractPortfolio optimization is an important research field in modern finance. The most important characteristic within this optimization problem is the risk and the returns. Modern portfolio theory provides a well-developed paradigm to form a portfolio with the highest expected return for a given level of risk tolerance. Multi objective portfolio optimization problem is the portfolio selection process that result highest expected return and smallest identified risk among the various financial assets. In this paper, we propose to identify expected return (mean profit) and risk using historical data of stock prices. The downside values of the variance of each stock are considered to be the identified risk in first case. The Value at Risk of each stock that we obtained using parametric and historical simulation methodology are considered to be the identified risk in second case. One of method being widely used lately for optimization need is Genetic Algorithm or GA. This method adapted the mechanism of biology mechanism involving natural selection. With many advantages it has, numerical process of a portfolio optimization in both case are attempted to be coupled with Genetic Algorithm. The values of expected return and risk of each stock will be used as inputs into a fitness function in Genetic Algorithm. Performance evaluation is done by examining the parameters of GA, such as population size, stall generation and number of elitism. Keywords-multi objective portfolio optimization; genetic algorithm; fitness function; expected return; risk I. INTRODUCTION Optimization of asset allocation is complex problem. It is non-linear with many local optima [04]. Genetic Algorithms (GA) is a heuristic random search that is based on the evolutionary process of living beings. In a GA, we encode the solution to the problem that we want to solve as a genome, generate many of those solutions, test them according to a given heuristic (the fitness function), and generate new candidates from the best ranked parents. By repeating this process, the algorithm is able to find good solutions to a wide range of practical problem. The difficulties during the optimization process that is involving the complex formulae and sensitive boundary conditions conceivably can be handled with this method [01]. This paper attempts to apply the advantages of Genetic Algorithm to generate portfolio, with a certain criteria, namely expected return and identified risk. The research methodology of this paper is coding the numerical analysis and optimization method by using MATLAB as language of programming. II. GENETIC ALGORITHM In this paper we develop genetic algorithm code, listed below are Genetic Algorithm components used in this program: Encoding initialization: Real number encoding Cross over: One-point cut cross over Mutation: Gaussian mutation Evaluation: Linear fitness ranking Selection: Roulette wheel Termination criteria: Stall generation Elitism applied The validity of developed program has been verified by comparing to relevant examples. Several cases on optimization that have been done to verify the performance of developed Genetic Algorithm. Binary encoding gives much more stable value of variables that are generated [10]. It is caused by the representation of gene code to the solution have similar tendency meanwhile the real-number encoding give the actual value. However, on the real- number encoding, the result convergent is faster than binary encoding. In conclusion, real number encoding is much widely used to solve the problem. Also, in this study, real number encoding is used. Both verification results inform us that the optimization program based on Genetic Algorithm has quite well performance to be applied to the simple or complex problem, with or without constraint. The next challenge is how to apply developed genetic algorithm code to solve portfolio optimization problem. III. PORTFOLIO OPTIMIZATION The multi objective portfolio optimization problems have received increased interest from researchers with various backgrounds since early 1952 [8]. A modern portfolio theory provides a well-developed paradigm to form a portfolio with the highest expected return for a given level of risk tolerance. The mathematical model of the 978-1-4244-5585-0/10/$26.00 ©2010 IEEE

Upload: hok-lie

Post on 12-Apr-2017

464 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

40

Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

Hoklie Department of Industrial Engineering University Al Azhar Indonesia (UAI)

Jakarta, Indonesia e-mail: [email protected]

Lavi Rizki Zuhal Department of Industrial Engineering University Al Azhar Indonesia (UAI)

Jakarta, Indonesia e-mail: [email protected]

Abstract— Portfolio optimization is an important research field in modern finance. The most important characteristic within this optimization problem is the risk and the returns. Modern portfolio theory provides a well-developed paradigm to form a portfolio with the highest expected return for a given level of risk tolerance. Multi objective portfolio optimization problem is the portfolio selection process that result highest expected return and smallest identified risk among the various financial assets.

In this paper, we propose to identify expected return (mean profit) and risk using historical data of stock prices. The downside values of the variance of each stock are considered to be the identified risk in first case. The Value at Risk of each stock that we obtained using parametric and historical simulation methodology are considered to be the identified risk in second case.

One of method being widely used lately for optimization need is Genetic Algorithm or GA. This method adapted the mechanism of biology mechanism involving natural selection. With many advantages it has, numerical process of a portfolio optimization in both case are attempted to be coupled with Genetic Algorithm.

The values of expected return and risk of each stock will be used as inputs into a fitness function in Genetic Algorithm. Performance evaluation is done by examining the parameters of GA, such as population size, stall generation and number of elitism.

Keywords-multi objective portfolio optimization; genetic algorithm; fitness function; expected return; risk

I. INTRODUCTION Optimization of asset allocation is complex problem. It

is non-linear with many local optima [04]. Genetic Algorithms (GA) is a heuristic random search that is based on the evolutionary process of living beings. In a GA, we encode the solution to the problem that we want to solve as a “genome”, generate many of those solutions, test them according to a given heuristic (the fitness function), and generate new candidates from the best ranked “parents”. By repeating this process, the algorithm is able to find good solutions to a wide range of practical problem. The difficulties during the optimization process that is involving the complex formulae and sensitive boundary conditions conceivably can be handled with this method [01].

This paper attempts to apply the advantages of Genetic Algorithm to generate portfolio, with a certain criteria, namely expected return and identified risk. The research methodology of this paper is coding the numerical analysis and optimization method by using MATLAB as language of programming.

II. GENETIC ALGORITHM In this paper we develop genetic algorithm code, listed

below are Genetic Algorithm components used in this program:

• Encoding initialization: Real number encoding • Cross over: One-point cut cross over • Mutation: Gaussian mutation • Evaluation: Linear fitness ranking • Selection: Roulette wheel • Termination criteria: Stall generation • Elitism applied

The validity of developed program has been verified by comparing to relevant examples. Several cases on optimization that have been done to verify the performance of developed Genetic Algorithm. Binary encoding gives much more stable value of variables that are generated [10]. It is caused by the representation of gene code to the solution have similar tendency meanwhile the real-number encoding give the actual value. However, on the real-number encoding, the result convergent is faster than binary encoding.

In conclusion, real number encoding is much widely used to solve the problem. Also, in this study, real number encoding is used. Both verification results inform us that the optimization program based on Genetic Algorithm has quite well performance to be applied to the simple or complex problem, with or without constraint. The next challenge is how to apply developed genetic algorithm code to solve portfolio optimization problem.

III. PORTFOLIO OPTIMIZATION The multi objective portfolio optimization problems

have received increased interest from researchers with various backgrounds since early 1952 [8]. A modern portfolio theory provides a well-developed paradigm to form a portfolio with the highest expected return for a given level of risk tolerance. The mathematical model of the

978-1-4244-5585-0/10/$26.00 ©2010 IEEE

Page 2: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

41

Portfolio Optimization problem is due to Markowitz [8]. We define a portfolio P as a set of N real valued weights (w0,w1, ...wN) which correspond to the N available assets in the market. The weights obey the following:

0

1N

ii

w=

=∑

(1)

0 1iw≤ ≤ (2) Each asset has an expected return value, expressed by Ri.

The expected return value for the portfolio is given by the sum of the expected return values for the assets:

1

n

W i ii

r w r=

= ∑ (3)

Also, each asset has a risk measure, iσ . The risk of an asset is defined as downside values of the variance of that asset’s returns over time, and the risk of the Portfolio is defined as:

1 1

n n

W i j iji j

w wσ σ= =

= ∑∑ (4)

Where 2ii iσ σ= is the variance of ir , and ijσ is the

covariance between ir and jr . The calculation for the error of the portfolio in equation (4) can then be divided in two parts, one containing the variance of the returns, and another containing the covariance of the returns:

2 2n

W i i i j iji i j

w w wσ σ σ≠

= +∑ ∑ (5)

The first part of equation (5) describes the portfolio risk component composed by the risk of individual assets. It is called the specific risk. If there is no correlation between the assets in the portfolio (the second part of the equation is 0), we can show that the specific risk can be reduced by diversification (adding more assets to the portfolio).

IV. PORTFOLIO OPTIMIZATION USING GENETIC ALGORITHM

To start the analyses, we first have to conduct problem definition. This section describes the development of portfolio-optimization genetic algorithm program. Structure of the program can be seen as a map by following flowchart in figure 1. In the encoding procedure, the value of the gene in the chromosome is generated randomly. When we are generating the weight vector, we have to rescale the weight to satisfy equation (1). As the result, we convert the weight

into

1

ii N

ii

vwv

=

=

∑.

In this section, we also show the experiments that were performed to verify our proposition. We also carried out simulation using real world historical data from Jakarta Islamic Index in Indonesia market as a case study, and observed good results with the proposed method.

Figure 1. Flowchart of Portfolio Optimization using Genetic Algorithm

Program.

A. Verification of Portfolio Optimization GA Program

1) Data Used To perform the verification of GA code, we use the data

from reference [20] the paper entitled "Asset Allocation using Goal Programming" written by Nichols & Ravindran. In addition to using historical data from the paper, we also use the same model to formulate a fitness function and using the results for later comparison with the results of the GA code.

2) Return and Risk Estimation To determine the expected return and risk identified as

input for the fitness function, we use the Markowitz model that also used in reference [20]. In the Markowitz model, expected return is the average return from the historical return data, while the identified risk is standard deviation from the historical return data.

3) Fitness Function Development In the optimization, objective function consideration is a

part that not less important than the developed program itself. Evaluation function used for the GA is based on the total expected return and the risk of the portfolio. For the portfolio selection problem, we consider the total expected return and the risk. The expected return is to be maximized, while the risk is to be minimized. From the definitions and results of the expected return and risk value from the previous section, we can derive a utility function to use as the Fitness function for the Genetic Algorithm. Fitness function in this case is defined as:

0

0 1

.( )( ) . .

N

i ii

N N

i j iji j

r wf returnfitnessf risk w w σ

=

= =

= =∑

∑∑ (6)

Page 3: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

42

4) Results Genetic Algorithm ends like other optimization

algorithms too, by testing for convergence. Figure 2 following shows fitness value plot, which resulting by genetics algorithm on each generation. On that graph, blue line represent fitness's value best individual, red line represents fitness's average value individual on that generation and black line represents fitness's value best individual on processes random search (genetic algorithm without evaluation). From that figure, we can see that genetic algorithm give the results that convergent to the better solution, in consequence we can said that genetic algorithm is successful applied in this case.

0 20 40 60 80 100 120 140

0.35

0.4

0.45

0.5

0.55

0.6

0.65

0.7

0.75

0.8

Performance of GAbest value GA:blue, best value RS:black, mean value GA:red

number of generations

valu

e

Figure 2. Convergence Check for Nichols & Ravindran Case with

PopSize = 100, ST = 20 and Number Elitism = 10.

After convergence check done, hereafter programs to be run with various combination parameters. Parameters that are combined in this paper are Population Size, Stall Generation and Elitism. Results from a combination of parameters can be seen in table 1. Table 1 show that the time needed to run the program ranges between 10 - 40 seconds, so that we can say this program is fast enough to produce a solution. The time required to run the program in general with the proportionate number of evaluation function. Best value for each performance criteria, the cells marked by blue.

However, the criteria for portfolio performance namely, portfolio return, portfolio risk and the resulting fitness value does not have a clear relationship of each of the criteria or a combination of its parameters. Solution that provides the best results on the performance of a portfolio will be compared with the solutions generated by other methods. Comparison of the resulting solution with the GA and other methods, can be seen in figure 3.

TABLE I. GA PERFORMANCE FOR NICHOLS & RAVINDRAN CASE UNDER VARIED PARAMETER

Parameter Performance

Num Pop ST Elitism Portfolio

Return Portfolio

Risk Fitness Value

Elapsed Time

(Seconds)

Number of Evaluation Function

10 11,251 14,515 0,77511 19,327 14700 20 11,260 14,273 0,78886 20,595 15600 20 30 12,304 16,053 0,76647 29,570 20900 10 11,118 15,121 0,73530 7,489 16500 20 11,258 15,668 0,71857 37,404 19700

100

30 30 11,366 15,559 0,73048 41,848 21800 10 12,259 17,848 0,68686 33,076 28200 20 11,634 14,521 0,80115 26,784 30200 20 30 11,247 15,126 0,74358 35,292 29800 10 10,718 15,858 0,67587 8,053 33200 20 11,215 15,326 0,73178 8,218 38000

200

30 30 11,487 15,537 0,73929 27,532 36600

Figure 3. Comparison Result FGP, CGP, and GA on Nichols &

Ravindran Case.

B. Case Study: Jakarta Islamic Index In this section, we will try to apply the GA code to

complete the portfolio optimization problem using the real data and the model is quite adequate. In this case study we use data from stocks listed on the Jakarta Islamic Index in April 2009.

1) Data Used The suitable way of constructing a portfolio is to select

some good quality assets first and then to optimize asset allocation using portfolio optimization model. To select some good quality asset/stocks, we use the Syariah criteria stocks. So, we can use stocks data listed on the Jakarta Islamic Index (JII).

In this paper, we propose to identify expected return (mean profit) and risk using historical data of stock prices. The daily data used in this paper is stock closing price for the last five years (April 2004-2009), obtained from Jakarta Stock Exchange for Jakarta Islamic Index Stock.

Page 4: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

43

2) Return and Risk Estimation To identify expected return we use mean profit for each

stocks during last five years. The downside values of the variance of each stock which we obtained using parametric and historical simulation methodology (average) are considered to be the identified risk.

Risk calculator program developed by Anatoly Ivanov [32] used to calculate the portfolio return and identified risk for the stocks listed on the Jakarta Islamic Index in April 2009.

3) Fitness Function Development In this case, we will use adaptive weight sum approach

[07] to formulate fitness function for Multi Objective Genetic Algorithm. For a given generation, two extreme points are identified and the adaptive weights are calculated as:

1 max min1 1

1pz z

=−

(7)

2 max min2 2

1pz z

=−

(8)

Fitness function for Jakarta Islamic Index case is defined as:

101 1

2 22

0 1

. ..( )

( ) . . . .

N

i ii

N N

i j iji j

p r wp zf returnfitness

f risk p z p w w σ

=

= =

= = =∑

∑∑

4) Results As on previous case, after convergence check done,

hereafter programs to be run with various combination parameters. Results from a combination of parameters can be seen in table 2.

TABLE II. GA PERFORMANCE FOR JAKARTA ISLAMIC INDEX CASE UNDER VARIED PARAMETER

Parameter Performance

Num Pop ST Elitism Portfolio

Return Portfolio

Risk Fitness Value

Elapsed Time

(Seconds)

Number of Evaluation Function

10 14,1987 357,678 2,65868 20,552 14900 20 14,950 378,907 2,64253 29,898 20300 20

30 15,752 377,006 2,79829 29,419 16600 10 15,308 380,496 2,69451 45,367 32000 20 14,937 367,377 2,72301 36,342 24500

100

30

30 14,398 370,544 2,60234 26,113 25900 10 14,111 353,080 2,67671 36,084 52800 20 16,832 406,716 2,77176 33,872 56600 20

30 15,783 379,677 2,78413 29,198 51400 10 13,828 345,274 2,68223 49,538 56600 20 15,016 363,988 2,76298 36,616 60000

200

30

30 16,445 384,315 2,86588 63,492 55200

5) Parameter Observation Figure 4 shows the plot between the performances of

genetic algorithm with each of the parameters observed. From that figure, does not appear that there is a clear relationship between the parameters and the resulting fitness value, so we can say that there is no 'trend' that occurs.

From the observation of the parameters in both these cases, it can be observed that the parameter does not have a clear relationship with the resulting performance. Thus, the search parameters should be done to give the most optimal solution with run the program under various combinations of parameters.

Page 5: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

44

Figure 4. Top: Elitism, Middle: Stall Generation, Bottom: Number Population Parameter Observation on Jakarta Islamic Index Case.

V. CONCLUSIONS AND FUTURE WORKS Some of the conclusions based on the three previous

chapters are as follow: • Genetic Algorithm code that developed in this paper

can provide good results for simple optimization problem and portfolio optimization problem.

• Formulate portfolio optimization problem can be done using Markowitz Model, Risk & Return Estimation Method and Multi Objective Genetic Algorithm (MOGA) as in the formulation results in this paper.

• For solve portfolio optimization using GA, we required weight generating value procedure.

• Fitness function that developed in both case are able to be used as an input Genetic Algorithm.

• To find the optimal solution and optimize GA performance, we must observe sufficient GA parameters.

The whole process in finishing this paper gives much information that can be used for the next investigation process and GA application. Some ideas that can be continued for the next investigation are just like following points,

• Future research will investigate new strategies for improving the performance.

• Research can be focused on developing a hybrid form of algorithms, which combine the good features of different algorithms, says Genetic Algorithms and Tabu Search.

REFERENCES

[1] Adhynugraha, M.I., “Optimization of Airfoil of Wing in Ground Effect Using Genetic Algorithm”, ITB, Bandung, 2009.

[2] Aranha, C., “Portfolio Management with Cost Model using Multi Objective Genetic Algorithms”, The University of Tokyo, Tokyo, 2007.

[3] Aranha, C. and Iba, H., “A New GA representation for the Portfolio Optimization Problem”, The 22nd Annual Conference of the Japanese Society for Arttificial Intelligence, pp.1-4, 2008.

[4] Chan, M.C., Wong, C.C., Cheung, B.K.S., and Tang, G.Y.N., “Genetic Algorithms in Multi Stage Portfolio Optimization Systems”, International Journal of Operations Research, 2006.

[5] Coello, Carlos A., and Christiansen, Alan D., “An Approach to Multiobjective Optimization Using Genetic Algorithms”, Intelligent Engineering Systems Through Artificial Neural Networks, pp. 411-416, Vol. 5, 1995.

[6] Elton, E.J. and Gruber, M.J., “Modern Portfolio Theory and Investment Analysis”, John Wiley & Sons, Inc., New Jersey, 1995.

[7] Gen, M. and Cheng, R., “Genetic Algorithms and Engineering Optimization”, John Wiley & Sons, Inc., New York, 2000.

[8] Goldberg, David E., “Genetic Algorithms in Search, Optimization and Machine Learning”, Addison-Wesley Publishing Company, Inc., USA, 1989.

[9] Haupt, R.L. and Haupt, S.E., “Practical Genetic Algorithms 2nd Edition”, John Wiley & Sons, Inc., New Jersey, 2004.

[10] Hoklie, Zuhal, Lavi R. and Hidayat, Syarif, “Genetic Algorithm Approach for Multi Objective Stock Portfolio Optimization Problem”, Numerical Analysis in Engineering, Vol. 6, 2009.

[11] Kiusalaas, J., “Numerical Methods in Engineering with Matlab”, Cambridge University Press, New York, U.S., 2005.

[12] Konak, A., Koit, D.W., and Smith, A.E., “Multi Objective Optimization Using Genetic Algorithms: A Tutorial”, Reliability Engineering and System Safety 91, pp. 992–1007, 2006.

[13] Lai, K.K., Lean Y., Wang, S.Y. and Zhou, C.X., “A Double Stage Genetic Optimization Algorithm for Portfolio Selection”, LCNS 4234, pp. 928-937, 2006.

[14] Lin, C.M. and Gen, M., “An Effective Decision Based Genetic Algorithms to Multiobjective Portfolio Optimization Problem”, Applied Mathematical Sciences, Vol. 1, no. 5, pp.201-210, 2007.

[15] Lohn, J.D., Kraus, W.F., Haith, G.L., “Comparing a Coevolutionary Genetic Algorithm for Multi Objective Optimization”, Proceeding of The IEEE Congress on Evolutionary Computation, pp. 1157-1162, 2002.

[16] Maringer, D., “Portfolio Management with Heuristic Optimization”, Springer, Dordrecht, 2005.

[17] Miazhynskaia, T., and Aussenegg, W., “Uncertainty in Value-at-Risk Estimates under Parametric and Non-parametric Modeling”, Vienna University of Technology, 2005.

[18] Mitchell, M., “An Introduction to Genetic Algorithms”, MIT Press, Massachusetts, U.S., 1996.

[19] Mitra, Ahish, “Design of Transonic Airfoil using Multiobjective Genetic Algorithm”, Department of Mechanical Engineering, Stanford University (Courtesy: http://www.genetic-programming.org/sp2003/Mitra.pdf).

[20] Nichols, T.W. and Ravindran, A.R., “Assets Allocation Using Goal Programming”, Proceeding of The 34th International Conference on Computer and Industrial Engineering, pp. 321-326.

[21] Prigent, J.L., “Portfolio Optimization and Performance Analysis”, Chapman and Hall CRC Financial Mathematics Series, New York, 2007.

[22] Rao, S.S., “Optimization: Theory and Application”, 2nd ed. Wiley Eastern Limited, Delhi, India, 1984.

[23] Reeves, C.R. and Rowe, J.E., “Genetic Algorithms Principle and Perspective: A Guide to GA Theory”, Kluwer Academic Publishers, New York, U.S., 2002.

Page 6: Resolving Multi Objective Stock Portfolio Optimization Problem Using Genetic Algorithm

45

[24] Roudier, F., “Portfolio Optimization and Genetic Algorithms”, Swiss Federal Institute of Technology Zurich, Swiss, 2007.

[25] Scherer, B and Martin, D., “Introduction to Modern Portfolio Optimization with NuOPT, S-Plus and S+-Plus”, Springer, New York, 2005.

[26] Suyanto, “Genetic Algorithm in MATLAB”, Penerbit Andi, Yogyakarta, 2005.

[27] Taha, Hamdy A., “An Introduction Operations Research 7th Edition”, Pearson Education - Prentice Hall, New Jersey, 2003.

[28] Wang, S.M., Chen, J.C., Wee, H.M. and K.J. Wang, “Non Linear Stochastic Optimization Using Genetic Algorithm for Portfolio Selection”, International Journal of Operations Research, Vol. 3, no. 1, pp. 16-22, 2006.

[29] Wei, N.C., “Robust Portfolio Optimization Using Conditional Value at Risk”, Department of Computing, Imperial College, London, 2008.

[30] Zitzler, Eckart, “Evolutionary Algorithms for Multi Objective Optimization”, Evolutionary Methods for Design Optimization and Control - CIMNE, 2002.

[31] ________ “Genetic Algorithm and Direct Search Toolbox User’s Guide TM 2”, The Mathworks, Inc, 2008.

[32] http://www.mathworks.com/matlabcentral/fileexchange/85. “File Exchange MATLAB Risk Calculator by Anatoly Ivanov”. September 17th 2008.

[33] http://en.wikipedia.org/wiki/Modern_portfolio_theory. “Modern Portfolio Theory”. April 3rd 2009.

[34] http://en.wikipedia.org/wiki/Jakarta_Islamic_Index. “Jakarta Islamic Index” April 3rd 2009.