Improved Particle Swarm Optimization Based on Entropy and Its Application in Implicit Generalized Predictive Control

Setting sights on the problem of input-output constraints in most industrial systems, an implicit generalized predictive control algorithm based on an improved particle swarm optimization algorithm (PSO) is presented in this paper. PSO has the advantages of high precision and fast convergence speed in solving constraint problems. In order to effectively avoid the problems of premature and slow operation in the later stage, combined with the idea of the entropy of system (SR), a new weight attenuation strategy and local jump out optimization strategy are introduced into PSO. The velocity update mechanism is cancelled, and the algorithm is adjusted respectively in the iterative process and after falling into local optimization. The improved PSO is used to optimize the performance index in predictive control. The combination of PSO and gradient optimization for rolling-horizon improves the optimization effect of the algorithm. The simulation results show that the system overshoot is reduced by about 7.5% and the settling time is reduced by about 6% compared with the implicit generalized predictive control algorithm based on particle swarm optimization algorithm (PSO-IGPC).


Introduction
In the development of the industrial field in recent years, predictive control has been widely used in IT, electric power, aerospace, automobile, and other fields because of its wide application range of predictive model, rolling-horizon, and good control effect [1][2][3][4]. In 1987, Clarke and Mohtadi propose the generalized predictive control algorithm (GPC) [5]. GPC retains the essential characteristics of model algorithm control (MAC) and dynamic matrix control (DMC). Its model adopts the controlled auto regressive integrated moving average (CARIMA), and combines adaptive control with predictive control to eliminate the output error of the predictive model caused by slow time-varying process parameters. Although adaptive control technology is widely valued in the industry, it requires high model accuracy. GPC not only combines the characteristics of online identification of adaptive control and is suitable for stochastic systems, it also retains the rolling-horizon part of predictive control and widely applicable models [6]. Based on GPC, implicit generalized predictive control (IGPC) eliminates the solution of the Diophantine equation and avoids the problems of large amounts of calculation and cumbersome processes [7]. This makes IGPC more widely used in the production process.
In terms of rapidity, robustness, and stability, the control result of GPC is more notable than that of traditional PID control [8,9]. Nowadays, most scholars improve GPC in two aspects: The establishment of the prediction model and the improvement of the optimization method. Cheng [10] enhances the control effect by combining fuzzy control modeling and predictive control, but the problems pointed out in this paper still cannot be solved. R.C and T.E [11] obtain the controlled object model through the slope algorithm

Improved Particle Swarm Optimization Algorithm
The principle of PSO is introduced in Section 2.1. Due to the problems of premature and low optimization accuracy of a high-dimensional function, the effect of combining PSO with GPC is not good. In the process of optimization, PSO is improved by the methods shown in Sections 2.2 and 2.3 to reduce the occurrence of premature. After precocity, the threshold judgment strategy shown in Section 2.4 is added to adjust it. The simulation results are shown in Section 2.5.

Particle Swarm Optimization Algorithm
There are a limited number of M particles in the population. Each of them has two attributes: Position, P and velocity, V. In each iteration, the particle will move towards the optimal position of its nearby area, and the velocity and position will be updated. The particle search space is D-dimensional. The position information of particle "i" is expressed as k id and the velocity information is v id . The individual extreme value of each particle is called g id , and the extreme value of the entire population is called g gd . In each iteration, the current fitness of a particle will be compared with its individual optimal fitness, the better one will be selected for updating, and then the optimal individual extreme value in the population will be selected to compare and update the global optimal. The formula of PSO [29] first proposed by Kennedy and Clerc is as follows: In Formulas (1) and (2), ω is the inertia weight; i = 1, 2, . . . . . . , m; rand is a natural number that varies randomly between 0 and 1; c 1 and c 2 are learning factors, and c 1 = c 2 = 2 is generally taken according to experience; velocity update is limited to v id ∈ [v id min, v id max]; and the location update is limited to k id ∈ [k id min, k id max].

Remove the Influence of Velocity Term
PSO imitates the foraging activities of birds. Each "bird" constantly updates the velocity and position, as shown in Equations (1) and (2), but the position update is only superimposed with the velocity term, which cannot well reflect the actual process of "foraging". After analysis, it is found that the velocity term is unnecessary. The process of each particle optimization is to make the position term approach the optimal value infinitely, and the velocity represents the "moving direction", which also brings the possibility of being far away from the destination, that is, divergence. The velocity term is removed and the position is updated directly, which improves the convergence velocity and accuracy to a certain extent. Firstly, preprocess Equations (1) and (2), make a = c 1 r 1 , b = c 2 r 2 and d = ag id +bg gd a+b , and write Equations (1) and (2) as follows: From Equations (3) and (4): After sorting: It can be seen from Equation (6) that the velocity term has no influence on the algorithm, and the influence of the velocity term constraint on the optimization of the algorithm is eliminated after being removed.

Weight Attenuation Strategy Combined with SR
Entropy represents the degree of chaos of the system, that is, the greater the degree of chaos of the system, the greater the entropy. We can regard the particle and search space of PSO as a system and analyze PSO from the change of entropy in the system. In the process of PSO optimization, the SR changes from time to time. When the particle falls into the local optimum, the SR reaches a very small value. According to the principle of minimum entropy, if the population has no strong external interference, the total entropy Entropy 2022, 24, 48 4 of 15 of the system is always decreasing and the order is increasing. From this point of view, if the particle wants to jump out of local optimization, we can impose an interference on the system to increase its total entropy and enhance the degree of chaos.
In the process of population particle optimization, the inertia weight coefficient ω affects the particle search effect and optimization accuracy. When ω is large, the corresponding global search ability is strong, and when ω is small, the corresponding local search is more accurate. Most scholars' improvement on weight is to make it decrease in medium proportion in the iterative process, as shown in Figure 1 (w1). In Figure 1, the horizontal axis is time and the vertical axis is the value of weight. First, conduct a global and large-scale search, and then reduce the accuracy in the later stage of the iteration. Some adopt the weight decreasing strategy of concave function or convex function. When the number of iterations increases, the weight reduction speed slows down, as shown in Figure 1 (w2 and w3).

Weight Attenuation Strategy Combined with SR
Entropy represents the degree of chaos of the system, that is, the greater the degree of chaos of the system, the greater the entropy. We can regard the particle and search space of PSO as a system and analyze PSO from the change of entropy in the system. In the process of PSO optimization, the SR changes from time to time. When the particle falls into the local optimum, the SR reaches a very small value. According to the principle of minimum entropy, if the population has no strong external interference, the total entropy of the system is always decreasing and the order is increasing. From this point of view, if the particle wants to jump out of local optimization, we can impose an interference on the system to increase its total entropy and enhance the degree of chaos.
In the process of population particle optimization, the inertia weight coefficient ω affects the particle search effect and optimization accuracy. When ω is large, the corresponding global search ability is strong, and when ω is small, the corresponding local search is more accurate. Most scholars' improvement on weight is to make it decrease in medium proportion in the iterative process, as shown in Figure 1 (w1). In Figure 1, the horizontal axis is time and the vertical axis is the value of weight. First, conduct a global and large-scale search, and then reduce the accuracy in the later stage of the iteration. Some adopt the weight decreasing strategy of concave function or convex function. When the number of iterations increases, the weight reduction speed slows down, as shown in Figure 1 (w2 and w3). However, it does not bring much improvement to the problem of PSO falling into local optimization. Aimed towards the problem, combined with the concept of SR, this paper adds the idea of intermediate enhancement in the process of weight attenuation, that is, the strategy of rising again in the middle of the iteration, showing the trend of combining concave function and convex function, as shown in Figure 1 (w4). A disturbance is added in the middle of the iteration to increase the entropy and chaos of the system. Its function is to carry out a global search at the maximum speed in the initial stage, and give full play to the early advantages of PSO as much as possible. In the middle of the iteration, some particles will enter the local optimum, and the change of position item is small. At this time, increase the proportion of global search to make the particles jump out of the local wandering state and search for the optimal value again. Finally, the weight is reduced to the minimum and the local search accuracy is improved to the maximum. The relationship between weight and iteration times is as follows: However, it does not bring much improvement to the problem of PSO falling into local optimization. Aimed towards the problem, combined with the concept of SR, this paper adds the idea of intermediate enhancement in the process of weight attenuation, that is, the strategy of rising again in the middle of the iteration, showing the trend of combining concave function and convex function, as shown in Figure 1 (w4). A disturbance is added in the middle of the iteration to increase the entropy and chaos of the system. Its function is to carry out a global search at the maximum speed in the initial stage, and give full play to the early advantages of PSO as much as possible. In the middle of the iteration, some particles will enter the local optimum, and the change of position item is small. At this time, increase the proportion of global search to make the particles jump out of the local wandering state and search for the optimal value again. Finally, the weight is reduced to the minimum and the local search accuracy is improved to the maximum. The relationship between weight and iteration times is as follows: In the formula, ω ∈ [ω min , ω max ] and t are the current iteration population times, T is the maximum population iteration times, and e is the natural constant. According to experience, when ω is 0.8, it can reach the global optimal position faster. In this paper, ω min = 0 and ω max = 0.8 are taken.

Local Optimal Judgment Threshold
Usually, PSO will fall into local optimization in the process of optimization, which makes the control effect worse or unable to meet the requirements. At this time, the SR becomes smaller and the system is more orderly. In order to enhance the global search ability, that is, increase the SR, Sections 2.2 and 2.3 are measures to reduce this local phenomenon in the iterative process, and this section introduces the judgment threshold. In the population iteration process, when the number of times that the individual optimal value of a particle stops updating exceeds the threshold, the active position update mechanism is implemented to make the particle move to the historical position vector and the opposite direction for re-optimization and to increase the degree of confusion and the SR, as shown in Figure 2. This method aims to determine the particle moving state and jump out of the local optimum, so as to enhance the performance of the algorithm.
In the formula, ω ω ω ∈ and t are the current iteration population times, T is the maximum population iteration times, and e is the natural constant. According to experience, when ω is 0.8, it can reach the global optimal position faster. In this paper, min 0 ω = and max 0.8 ω = are taken.

Local Optimal Judgment Threshold
Usually, PSO will fall into local optimization in the process of optimization, which makes the control effect worse or unable to meet the requirements. At this time, the SR becomes smaller and the system is more orderly. In order to enhance the global search ability, that is, increase the SR, Sections 2.2 and 2.3 are measures to reduce this local phenomenon in the iterative process, and this section introduces the judgment threshold. In the population iteration process, when the number of times that the individual optimal value of a particle stops updating exceeds the threshold, the active position update mechanism is implemented to make the particle move to the historical position vector and the opposite direction for re-optimization and to increase the degree of confusion and the SR, as shown in Figure 2. This method aims to determine the particle moving state and jump out of the local optimum, so as to enhance the performance of the algorithm. Assuming that ① to ③ in the figure is the trajectory of a particle in turn, the individual optimal value id g of the particle after each position update is compared and updated. Due to the uncontrollability of the nonlinear system, the scope of this mechanism is set in the whole iterative process so as to maintain the global effect in the early stage and the local accuracy in the later stage. If id g for four consecutive times is the same as the previous time, it means that the particle falls into the local optimal state. At this time, the particle position is updated again. As shown in the figure, the current motion position forcibly jumps out of the local search according to the vector and reverse motion of the historical three motion positions to keep the particle active. The formula of particle local determination and position update mechanism is as follows: In the formula, ( ) id th t is the position judgment value of the "i" particle at time t.
When the individual optimal value is the same as the previous time, the judgment value is one; otherwise, it is zero. When the cumulative value of four consecutive judgment values is equal to the threshold, forced position update: Assuming that 1 to 3 in the figure is the trajectory of a particle in turn, the individual optimal value g id of the particle after each position update is compared and updated. Due to the uncontrollability of the nonlinear system, the scope of this mechanism is set in the whole iterative process so as to maintain the global effect in the early stage and the local accuracy in the later stage. If g id for four consecutive times is the same as the previous time, it means that the particle falls into the local optimal state. At this time, the particle position is updated again. As shown in the figure, the current motion position forcibly jumps out of the local search according to the vector and reverse motion of the historical three motion positions to keep the particle active. The formula of particle local determination and position update mechanism is as follows: In the formula, th id (t) is the position judgment value of the "i" particle at time t. When the individual optimal value is the same as the previous time, the judgment value is one; otherwise, it is zero. When the cumulative value of four consecutive judgment values is equal to the threshold, forced position update: th id (t) = 0.
After the position is updated, set the judgment value to zero. The location update itself is random, so the random factor is no longer added.

Simulation Analysis
The optimization ability of the improved PSO needs to be tested separately. The test is divided into four different algorithms: PSO, PSO with new weight strategy (wPSO), PSO with velocity term removed and weight strategy added (wdPSO), and through the improved particle swarm optimization (SPPSO) in Section 2. Next, the four algorithms will be compared and tested through six high-dimensional test functions to show their optimization efficiency and accuracy. We have carried out 30-dimensional, 50-dimensional, and 80-dimensional tests respectively, and found that the results can achieve the optimization effect. In order to highlight the effect of the algorithm, this paper shows the test results under 80 dimensional.
Among them, the number of iterations M = 1000, population particle N = 60, dimension D = 80, and unimodal functions are shown in F1, F2, and F3 of Table 1. And F4, F5, and F6 are multimodal functions.

Function Name Function
u(x i , 5, 100, 4) + 1 10 sin 2 (πx 1 ) + 1 10 (x m − 1) 2 sin 2 (2πx i+1 ) + 1 To verify the universality of the simulation results, more than 20 tests have been carried out for each test, and the optimal value corresponding to the fitness function is shown in Table 2. In the table, X represents the number of iterations for the algorithm to find the best value. We can clearly see that the first two algorithms are not good at optimizing highdimensional functions, and the changing trend of the global optimal value is shown in Figure 3. For the unimodal function, it can be seen that the convergence speed of PSO and wPSO is relatively slow, but the optimization accuracy of wPSO will be better than that of PSO. By increasing the SR, changing the weight and jumping out of the local optimization, we can achieve a better optimization effect. The results of wdPSO and SPPSO are similar, which shows that the improvement of the algorithm is more obvious by removing the speed term and retaining only the position term. mensional functions, and the changing trend of the global optimal value is shown in Figure 3. For the unimodal function, it can be seen that the convergence speed of PSO and wPSO is relatively slow, but the optimization accuracy of wPSO will be better than that of PSO. By increasing the SR, changing the weight and jumping out of the local optimization, we can achieve a better optimization effect. The results of wdPSO and SPPSO are similar, which shows that the improvement of the algorithm is more obvious by removing the speed term and retaining only the position term. In the multimodal function, as shown in Figure 4a,c, wdPSO also has the same problem, while SPPSO also maintains good optimization speed and accuracy. It jumps out of the premature situation through the setting of the threshold, and the effect is better than other algorithms.  In the multimodal function, as shown in Figure 4a,c, wdPSO also has the same problem, while SPPSO also maintains good optimization speed and accuracy. It jumps out of the premature situation through the setting of the threshold, and the effect is better than other algorithms.

Implicit Generalized Predictive Control Algorithm-Based SPPSO
Section 3.1 first introduces the principle of GPC. Due to the poor control effect of GPC under constraints, this paper adds the improved algorithm SPPSO to IGPC for joint optimization. The specific steps and schematic diagram are shown in Section 3.2.

Generalized Predictive Control Algorithm
GPC includes prediction model, rolling-horizon, feedback correction, and other modules.

Prediction Model
The controlled object of GPC is usually described by the CARIMA model: In the formula, at both ends of Equation (11) and ignore the future time disturbance. According to Equation (12), the output prediction value at t j + time is expressed as follows:

Implicit Generalized Predictive Control Algorithm-Based SPPSO
Section 3.1 first introduces the principle of GPC. Due to the poor control effect of GPC under constraints, this paper adds the improved algorithm SPPSO to IGPC for joint optimization. The specific steps and schematic diagram are shown in Section 3.2.

Generalized Predictive Control Algorithm
GPC includes prediction model, rolling-horizon, feedback correction, and other modules.

Prediction Model
The controlled object of GPC is usually described by the CARIMA model: In the formula, A(z −1 ), B(z −1 ), and C(z −1 ) are the polynomial of B. The difference operator is ∆ = 1 − z −1 . For the convenience of calculation, the delay of the system is assumed to be d = 1. Of course, just make the coefficient of the first d − 1 term of polynomial B(z −1 ) equal to zero if d > 1 [30]. ω(t) is a white noise sequence. In order to highlight the advantages of the algorithm, let us make C(z −1 ) = 1. So as to derive the predicted value after step J, the Diophantine equation is introduced to solve it: Multiply E j (z −1 )(z j − z j−1 ) at both ends of Equation (11) and ignore the future time disturbance. According to Equation (12), the output prediction value at t + j time is expressed as follows: Entropy 2022, 24, 48 10 of 15
Among them, ω(t + j) is the reference track; y r is the set value; E is the mathematical expectation; n and m are the prediction and control time domains, respectively, that is, the control quantities are equal after step m; and λ and σ are the weighting coefficient and softening factor respectively, σ ∈ [0, 1). According to Formula (14), Equation (15) is written as a vector in the form of: In Formula (17), ω = [ω(k + 1), . . . . . . , ω(k + n)]. When G T G + λI is a nonsingular matrix, the optimal solution of Equation (17) is:

Improved Particle Swarm Optimization-Based IGPC
Because the actual industrial production often has constraint problems, GPC cannot meet the control effect, so the author introduces PSO, and improves the problems of premature, slow optimization, and falling into local optimization when PSO is used to deal with high-dimensional systems. It is found that the optimization effect of GPC at the "boundary" is not ideal when dealing with the problem with constraints. Therefore, the PSO is combined with the gradient optimization of predictive control, and the algorithm is improved in the optimization process and after judgment. Due to the large amount of calculation and the cumbersome process of solving the Diophantine equation, the implicit generalized predictive control algorithm (IGPC) is selected in this paper. When 1 2 ∆u min < ∆u < 1 2 ∆u max , the gradient optimization of GPC is used to solve the optimal control rate. When ∆u min < ∆u < 1 2 ∆u min or 1 2 ∆u max < ∆u < ∆u max , the improved PSO is used for optimization. Figure 5 is its schematic diagram. Take the performance index of rolling-horizon as the fitness function of PSO, which is Formula (15):  Firstly, the reference trajectory is calculated through the given value, and then the feedback correction is carried out in combination with the difference between the predicted output and the actual output, so as to calculate the control increment at the next time and output it to the controlled object. The steps of improving the algorithm are shown in Table 3. Firstly, the reference trajectory is calculated through the given value, and then the feedback correction is carried out in combination with the difference between the predicted output and the actual output, so as to calculate the control increment at the next time and output it to the controlled object. The steps of improving the algorithm are shown in Table 3. Table 3. Algorithm steps.
Step Content Step 1 Set the given value y r , initialize the parameters and storage variables, and calculate the prediction model Formula (11).
Step 2 Use IGPC to solve the control increment ∆u, and judge whether SPPSO is used for optimization according to the ∆u constraint range. If the result is Yes, go to Step 3; if the result is No, go to Step 4.
Step 3 Initialize the population, set Equation (15) as the fitness function for optimization.
Step 4 Work out the system input u(t) according to equation (19), and then calculate the output y(t).
Step 5 Update the status storage sequence and repeat steps two through five until control is complete.
The system flow chart is shown in Figure 6.

Simulation Study
Aiming towards the problems with constraints in actual industrial production, this paper combines the improved PSO with IGPC for predictive control. In the control effect test, it is compared with IGPC, PSO-IGPC, and AMPSO-IGPC in the literature [16], respectively. The results are as follows. The vehicle engine system model studied in reference [7]:

Simulation Study
Aiming towards the problems with constraints in actual industrial production, this paper combines the improved PSO with IGPC for predictive control. In the control effect test, it is compared with IGPC, PSO-IGPC, and AMPSO-IGPC in the literature [16], respectively. The results are as follows. The vehicle engine system model studied in reference [7]: IGPC parameter settings: y r is a square wave signal; n = 6; m = 2; λ = 0.6; σ = 0.35; and ∆u min = −1, ∆u max = 1.
In Figure 7a,b, the overshoot of the control system is reduced after the combination of PSO and IGPC. Still, the settling time and fluctuation range of the control rate do not change, the overall effect is poor and the improvement is limited. However, in industrial production, the system is accompanied by unknown interference at any time, and the adjustment time needs to be reduced as much as possible. If the control system becomes a high-dimensional system, the control effect of PSO-IGPC will not meet the requirements after adding interference. The simulation is carried out according to the method provided in document [16], and the results are shown in Figure 7c. AMPSO-IGPC can reduce the overshoot and enhance the ability to track the given value. However, the fluctuation of control increment is still obvious. After combining SPPSO with GPC, it can be seen in Figure 7a,d that the overshoot of the control system is reduced, about 7.5% less than that of the traditional IGPC. The settling time is shortened by about 6%, the fluctuation of the control rate is reduced, and the control effect is excellent. This proves that our improvement is effective and can deal with a series of problems about real-time and randomness in the actual production environment. adjustment time needs to be reduced as much as possible. If the control system becomes a high-dimensional system, the control effect of PSO-IGPC will not meet the requirements after adding interference. The simulation is carried out according to the method provided in document [16], and the results are shown in Figure 7c. AMPSO-IGPC can reduce the overshoot and enhance the ability to track the given value. However, the fluctuation of control increment is still obvious. After combining SPPSO with GPC, it can be seen in Figure 7a,d that the overshoot of the control system is reduced, about 7.5% less than that of the traditional IGPC. The settling time is shortened by about 6%, the fluctuation of the control rate is reduced, and the control effect is excellent. This proves that our improvement is effective and can deal with a series of problems about real-time and randomness in the actual production environment.

Conclusions
So as to deal with the control problem of the generalized predictive control algorithm under constraints, PSO is introduced to improve. In the research process, combined with the idea of SR, the premature problem in a high-dimensional environment is processed and improved accordingly. On the basis of removing the speed term, the weight attenuation strategy combined with SR and the threshold judgment mechanism are added, respectively. The improved algorithm is simulated with MATLAB software and compared with other algorithms. The results show that the optimization accuracy and time of SPPSO are better, and the performance is better in a high-dimensional environment. Then IGPC and SPPSO are combined for predictive control. In the simulation example, it can be seen that the control effect is improved, and is faster and smoother than the traditional PID

Conclusions
So as to deal with the control problem of the generalized predictive control algorithm under constraints, PSO is introduced to improve. In the research process, combined with the idea of SR, the premature problem in a high-dimensional environment is processed and improved accordingly. On the basis of removing the speed term, the weight attenuation strategy combined with SR and the threshold judgment mechanism are added, respectively. The improved algorithm is simulated with MATLAB software and compared with other algorithms. The results show that the optimization accuracy and time of SPPSO are better, and the performance is better in a high-dimensional environment. Then IGPC and SPPSO are combined for predictive control. In the simulation example, it can be seen that the control effect is improved, and is faster and smoother than the traditional PID control or GPC control. In future studies, the algorithm will be applied to more complex working conditions to highlight its advantages.