Application of the Improved Differential Evolution Algorithm in Portfolio

Aiming at the NP hard problem of portfolio optimization, an improved differential evolution algorithm is proposed. In this algorithm, the mutation operator and crossover operator are set up adaptively, and then according to the characteristics of the mutation itself, two kinds of mutation operators with global search ability and local search ability are improved .The improved algorithm can improve the convergence speed and ensure the precision of the algorithm. Through five stocks of the same type and 20 different types of stocks for empirical analysis, the results show that the proposed algorithm has a certain guiding role in solving the problem of portfolio optimization.


Introduction
With the rapid economic development, emerging assets constantly emerging financial markets, more and more families, companies keen on capital investment, the inherent risks of financial markets and the resulting revenue has always been one of the focuses of the investors. In the market operation, anyone with an investment in its earnings also associated with certain risks at the same time, different ways of investment profit is different also. In order to find the optimal investment scheme, we need to make a trade-off between costs and benefits. The theory of portfolio comes into being.
The earliest theory of portfolio theory was proposed by American economist Markowitz [1] in 1952, which proposed mean-variance (M-V) by using two concepts of expectation and variance in mathematical statistics. Once the model is put forward, which is widely applied to portfolio selection and asset allocation. The M-V model measures the overall level of the real rate of return with the expected rate of return (mean of return), and measures the uncertainty (risk) of the rate of return by the variance (or standard deviation) of the yield. The model is: (2) denotes the covariance between the i and the j securities, N denotes the number of total investment securities, R is the expected rate of return target. (1) represents the minimum total risk required to invest, (2) shows the expected to achieve the total revenue, (3) is the ratio of all the securities investment and is 1, (4) shows that the investment ratio of each security is between 0 and 1. The model indicates that the total risk to the investor is minimized when a certain return is satisfied.
The M-V model is established with gains and risks predictable1. However, in actual operation process, due to the uncertainty of market factors, the risk and return of investment are often difficult to predict. Therefore, many scholars have improved the model and put forward some new models, such as semi-variance model [2], the mean absolute deviation model, such as the literatures [3][4][5][6][7], these methods are for the actual transaction there are some restrictions on the problem raised by the problem, which is not starting from the problem of solving the difficulty. It is proved that no matter what kind of model of portfolio optimization problem is a NP hard problem, with the continuous expansion of market investment, the traditional method can not get satisfactory results. Finding an effective solution to this problem is also of great importance.
The group intelligent algorithm is a new kind of optimization algorithm, which has achieved a very good effect in the function optimization problem. At present, some scholars have applied the algorithm to portfolio optimization problems, such as the literatures [8][9][10][11][12]. These methods are based on actual situation to some improvement after solving the model. The practice shows that these methods also achieved good effect. In this paper, the modified MV model is reconstructed and the improved differential evolution algorithm is used to solve it. The empirical analyses show that the proposed algorithm is effective.

Basic differential evolution algorithm
Differential evolution algorithm (DE) [13] was proposed by Storn and Price in 1995, which uses real number coding. The algorithm is simple and easy to implement. It has significant advantages in solving some complicated optimization problems.

Mutation operation:
The purpose of the mutation operation is to generate a mutation vector which can disturb the target vector. The specific process as follows:

Crossover operation:
The purpose of crossover operation is to increase the diversity of the population. The specific operation is: Where c p is the crossover probability factors, usually taking a real number of (0, 1], ij randl is a random number of [0, 1].

Selection Operation:
The selection operation is based on the evaluation of fitness; the purpose is to determine which individuals to enter the next generation. The specific operation is: Like other evolutionary computation, the DE algorithm simulates the evolution of organisms, which makes the evolution of the population towards a better direction. The new population after mutation operation and crossover operation will choose excellent individuals into the next generation by greedy choice way .This method can guarantee the superiority of the group and accelerate the speed of searching, but also make the algorithm falls into local optimum easily. In addition, DE as a random search algorithm, the population diversity is good in the beginning, but with the increase of the number of iterations, the generation between the distributions of population density is high and the exchange of information is less and less. So as to make the global optimization ability gradually decline, despite the global optimal search can be realized, but also can appear the phenomenon of premature convergence.
3 Improvement of basic differential evolution algorithm

Parameter settings
The influence of parameter setting of differential evolution algorithm on its overall performance is very big. Variation factors F determine the deviation vector amplification ratio, the larger the F , the higher the mutation strength, the global search ability is stronger, but the slower the convergence speed. On the contrary, F is smaller, the lower the strength of individual variation, accelerate the search speed, but it may cause algorithm trapped in local optimal solution, the crossover factor CR controls whether the vector is derived from the individual or the parent of the individual variation, CR is larger, the smaller the degree of individual difference, the faster the convergence speed, but also easily caught in the local excellent. Research shows that so far is usually a better choice. In order to keep the global searching ability and improve the convergence speed and precision of the algorithm, the mutation operator and the crossover operator are set as follows: Mutation operator: Crossover operator: In which t is the current evolution generation, T is the maximum evolution generation, in this setting, mutation operator decreases in [0.5, 1] with the evolution generation increase, crossover operator exponential increases in (0, 1]. This setting can guarantee the individual diversity in the early stage of evolution and improve the global search ability. In the later stage, the degree of difference among individuals will be reduced to speed up the convergence speed.

Mutation operation settings
Differential evolution algorithm for each generation of individual The DE / rand / 1 / bin is helpful to keep the diversity of the population and improves the global searching ability, but reduces the convergence speed, the DE / best / 2 / bin reduces the differences between individuals, improves local searching ability and accelerates the convergence speed, but also accelerates the algorithm into the possibility of local optimum. Experiments show that 3.is better than 1.in enhancing the diversity of population. The 2.is very good results in improving the convergence speed and accuracy, according to the above analysis, in order to guarantee the diversity and improve the convergence speed of the algorithm, an improved mutation strategy was proposed .The new mutation operation is: , t is the current evolution generation, T is the maximum evolution generation.
In the above formula, with the increasing of evolutionary algebra t , the value of O gradually changes from the maximum value 1 to 0 gradually. At the beginning of evolution, 1 O ,the formula becomes 3, it can guarantee the algorithm in the evolutionary initial stage has stronger global searching ability, as much as you can find the global optimal point, to the late evolution of the maximum evolutionary algebra, 0 O ,(8) becomes 2, it can guarantee the algorithm has stronger local search ability in the stage, improve the precision and convergence speed of the algorithm. The experiments results show that this setting can not only guarantee the algorithm has stronger global searching ability, and can guarantee the convergence speed and accuracy of the algorithm.

The application of improved differential evolution algorithm in portfolio optimization problem
In fact, the two objective functions of risks and benefits of the standard M-V model is a pair of opposite direction problem, it is not easy to solve in the process of actual operation. In order to better evaluate the contradiction between the risks and benefits. This paper considers the non-radix and the quota. A new risk weighting factor p is introduced, the objective functions of the risk and the benefits were combined into a target function to discuss. The combined model is as follows: For a specific portfolio optimization problem, we define Eq. (9) as the objective function.

Algorithm specific process:
Step1: Initialize, randomly generates the initial population of size N , and determines the maximum evolutionary algebra T ; Step2: Calculate the fitness value of individual species and select the best individual; Step 3: The population is mutated according to (8); Step 4: The crossover operation of the transformed individuals is performed according to the new crossover operator; Step5: Calculates the fitness value of the new individual after crossing and does selection operation; Step6: Determine whether the termination condition is reached, if so, evolution terminates, and the individual is output as the optimal solution. Otherwise, go to step7; Step7: Sets the evolutionary algebra

The empirical analysis
In order to test the effectiveness of the proposed algorithm in solving the portfolio optimization problem, we select the opening price of five Shanghai stocks, namely, Bank of China, Dongfeng Motor, China Unicom, Guodian Nanzi, Sichuan Changhong, form January to December in 2015 as the effective numerical of the test, the basic information in Table 1. In addition, select the opening price of the deep stock of four small plates, four motherboards, two gem and 10 stocks in Shanghai a total of 20 stocks from January 2015 to June 2016 in 12 months as a reference data, all the data from the Star of the Securities. In the test, we solve the optimal portfolio of each stock by calculating the monthly benefits of each stock and the covariance matrix between the two. In order to reduce the accident, each group of test data are running 10 times, the largest evolutionary algebra is 100, the population size is 10 times of the stock quantity, and take the optimal solution of 10 times as the solution result. Table 2 shows that when the risk weight factor takes different values, the fitness value and benefits / risk ratio after running 10 times, the benefits / risk ratio reflects the return on the unit risk.  As we can see from the Table 2, when the risks are not taken into account, namely, 0 p the benefits are very little. With the increase of the risk, the benefits are also gradually increase, when only considering risk regardless of benefits, namely, 1 p , although revenue, but earnings per unit risk declines. This shows that in the investment in stocks, income and risk is directly proportional to, so-called "high risk high reward" principle.
According to Table 2, Figure1 shows the effective frontier of the investment with different returns and corresponding minimum risk.  Table 3 presents the returns of the 20 stocks in the risk weighting factor 1 5 0 0 p p p , . , , which does not consider risk, risk and income are equally important and does not consider earnings yield per unit risk and the corresponding optimal portfolio solution. Looking at the optimization results in Table 2 and Table 3, we can see that in only five small portfolio, generally high yield per unit risk, at around 1, when stock quantity increases to 20, revenues per unit risk generally dropped, which shows that the stock investment profit is associated with the number of shares, the greater the number of reduced profits, which is consistent with existing research [14]. In addition, Table 2 shows the same type of five Shanghai stocks, while table 3 is from different types of stocks. When selecting any of the five stocks in Table 3 for a combined test, we found that the return on unit risk is higher than in table 2. This shows that under the same conditions, investment stock returns are also related to the type of stock, investment in different types of stocks, the risk is relatively reduced, that is, decentralized investment is less risky than the overall investment. Figure 2 to figure 5 shows the corresponding evolutionary curves under different weights in Table 3:

Conclusions
Against the standard DE is slow convergence speed, easily into local optimum, this paper improves the mutation and crossover factors of standard DE, and improves the mutation operation formula. The improved DE is used to solve the NP hard problem of portfolio optimization. Through five stocks and 20 stocks for empirical testing, the test results show that the proposed algorithm can effectively guide the portfolio optimization problem.
In the actual investment portfolio, due to various factors, there will be a variety of constraints. The follow-up work of this paper is to study how to use this algorithm to solve the portfolio optimization problem under the real constraints.