# Dynamic Inversion Method for Concrete Gravity Dam on Soft Rock Foundation
## 3 Improved Particle Swarm Optimization Algorithm
### Improvement Strategy  
The particle swarm optimization (PSO) algorithm differs from genetic algorithms in that it does not involve crossover or mutation operations. Instead, it relies solely on particle velocity to perform the search. During iterative evolution, only the information from the optimal particle is shared with other particles, resulting in a fast search speed. Additionally, PSO has a simple structure, requires fewer adjustable parameters, and is easy to implement in engineering applications. It employs real-number encoding, where the number of variables in the problem directly corresponds to the number of dimensions in the particle space, ensuring a direct representation of the optimization problem.  
A key challenge in PSO is balancing global and local search capabilities, which remains a crucial issue in optimization [27]. To address this, an adaptive inertia weight parameter is introduced to enhance the algorithm's performance. By adjusting inertia weights dynamically based on particle positions during the search process, the optimized PSO algorithm improves convergence toward the global optimum while reducing the risk of being trapped in a local optimum. The fundamental process of the algorithm is as follows.  
Assuming that the number of kinetic-elastic modulus regions to be inverted is \(m\) and that an initial population is formed by \(n\) particles, the initial population of particles \(E\) in \(n\times m\) space is Equation (11):  
\[E=\begin{bmatrix}E_{11}&E_{12}&\cdots&E_{1m}\\ E_{21}&E_{22}&\cdots&E_{2m}\\ \vdots&\vdots&\ldots&\vdots\\ E_{n1}&E_{n2}&\cdots&E_{mn}\end{bmatrix} \tag{11}\]  
If the velocity \(v_{i}=(v_{i1},v_{i2},\cdots,v_{im})\) and position \(x_{i}=(x_{i1},x_{i2},\cdots,x_{im})\) of the first \(i\) particle in the population, after determining the initialized particle population information, the adaptation value \(J(E_{i})\) of each particle is calculated and the individual extreme value \(P_{i}=(P_{i1},P_{i2},\cdots,P_{im})\) and global extreme value \(g_{i}=(g_{i1},g_{i2},\cdots,g_{im})\) of the \(i\)-th particle in the population are determined at the same time. The particle determines the running direction and velocity of the next generation through its own experience and the experience of the group; for the \(k+1\) generation of particles, the velocity and position of the particle are updated as Equation (12) according to the following equation:  
\[\left\{\begin{array}{ll}v_{id}^{k+1}=\omega v_{id}^{k}+c_{1}r_{1}\Big{(}p_{ id}^{k}-x_{id}^{k}\Big{)}+c_{2}r_{2}\Big{(}g_{d}^{k}-x_{id}^{k}\Big{)}\\ x_{id}^{k+1}=v_{id}^{k}+v_{id}^{k+1}\\ \omega=\begin{cases}\omega_{\min}-\frac{(\omega_{\max}-\omega_{\min})(I_{1}-I _{\min})}{I_{mg}-I_{\min}}&,J_{1}\leq J_{arg}\\ \omega_{\max}&,J_{1}>J_{arg}\end{cases}\end{array}\right. \tag{12}\]  
where \(c_{1}\), \(c_{2}\) is the learning factor; \(r_{1}\), \(r_{2}\) are uniform random numbers in the range of \([0,1]\); \(v_{id}^{k}\), \(x_{id}^{k}\) are the velocity and position of the particle \(i\) in the \(d\)-th dimension of the \(k\)-th iteration; \(p_{id}^{k}\) is the position of the particle \(i\) in the \(d\)-th dimension of the smallest individual adaptation value; \(g_{d}^{k}\) is the position of the particle in the \(d\)-th dimension of the smallest population adaptation value; \(\omega\) is the inertia weights; \(\omega_{\min}\), \(\omega_{\max}\) are the minimum and maximum of the inertia weights; \(J_{t}\) represents the real-time adaptation value of the particle; \(J_{arg}\), \(J_{\min}\) are the average and minimum fitness values, respectively, across all particles in the current iteration. When the number of iterations or the stop condition is reached, the search is stopped and the optimal value is output; otherwise, the search will continue to iterate and update the particles until the search reaches a value that satisfies the convergence criterion.