## 5 Particle Swarm Optimization Algorithm
### Improved Particle Swarm Optimization Algorithm
#### 5.3.1 Fuzzy System  
For the traditional particle swarm optimization algorithm, the parameter \(c_{1}\) or self-cognition factor indicates the importance of the particle to its previous optimal position. When \(c_{1}=0\), the particle will lose the diversity of the population, which will easily lead to a local optimal solution. The parameter \(c_{2}\) or social cognitive factor indicates the importance of the particle to the global optimal position. When \(c_{2}=0\), the particles will lose the information shared by the society, and it is easy to cause the problem of the convergence speed being too slow. In the traditional particle swarm optimization algorithm, the learning factors \(c_{1}\) and \(c_{2}\) are fixed in the whole process of the algorithm. If the parameter values are not selected properly, it will greatly affect the performance of the particle swarm optimization algorithm. In the running process of the particle swarm optimization algorithm, adjusting the value of \(c_{1}\), \(c_{2}\) dynamically will allow for better algorithm performance.  
Figure 3: Fuzzy system.  
The input range of the fuzzy system is \(0\sim 1\), and the output range is \(0\sim 3\). The input and output of the system are described by a triangular membership function; the input is divided into three fuzzy levels, and the output is divided into five fuzzy levels. The input and output membership functions are shown in Figure 4, and the input and output curves of the fuzzy inference system are shown in Figure 5.  
The number of iterations is expressed as a percentage, which expresses the degree of iteration of the particle swarm algorithm. The normalized number of iterations is:  
\[NI(k)=\frac{k}{M} \tag{17}\]  
The diversity of the population is expressed by the degree of dispersion between particles, which is obtained by measuring the average value of the Euclidean distance between each particle and the best particle. The population diversity \(D(k)\) is specifically as follows:  
\[D(k)=\frac{1}{M}\sum_{i=1}^{M}\|\dot{x}_{i}(k)-\dot{x}(k)\| \tag{18}\]  
where \(\dot{x}(k)\) is the global optimal particle before the \(k\) iteration. The normalized population diversity is defined as:  
\[ND(k)=\left\{\begin{array}{cc}0&,\min(D)=\max(D)\\ \frac{D(k)-\min(D)}{\max(D)-\min(D)},&\min(D)\
eq\max(D)\end{array}\right. \tag{19}\]  
Figure 4: Input-output membership function of fuzzy system.  
Figure 5: Input-output curve of fuzzy system.  
The population error is defined as the average of the sum of the difference between the fitness of each particle and the fitness of the best particle. The population error is defined as:  
\[E(k)=\frac{1}{M}\sum\limits_{i=1}^{M}\left(Fitness(x_{i}(k))-Fitness(\hat{x}(k))\right) \tag{20}\]  
The normalized population error is defined as:  
\[NE(k)=\left\{\begin{array}{cc}0,&\min(E)=\max(E)\\ \frac{E(k)-\min(E)}{\max(E)-\min(E)},&\min(E)\
eq\max(E)\end{array}\right. \tag{21}\]  
In the above formula, \(k\) is the \(k\) th iteration of the particle swarm optimization algorithm, \(M\) is the population size, and \(Fitness(x_{i})\) is the fitness value of the particle \(i\).