1. Introduction
The portfolio optimization problem (POP) aims to improve portfolio returns and reduce portfolio risk in the complex financial market. The mean-variance (MV) model was first proposed by economist Markowitz in 1952 to calculate the POP [
1,
2] and is a cornerstone of financial theory, providing a theoretical basis for investors to choose the optimal portfolio. However, there are significant limitations in its practical application. The use of variance to assess risk usually requires the calculation of a covariance matrix for all stocks, which is difficult to use in practice due to its computational complexity. Additionally, this risk measurement only considers the extent to which actual returns deviate from expected returns, whereas true losses refer to fluctuations below the mean of returns [
3,
4,
5,
6,
7,
8]. In order to be more in line with social reality, mean-semivariance portfolio models have been proposed and are widely used [
9,
10,
11,
12].
Traditional optimization algorithms for solving POPs require the application of many complex statistical methods and reference variables provided by experts, so solving large-scale POPs suffers from slow computational speed and poor solution accuracy, while heuristic algorithms can solve these problems well. In recent years, many scholars have used evolutionary computation algorithms to solve POPs, including the genetic algorithm (GA) [
13], particle swarm optimization (PSO) [
14,
15], artificial bee colony algorithm (ABC) [
16], and squirrel search algorithm (SSA) [
17]. The particle swarm optimization algorithm (Eberhart & Kennedy, 1995) belongs to a class of swarm intelligence algorithms, which are designed by simulating the predatory behavior of a flock of birds [
18,
19,
20,
21,
22,
23]. Due to its simple structure, fast convergence, and good robustness, it has been widely used in complex nonlinear portfolio optimization [
24,
25,
26,
27,
28,
29]. In addition, some new methods have also been proposed in some fields in recent years [
30,
31,
32,
33,
34,
35,
36,
37,
38,
39].
The improvement directions of the PSO algorithm are mainly divided into parameter improvement, update formula improvement, and integration with other intelligent algorithms. Setting the algorithm’s parameters is the key to ensuring the reliability and robustness of the algorithm. With the determined population size and iteration time, the search capability of the algorithm is mainly decided by three core control parameters, namely the inertia weight (w), the self-learning factor (C
1), and the social-learning factor (C
2). To improve the performance of the algorithm, PSO algorithms based on the dual dynamic adaptation mechanism of inertia weights and learning factors have been proposed successively in recent years [
40,
41,
42], considering that adjusting the core parameters alone weakens the uniformity of the algorithm evolution process and make it difficult to adapt to complex nonlinear optimization problems. Clerc et al. [
43] proposed the concept of the shrinkage factor, and this method adds a multiplicative factor to the velocity formulation in order to allow the three core parameters to be tuned simultaneously, ultimately resulting in better algorithm convergence performance. Since then, numerous scholars have explored the full-parameter-tuning strategy to mix the three core parameters for tuning experiments. Zhang et al. [
44] used control theory to optimize the core parameters of the standard PSO. Harrison et al. [
45] empirically investigated the convergence behavior of 18 adaptive optimization algorithms.
The parameter improvement of PSO only involves improving the velocity update and does not consider the position update. Different position-updating strategies have different exploration and exploitation capabilities. In position updating, because the algorithm’s convergence is highly dependent on the position weighting factor, a constraint factor needs to be introduced to control the velocity weight and reduce blindness in the search process. Liu et al. [
46] proposed that the position weighting factor facilitates global algorithm exploration. The paper synthesizes the advantages of the two improvement methods and proposes a dual-update (DU) strategy. The method not only adjusts the core parameters of velocity update to make the algorithm more adaptable to nonlinear complex optimization problems, it also considers the position update formula and introduces a constraint factor to control the weight of velocity to reduce blindness in the search process and improve the convergence accuracy and convergence speed of the algorithm.
The main contributions of this paper are described as follows.
(1) This paper makes improvements based on fundamental particle swarm and proposes a multi-strategy adaptive particle swarm optimization algorithm, namely APSO/DU, to solve the portfolio optimization problem. Modern portfolio models are typically complex nonlinear functions, which are more challenging to solve.
(2) A dual-update strategy is designed based on new speed and position update strategies. The approach uses inertia weights to modify the learning factor, which can balance the capacity for learning individual particles and the capacity for learning the population and enhance the algorithm’s optimization accuracy.
(3) A position update approach is also considered to lessen search blindness and increase the algorithm’s convergence rate.
(4) Experimental findings show that the two strategies work better together than they do separately.
3. Portfolio Optimization Problem
3.1. Related Definitions
The essential parameters in the POP are expected return and risk, and investors usually prefer to maximize return and minimize risk. Assuming a fixed amount of money to buy n stocks, the POP can be described as how to choose the proportion of investments that minimizes the investor’s risk (variance or standard deviation) given a minimum rate of return, or how to choose the proportion of investments that maximizes the investor’s return given a level of risk.
The investor holds fixed assets invested in
stocks
, let
be the return rate of
, which is a random variable.
is the expected return on stock
. Let
denote the mathematical expectation of a random variable R. Define
In a certain period, the stock return is the relative number of the difference between the opening and closing prices of that stock, where
is the return of stock
in period
, as in Equation (7).
where
and
are the closing prices of stock
in periods
and
, respectively. The expected return on the
stock is given by Equation (8)
3.2. Mean-Semivariance Model
A large number of empirical analysis results show that asset returns are characterized by spikes and thick tails, which contradicts the assumption that asset returns are normally distributed in the standard mean-variance model. Additionally, the variance reflects the degree of deviation between actual returns and expected returns, while actual losses (loss risk) are fluctuations below the mean of returns. Thus, the portfolio optimization model based on the lower half-variance risk function is more realistic. Equations (9)–(12) present the mean-semivariance model. Assume that the short selling of assets is not allowed.
is the number of stocks in the portfolio;
is the rate of return required by the investor;
is the proportion () of the portfolio held in assets ;
is the mean return of asset in the targeted period;
is the mean return of the portfolio in the targeted period.
Equation (9) is the objective function of the model and represents minimizing the risk of the portfolio (the lower half of the variance); Equation (10) ensures that the return of the portfolio is greater than the investor’s expected return ; and Equations (11) and (12) indicate that the variables take values in the range [0, 1], and the total investment ratio is 1.
4. Case Analysis
4.1. Experiment Settings
- (1)
Individual composition
The vector represents a portfolio strategy whose dimensional component represents the allocation of funds to hold the stock in that portfolio, namely the weight of that asset in the portfolio.
- (2)
Variable constraint processing
Equation (10): the feasibility of the particle is checked after the initial assignment of the algorithm and the update of the position vector and if it does not work, the position vector of the particle is recalculated until it is satisfied before the calculation of the objective function is carried out.
Equation (11): the variables take values in the interval and the iterative process uses the boundary to restrict within the interval.
Equation (12): variables on a non-negative constraint basis, sets when , so that all variables in the portfolio are ; when , let , .
- (3)
Parameter values
The particle dimension D is the number of stocks included in the portfolio, and the number of stocks selected in this paper is 15, hence D = 15. The parameters of this experimental algorithm are set as described in
Section 2.3. of this paper, and the results show the average of 30 independent runs of each algorithm. All PSO algorithms in this paper were written in Python and run on a Windows system for testing.
4.2. Sample Selection
Regarding the selection of stock data, firstly, recent stock data should be selected for analysis to have a certain practical reference value. Secondly, the number of shares is too small to be credible, and the number of shares is too large for the average investor to be distracted with at the same time. Finally, Markowitz’s investment theory states that the risk of a single asset is fixed and cannot be reduced on its own, whereas investing in portfolio form diversifies risk without reducing returns. The lower the correlation between any two assets in a portfolio (preferably negative), the more significant the reduction in overall portfolio unsystematic risk [
47]. Some methods can be used to solve this problem [
48,
49,
50,
51,
52].
Based on the above considerations, 30 stocks from different sectors were selected from Choice Financial Terminal, with a time range of 1 January 2019 to 31 December 2021, for a total of 155 weeks of closing price data. Correlation analysis was conducted on the stock data, and 15 stocks with relatively low correlation coefficients were selected for empirical analysis. The price trend charts and correlation coefficients for the 15 stocks are given in
Figure 4 and
Figure 5.
Figure 4 shows the weekly closing price trend for the 15 stocks data, which provides a visual indication of the trend in stock data. Stocks vary widely in price from one another, with 600612 being the most expensive. As shown in
Figure 5, the fifteen stocks have low correlations, with only two portfolios having correlation coefficients greater than 0.5 for any two stocks. Stock 6 and Stock 8 have strong correlations with Stock 12, with correlation coefficients of 0.6 and 0.5, respectively, while all other correlations are below 0.5. Stock 4 and Stock 14 have the lowest correlation, with a correlation coefficient of −0.045. After calculation, the correlation of the stock data in this paper is low, and the mean correlation coefficient is only 0.198. The lower the correlation between stocks is, the more effective the portfolio choice is in reducing unsystematic risk, thus indicating that investing with a portfolio strategy is effective in reducing risk.
Table 4 gives the basic statistical characteristics of 15 stocks for 2019–2021, and the returns are the weekly averages of the relative number of closing prices of the stock data. The
p-values for most of the stock returns in
Table 4 are less than 0.05, which should reject the original hypothesis and indicates that the stock returns do not conform to a normal distribution at the 5% significance level. The
p-values for 600793 and 600135 are greater than 0.05 at a level that does not present significance and cannot reject the original hypothesis, so the data satisfies a normal distribution.
Figure 6 shows the histogram of the normality test for 15 stocks. If the normality plot is roughly bell-shaped (high in the middle and low at the ends), the data are largely accepted as normally distributed. It can be seen from the figure that the normal distribution plots of the 600793 and 600135 stock data roughly show a bell shape, which is consistent with normal distribution. However, the normal distribution of most stocks does not show a bell shape and does not conform to normal distribution.
It is difficult for all the stock data to conform to the assumption that asset returns are normally distributed in MV. Secondly, the real loss refers to the fluctuation below the mean of returns; thus, the portfolio model based on the lower half-variance risk function is more realistic, so the MSV model is used for empirical analysis later in the paper.
4.3. Interpretation of Result
In order to verify the effectiveness of the semi-variance risk measure in practice, six different levels of return (0.005 to 0.0030) are set in this paper.
Table 5 gives the risk values obtained by different algorithms at the same return level, and the best results are identified in bold font. A visualization of the Pareto frontier (PF) obtained by solving the four algorithms is given in
Figure 7. The optimal investment ratios derived from each algorithm solved at the expected return level of 0.03 are given in
Table 6 to visually compare the effectiveness of the APSO/DU algorithm in solving the MSVPOP.
Table 5 and
Figure 7 show that as returns increase, the portfolio’s risk also increases, in line with the law of high returns accompanied by high risk in the equity market. Taking the expected return
= 0.003 as an example, APSO/DU has the smallest value of risk (2.78 × 10
−4) and the PSO-TVAC algorithm has the largest value of risk (3.82 × 10
−4), so the portfolio solved by the APSO/DU algorithm is chosen at the expected return level of 0.03, corresponding to the smallest value of risk. A sensible person should choose this portfolio. Similar to the other return levels analyzed, the APSO/DU algorithm proposed in this paper is always lower than the results calculated by the other algorithms. The APSO/DU algorithm calculates a lower value of risk than the three classical adaptive improved particle swarm algorithms when the expected returns are the same, indicating that the combination of improved particle swarm solutions obtains relatively better results at the same expected return, and APSO/DU has stronger global search capability and more easily finds the optimal global solution.
The optimal investment ratios derived from each algorithm solved at the expected return level of 0.03 are given in
Table 6 to visually compare the effectiveness of the APSO/DU algorithm in solving the MSVPOP.
5. Conclusions
In order to cope with the POPMSV challenge well, a multi-strategy adaptive particle swarm optimization, namely APSO/DU, was developed, which has the following two advantages. Firstly, the variable constraint (1) is set to better represent the stock selection, and asset weights of the solution in the POP help to cope with the MSVPOP challenge efficiently. Secondly, an improved particle swarm optimization algorithm (APSO/DU) with adaptive parameters was proposed by adopting a dual-update strategy. It can adaptively adjust the relevant parameters so that the search behavior of the algorithm can match the current search environment to avoid falling into local optimality and effectively balance global and local search. The sole adjustment of w and and would weaken the uniformity of the algorithm’s evolutionary process and make it difficult to adapt to complex nonlinear optimization, so a dual dynamic adaptation mechanism is chosen to adjust the core parameters. The APSO/DU algorithm is more adaptable to nonlinear complex optimization problems, improving solution accuracy and approximating the global PF. The results show that APSO/DU exhibits stronger solution accuracy than the comparison algorithm, i.e., the improved algorithm finds the portfolio with the least risk at the same level of return, more closely approximating PF. The above research results can be used for investors to invest in low-risk portfolios with valuable suggestions with good practical applications.