A Diversity Model Based on Dimension Entropy and Its Application to Swarm Intelligence Algorithm

The swarm intelligence algorithm has become an important method to solve optimization problems because of its excellent self-organization, self-adaptation, and self-learning characteristics. However, when a traditional swarm intelligence algorithm faces high and complex multi-peak problems, population diversity is quickly lost, which leads to the premature convergence of the algorithm. In order to solve this problem, dimension entropy is proposed as a measure of population diversity, and a diversity control mechanism is proposed to guide the updating of the swarm intelligence algorithm. It maintains the diversity of the algorithm in the early stage and ensures the convergence of the algorithm in the later stage. Experimental results show that the performance of the improved algorithm is better than that of the original algorithm.


Optimization Problems and Swarm Intelligence Algorithms
Optimization problems have a long history. They involve the need to determine specific performance requirements for a certain problem if there are multiple alternative solutions, and to select one of them to maximize or minimize the determined performance requirement index [1]. In real life, optimization problems exist widely in engineering design [2], image segmentation [3], power systems [4], and other fields. In order to better solve optimization problems, evolutionary algorithms simulating the process and mechanism of biological evolution and swarm intelligence algorithms simulating the foraging mechanism of biological populations have gradually become a research hotspot in recent years.
Swarm intelligence refers to the behavior of group cooperation and collective intelligence presented by a group composed of many simple individuals in nature [5]. Swarm intelligence is a kind of group-based computing method with self-organization, self-adaptation, and self-learning characteristics, which is put forward by referring to and utilizing various mechanisms of natural phenomena or organisms in nature. After years of development, a large number of swarm intelligence optimization algorithms have been born, among which the classic swarm intelligence optimization algorithms include the artificial bee colony algorithm [6], the ant colony algorithm [7], and the particle swarm optimization algorithm [8].

An Overview of the Diversity of Swarm Intelligence Algorithms
A major problem in swarm intelligence algorithms is premature convergence [9][10][11][12]; i.e., algorithms lose diversity prematurely. The root cause of premature convergence is the imbalance between local exploration and global development [13]. Too much local exploration leads to premature convergence of the algorithm into a local optimum, while too much global development causes the algorithm to lack precision and become difficult to converge [14].
To some extent, exploration and development can be seen as a pair of contradictory concepts, and the increase of one will inevitably reduce the other [15]. Population size, search strategy, and restart strategy are all effective methods to control exploration and development, but how to balance them scientifically is the key for a swarm intelligence algorithm to achieve excellent results.
Evaluating the diversity of algorithms can fully detect the exploration and development of algorithms. As an important index of the swarm intelligence algorithm [16], diversity measures the richness of particle position, cognition, direction, and other properties in the swarm intelligence algorithm. Existing studies on diversity and entropy include: Folino et al. proposes a method to evaluate swarm intelligence algorithm using entropy value [17]; González et al. proposes a natural inspired strategy for optimization [18]; Muhammad et al. proposed a design with entropy evolution of optimal power flow problem [19]. Da et al. proposed a simplex crossover evolutionary algorithm aiming at genetic diversity [20].
According to the benchmark and representation method of the diversity model, there can be many diversity models. Therefore, the scope of this paper should be determined first. The diversity studied in this paper is a measure related to the position of individuals in a population. We believe that a measure model that can measure the true diversity of a population should have the following properties, besides being true and effective: (1) It is robust to parameters such as population size and problem dimensions.
(2) It has repeatability for different populations.
(3) It can give feedback directly to changes in the population.
For this reason, we have designed a new diversity model. The model calculates population entropy based on particle position, which is named "dimensional entropy". Compared with other methods, dimensional entropy can clearly and intuitively define the diversity of a population and thus control the iteration of the algorithm. This paper is organized as follows: This section introduces some basic knowledge about the swarm intelligence algorithm and its diversity; in the second section, we describe a variety of diversity models and discuss the dimensional entropy model. Section 3 shows the method of updating the swarm intelligence algorithm guided by the dimensional entropy model; Section 4 shows the results; Section 5 presents our conclusions.

General Concept
Generally speaking, diversity [21,22] can be defined as the degree of individual heterogeneity between populations [23]. In swarm intelligence algorithms, there are many kinds of diversity evaluation models, which can be divided into two categories. The first type is the measurement based on the distance between particles [24,25]. This distance can be based on a central particle [26], the maximum distance between two particles in space [27,28], or the average distance between particles [29]. Euclidean distance is a common calculation method, because Euclidean space extends two-dimensional or threedimensional space to any dimension, and at higher dimensions, populations exist and are defined in Euclidean space.
The second type is based on the entropy measure. Entropy is a concept in thermodynamics. In 1948, Shannon put forward the concept [30]. The idea is that calculating the probability of several independent random discrete events can measure how much of an information system is uncertain. When only one event occurs in an information system, information entropy is the minimum; when the probability of occurrence of multiple discrete events is the same, the information entropy is the maximum.
When applied to the swarm intelligence algorithm, because the population itself is a continuous concept, the first step is to segment the population, i.e., to discretize it. Thus, each segmented interval is abstracted as a random event, and the ratio of the number of particles contained in each interval to the total population is the probability of this "random event" occurring. Therefore, how to discretize and which standard to discretize become a key, difficult point in applying the entropy standard in the swarm intelligence algorithm. At the same time, the number of intervals divided by discretization has a direct impact on the estimation of diversity. When the ethnic scale is too small, the entropy method cannot be used to divide enough intervals. However, in the case of high dimensions, it is difficult to consider the situation of all dimensions when dividing the interval.
In addition, the combination of entropy values between all the particles must be considered. For example, Gouvea Jr. and Araujo used a representative particle to represent population diversity [28]; i.e., they used the individual characteristics of a particle to represent population diversity. They mentioned that the chosen particle has to be important. Collins and Jefferson used average entropy values to determine population diversity [31].

Research Status of Diversity
To save space, a summary of the symbols used in this section is first given in Table 1 below. The position of the i particle on the k dimension − X k Average value of the population on the k dimension p m,k Fraction of N that belongs to interval m on the dimension k The most basic range-based diversity measure only considers the diameter of the population, i.e., the distance between the two farthest particles in the population [30]. The formula is shown in Equation (1): The second method [32] can be obtained by changing the farthest distance to the radius of the population and calculating the distance between the farthest particle and the average position of the population. The formula is shown in Equation (2): There are other extended methods of this method, such as calculating the average radius, which will not be detailed here.
The third method was proposed by Olorunda and Engelbrecht. The idea is to consider the mean value of the mean distance around the population particles [27], as shown in Equation (3): This method has a huge calculation cost. In order to save the calculation cost, Wineberg and Opacher proposed a calculation method named "true diversity" [33], which represents the mean standard deviation of each particle in the population, as shown in Equation (4): where: The last diversity based on distance measure compared in this paper was proposed by Herrera and Lozano [26]. This diversity measure requires pre-determination of the most suitable particle in the population, because it uses this particle as a reference to measure the distance with other particles, as shown in Equation (5): where: In terms of the entropy value measurement, Shannon's entropy is the most basic measurement method [34], which measures the disorder degree of the population [35]. Its entropy definition is shown in Equation (6): If we want to measure the entropy value of the swarm intelligence algorithm, it is important to establish a discrete measurement model. Chen et al. put forward an idea based on entropy calculation methods of fitness [36]. The idea is to investigate the historically best position. The interval is defined as the current particle fitness range, which can be divided by the same number of particles of M between communities, so as to calculate the distribution of the current fitness [37]. The formula is shown in (7): where p m = k 3 M where k m . represents the number of particles contained in interval m.
Wang and Lei put forward the intuitionistic fuzzy population entropy as a measure of diversity [38,39]. In this method, the PBest position of each generation is selected as the aggregation point, the distance from particle j to the aggregation point i is D ji , and the scope radius of each aggregation point is R i = K * Max D j , where K is a random number between [0, 0.5]. If the distance D ji from particle j to the aggregation point i is less than the scope radius R i of the aggregation point i, then particle j is considered to belong to the aggregation point i and the counter T i is increased by 1. If particle j does not belong to any of the scopes, then particle j is considered as an "lone point" and the global counter T x is added 1. The formula is shown in (8): where: The intuitionistic fuzzy population entropy reflects the aggregation degree of particles in the algorithm solution process.

Some Fundamental Flaws in Current Metrics
First of all, population diameter is not an ideal diversity measurement method, because this method only considers the two farthest particles and ignores the distribution of the remaining particles, which cannot explain the true diversity of a population.
A similar deficiency exists in population radius, where the diversity is based on the position of the particles furthest from the population center. When this indicator describes a fully diversified population, the value is close to 0.5. As the value approaches 1, it describes a population that is mostly clustered around one corner and has an outlier near the other corner. This diversity is also wrong.
The diversity based on the distance measure needs to determine a reference particle in advance, but in fact, a suitable reference particle is difficult to choose. Meanwhile, for a linearly shrinking population, its diversity will remain unchanged because of the simultaneous contraction of the numerator and denominator, and the real decreased diversity cannot be described.
It is difficult to determine an appropriate segmentation standard using the diversity measure based on entropy. The entropy calculation based on the fitness of particles has the same fitness and the same interval. It may work with a single peak function, but in the face of two likely multimodal functions for different peak particles with the same fitness, a simple classification by fitness is rigorous.
Intuitionistic fuzzy population entropy considers the scope division of particles in space, but the difficulty of this division increases greatly with the increase of dimensions. In high dimensions, a particle is likely to belong to different scopes in different dimensions, so it is difficult to clearly divide. Finally, as we will see later, most of the metrics fail to deal with population dynamics.

Diversity Model Based on Dimension Entropy
Xu and Cui [40] confirmed that the swarm intelligence algorithm in the iteration is relatively independent of each dimension in the process of change. Inspired by this, this paper puts forward dimension entropy to measure the diversity of the swarm intelligence algorithm. Unlike other entropy value methods, we abandoned the concept of space. We have an independent view of the entropy value of each dimension. Dimension entropy is put forward. We provide relevant definitions: Dimension interval. The maximum and minimum values of each dimension were selected as the upper and lower limits and divided into M intervals (M is the total number of particles) on an average basis. Each dimension was divided into intervals independently without interference.
Dimensional entropy. In each dimension, the number of particles falling into each dimension interval is counted independently, and the dimension entropy is calculated, as shown in Equation (9): where: In the worst-case scenario, the population is trapped in the same interval in all dimensions; that is, the population completely converges, and the dimensional entropy is then 0. The larger the dimensional entropy, the greater the diversity of the population.
Compared with the previous entropy method, our dimension entropy method perfectly overcomes the disadvantages of the usual entropy methods. With a low population size, even if some dimensions cannot be effectively divided, the entropy can be calculated as long as one of the dimensions can complete the interval division. At the same time, the independent thinking among the dimensions also enables us to face the challenges of higher dimensions simply and intuitively.

A Comparative Study
In order to compare the differences between different diversities, the various methods should be normalized first so as to evaluate on the same standard. In this study, the maximum value was used as the normalization factor. After normalization, the value range of each model was 0~1.
In addition to the dimension of entropy, we selected the diversity model to participate in six kinds of contrast: the maximum distance [32], the radius of the population [32], the individual average distance [27], and the average standard deviation [33] , two entropy value methods: the fitness [36] and the intuitionistic fuzzy entropy [38]. These are marked, respectively, as D dp , D rp , D all , D td , E f it , E f uzzy .

Population Expansion Experiment
The practical application scenario of the swarm intelligence algorithm is complex, which will inevitably face population expansion or decline. A good diversity model should have a correct and timely response to changes of population size.
In order to compare the robustness of various diversity models of population size, we designed the following experiments.
First, we designed a complete population of 20 particles with a population range of [−100, 100]. This population contains two dimensions and has the following characteristics: (1) All particles in the population are uniformly distributed in all dimensions. (2) No two particles are the same.
The complete population is shown in Figure 1. We randomly selected the composition of the initial population and the population expansion after the simulation operation from a population of 20 particles. The initial population consists of 10 particles. We randomly selected 1 out of 10 particles and joined the initial population. After 10 iterations, the entire population was produced, as shown in Figure 1. The process of population change is in Figure 2. Since there is a significant difference between each particle in the complete population, it can be seen that, in the population expansion process in the figure above, each new particle is different from the old particle, so the diversity of the population must continue to increase in this process.
We used the above several diversity models to evaluate the population diversity in this process. The entropy value method is based on the population fitness. We used a simple to calculate the entropy. Because the fuzzy population entropy needs to use the PBest value of the past dynasties as the aggregation point in the calculation process, it was not used in this experiment.
The normalized results of various models are shown in Figure 3. According to the above figure, the population diversity of D dp increased only in the fourth iteration, because the particles added in the fourth iteration happened to be outside the existing population, while in the remaining iterations, the particles were added inside the population, which means that the simple method to calculate the population diameter could not judge the changes within the population at all.
Although D rp shows an overall upward trend, its value is always at a high level, which means that, if the new particle is not a significant outlier, then D rp cannot make a clear response to it. Throughout all 10 expansion processes, the diversity value of D rp decreased four times, because, while the new particles did not expand the maximum radius of the population, the enlarged denominator decreased the value of D rp . D all has a similar problem. If the new particles do not increase the average distance between the particles, D all will not reflect the population change correctly.
D td kept a downward trend during the iteration, because the increase in particles resulted in a decrease in the standard deviation, which proved that D td could not be used to describe a changing population. E f it overall performs better, but still showed a diversity, which reduced the phenomenon. This is because the eighth iteration was added on the right, and existing particles around the zero point were symmetrical. The two particles were completely different; however, in our set, the fitness function is similar. The visible fitness does not have the unique attributes of a particle. How unique and accurate properties are chosen as division standards is a key part of the entropy value method.
Finally, among all the methods, only E dim keeps an upward trend at all times, and the upward trend is visible in each iteration, which is sufficient to prove that our proposed method can accurately observe and describe a changing population.

Dimensional Change Experiment
The swarm intelligence algorithm also faces a complex dimension problem. We hope that the diversity of an ideal method is robust for different dimensions; namely, if the population itself is fully diversified, then regardless of dimensions, its diversity values should be stable; otherwise, it would be difficult to assess or apply in the swarm intelligence algorithm.
To this end, we designed an experiment. First, we built a completely differentiated network with 1 dimension and 100 particles, and then continuously expanded the dimensions on this basis, ensuring that each expanded dimension was also completely differentiated. This step was repeated until it reached 30 dimensions. In this process, we used the above diversity model to compare the values of each model for different dimensions, and the results are shown in Figure 4. As can be seen in Figure 4, with the increase in dimensions, all distance diversity models show an increasing trend of diversity. This is because, with the increase in dimensions, the spatial span calculated by the diversity model based on spatial distance also increases proportionally, which is almost an inevitable defect of the distance diversity model. In contrast, the entropy method has better resistance to dimensional changes, and compared with E f it , the method we defined is more accurate and stable.

Practical Problem Testing
The purpose of this experiment is to test the performance of each model under the actual test function environment. First of all, we are given a specific Rastrigin function test. The test function exists, and there is only one global optimal value at the zero point; therefore, while the algorithm is run, almost all particles, according to certain trends, will move toward the optimal point 0 mobile. As the iteration times begin to approach zero, and when the late algorithm flocks to near zero, all particles moving toward the zero distance sum partly reflect the diversity of the population under the test function. The formula of the Rastrigin test function is shown in Equation (10): The standard PSO algorithm was used to carry out the experiment. The experimental dimension was 5 dimensions, there were 50,000 fitness evaluations, the population size was set as 100, and the diversity models involved in the experiment were D dp , D rp , D all , D td , E f it , E f uzzy , and E dim . The PSO setup is described in the next section.
The Spearman correlation coefficient is a nonparametric index to measure the dependence of two variables. It uses monotone equations to evaluate the correlation between two statistical variables. When the two variables are completely monotone and positively correlated, the Spearman correlation coefficient is 1; when the two variables are completely monotone and negatively correlated, the Spearman correlation coefficient is −1. That is to say, the closer the Spearman correlation coefficient is to 1, the closer the two variables are.
The diversity model mentioned above was used to compare the distance changes of all particles to the point 0. After each iteration, we calculate and record the sum of the distances of the all particles from zero point and the values of the above diversity model. At the end of the algorithm, we selected the values of each diversity model in each iteration and compared them with the sum of the distances of the all particles from zero point to calculate Spearman correlation coefficient. The experiment was repeated ten times, the results are shown in Table 2. In the case of fixed population size and dimension, D all performs best, followed by E dim . Among all entropy methods, E dim has a significant advantage.

Introduction to Swarm Intelligence Algorithms
Firstly, the comparison algorithm used in this study is briefly introduced. PSO is derived from an analogy of bird flight [41]. In PSO, each particle flies in a D-dimensional solution space by learning its own experience and the experience of its neighbor. The position and velocity of each particle are expressed by . . , v D i , respectively. X i represents the current position of the i particle, and it also represents a possible solution of the optimization problem. V i represents the current velocity of the i particle, which determines the direction and step size of the particle's movement. Each particle learns from its own and global historical best positions, represented by pbest i = pbest 1 i , pbest 2 i , . . . , pbest D i and gbest i = gbest 1 i , gbest 2 i , . . . , gbest D i , respectively. The position and velocity of each particle are dynamically adjusted according to equations (11) and (12): where ω is the inertial weight, c 1 and c 2 are the acceleration factors, and rand1 d i and rand2 d i are two uniformly distributed random numbers in the range of [0,1]. Bare-bones PSO eliminates the velocity attribute of particles, and the position update formula of particles is obtained by random sampling in accordance with Gaussian distribution, which can be described in a mathematical language as follows: The particle is searched randomly in the M-dimensional space, the position of particle i is . , x D i , and the optimal flight position of particle i is pbest PBest is the global optimal position of the particle, and the symbol N(0,1) is the standard Gaussian distribution. The position update formula of particle i is shown in Equation (13):

The Swarm Intelligence Algorithm Control Method Based on Dimension Entropy
The disadvantage of traditional swarm intelligence algorithms is the premature loss of diversity. We want to come up with a mechanism: control the diversity to decrease slowly, maintain higher diversity in the early stage, and reduce the diversity in the late stage to promote convergence. So we propose a method to calculate and control population diversity according to dimensional entropy. Firstly, the following definitions are proposed: Redundant particle: Divide M (M is the population size) intervals on average in each dimension d ∈ [1, 2, . . . , n], count the number of particles in each interval. If a particle i ∈ [1, 2, . . . M] is in the largest set of dimensions d, let count k i +1, the particle with the largest count in a population is redundant particle.
It should be noted that redundant particles are not necessarily repeated particles or redundant particles, but according to the definition of dimensional entropy, we know that deleting redundant particles will inevitably increase dimensional entropy, while copying redundant particles will inevitably reduce dimensional entropy.
Based on this, we propose a strategy to control the diversity. When the diversity is too large, we copy a redundant particle and delete a particle with the worst fitness to reduce the diversity. On the contrary, when the diversity is too low, a redundant particle is deleted and a new random particle is added to achieve the purpose of increasing the diversity. The relevant algorithm pseudocode is shown in Algorithm 1:

Algorithm 1 Diversity control
Input: E dim : The dimensional entropy of the population in this iteration; E standard : The expected entropy of this iteration; Coord: The population Output: The new population 1 if E dim < E standard 2 delete a redundant particle; 3 add a new particle; 4 else if E dim > E standard 5 delete a worst particle; 6 copy a redundant particle; 7 end We want to set a standard for diversity to go down on a trajectory, E standard is the entropy value we expect to achieve in each iteration. This value is determined by the base curve.
We have experimented with four different kinds of base curves: straight line, convex curve, concave curve and broken line. These curves are shown in Figure 5. In order to compare the differences between different convergence criteria, we set a simple test function set for experiment. This test function set contains 7 basic test functions, the information is shown in Table 3. In the above test function, taking the linear diversity reduction standard as shown in Figure 5 as an example, the PSO algorithm uses the strategy of Algorithm 1, and its diversity changes are shown in Figure 6.
According to the diversity change curve, the diversity of the original algorithm will be reduced to the lowest value after about 50 iterations, and then the algorithm will stagnate. This phenomenon of premature loss of diversity is one of the reasons why swarm intelligence algorithm cannot achieve better results.
After using our strategy, diversity slowly declines on a curve that we have defined. In the early stage of the algorithm, there is still a phenomenon of a sharp decrease in the diversity. This is due to the rapid aggregation of particles at the beginning of the algorithm. In the middle and late stages of the algorithm, our method can achieve precise control.
We take these four convergent curves as input to the algorithm, PSO algorithm was used as the experimental algorithm, the experimental dimension is 10 dimensions. The experiment was repeated for 30 times. Compare the difference of optimization performance and population diversity brought by different curves on different functions. Advantageous test function results are marked in bold. The result is shown in Table 4.
According to the table, first of all, the concave curve has the highest average diversity, followed by the straight line, followed by the broken line, and the concave curve has the lowest average diversity.
In terms of the optimization results, the convex curve has higher pre -and mid-term diversity, which guarantees its wider development capability in the pre -and mid-term. This ability enables it to better discover hidden global optimal values, which may be the reason for its excellent performance in multi-modal functions. In the case of unimodal function, appropriately accelerating the convergence can enhance the exploration ability of the algorithm, so the linear curve with slightly faster multiplicity convergence can achieve better results. And for any function, a rapid loss of diversity is not a good strategy, as concave curves demonstrate.

Experiment and Discussion
In this section, we apply the improved strategy to the three algorithms mentioned in the previous chapter. CEC17 is selected as the test function, which is a test function set containing 29 functions. Among them, f 1 and f 3 are single-peak functions, f 4~f10 are simple multi-peak functions, f 11~f20 are mixed functions, and f 21~f30 are compound functions. CEC17 functions are shown in Table 5.   Composition Function 1 C 2100 F22 Composition Function 2 C 2200 F23 Composition Function 3 C 2300 F24 Composition Function 4 C 2400 F25 Composition Function 5 C 2500 F26 Composition Function 6 C 2600 F27 Composition Function 7 C 2700 F28 Composition Function 8 C 2800 F29 Composition Function 9 C 2900 F30 Composition Function 10 C 3000 The algorithms before and after the improvement are respectively referred to as PSO and PSOG. BBPSO and BBPSOG. The dimension of the experiment is 10, and the experiment was repeated 30 times. Parameter setting of the algorithm is shown in Table 6. Table 6. Parameter setting.

Conclusions
This paper proposes a species diversity measure based on the dimension entropy mechanism, which creatively combines dimension learning and entropy. An independent view of the different dimensions of entropy affords strong robustness, while the entropy value method enjoys strong adaptability to changes in population size and an ability to have a clear response. Dimension entropy controls the population diversity of the swarm intelligence algorithm update strategy, which relies on the dimension entropy calculation of population diversity. By controlling the redundant control particle diversity, the slow algorithm, under the control of a lower diversity, improved the previous rapid loss of diversity in the swarm intelligence algorithm caused by local optimal results of stagnation of the algorithm, and maintained the diversity to ensure algorithm convergence. The 29 on the cec17 test function verified the effectiveness of this strategy.