## 2 Background
### Basic Theory
#### 2.2.4 Particle Swarm Optimization Algorithm  
PSO originated from humans' research on the group behavior of bird foraging. Its main idea is to use particles to simulate birds. Firstly, the particle group should be randomly initialized and then adapted. The degree function calculates the fitness value and the position of the next particle. At each iteration, the two positions are used to determine their position and velocity. One is its own historical optimal value, that is, the individual optimal value, and the other is the overall particle. The optimal value of the group is the global optimal value. Repeated iteration in this way, continuously learning and updating the position and speed to find the optimal value of the optimization problem [5].  
Assume that the position and velocity of the \(i\)-th particle in the D-dimensional space are \(X_{i}=(x_{i1},x_{i2},...,x_{id})\), \(V_{i}=(v_{i1},v_{i2},...,v_{id})\), the individual extremum of the particle. It is denoted as \(P_{i}=(p_{i1},p_{i2},...,p_{id})\), and the global extremum is recorded as \(G_{i}=(g_{i1},g_{i2},...,g_{id})\). After calculating the fitness, the particle will adjust the position and velocity of the current time \((t+1)\)according to the position and velocity of the previous time \(t\) and \(P_{i}\), \(G_{i}\). The \(j\)-th velocity and position update equation of the particle is:  
\[v_{ij}(t+1)=\omega v_{ij}(t)+c_{1}rand1_{ij}(p_{ij}(t)-x_{ij}(t))+c_{2}rand2_{ij }(g_{ij}(t)-x_{ij}(t)) \tag{1}\]  
\[x_{ij}(t+1)=x_{ij}(t)+v_{ij}(t+1) \tag{2}\]  
In Formula (4), \(\omega\) is the inertia weight, which can be used to coordinate the local and global search ability. It can be seen from the formula that \(\omega\) affects the current time \((t+1)\) by controlling the state of the previous time \(t\). When \(\omega\) is smaller, the local search ability is stronger and the global search ability is weaker; the larger the \(\omega\) is, the weaker the local search ability is, and the stronger the global search ability is. Where \(c_{1}\) and \(c_{2}\) are acceleration constants, called learning factors, which are used to adjust the step size of the particle's optimal and globally optimal position and direction motion respective-ly, \(c_{1}\) reflects the individuals cognitive ability of the particle, \(c_{2}\) reflects The cognitive ability of the group's group experience, when the learning factor is small, the particles will be paralyzed away from the optimal region, and when the learning factor is large, the particles will quickly fly to the optimal region. Where rand1 and rand2 are random numbers in the range [0, 1] generated to move the particles to the optimal position with an equal probability of acceleration. The selection of the above parameters greatly affects the optimization process and accuracy of the PSO algorithm.  
The processing of the PSO algorithm is as follows:  
1. Initialize the particle group, set the population size of the population to m, and set the particle velocity and position parameters, including the inertia weight \(\omega\), the learning factor \(c_{1}\) and \(c_{2}\), and the setting termination condition. The termination condition is generally the optimal fitness value meets the setting. The threshold or the maximum number of iterations.
2. Using the adaptive function to calculate the fitness of each particle, and compare it with the individual optimal value \(P_{i}\) and \(G_{i}\) the global optimal value in turn, if the current position is better, then replace, otherwise unchanged;
3. Adjust the particle velocity and position according to Formulas (4) and (5)
4. If the end condition is reached, the output parameter ends. If the end condition is not reached, go to 2.  
The process of the PSO algorithm is shown in Figure 1.