# Dynamic Inversion Method for Concrete Gravity Dam on Soft Rock Foundation
## 3 Improved Particle Swarm Optimization Algorithm  
### Particle Swarm Algorithm Fundamentals  
The particle swarm algorithm [23] is a global optimization evolutionary algorithm inspired by the collective behaviors of birds, such as feeding, migration, and flocking. It is known for its fast convergence and strong optimization capability. In this algorithm, the target solution of the optimization problem is abstracted as the feeding target of a bird flock, while potential solutions are represented as birds searching for food in a multidimensional space. To simplify the model, the flock is replaced with massless particles, each characterized by only two attributes: spatial position and evolutionary velocity [24]. In the search space, a particle's position represents its current solution to the optimization problem. The algorithm evaluates each solution using a fitness function to determine its quality. Two key positions influence the optimization speed of each particle: the best solution found by an individual particle over time and the best solution found by any particle in the swarm. Through continuous iterations updating particle positions and velocities, the algorithm gradually converges to the optimal solution [25]. Individuals in the particle swarm (PSO) algorithm are called particles, and each swarm consists of \(N\) particles randomly initialized in a \(D\) dimensional search space. During the search process, each particle \(i\) is represented by two vectors, i.e., the velocity vector \(v_{i}=[v_{i1},v_{i2},\ldots,v_{iD}]\) and the position vector \(X_{i}=[x_{i1},x_{i2},\ldots,x_{iD}]\). Each particle \(i\) updates its velocity and position using its personal historical best position \(\mathit{Pbest}_{i}=[\ \mathit{pbest}_{i1},\ \mathit{pbest}_{i2},\ldots,\ \mathit{pbest}_{iD}]\), and the global best position found so far. For simplicity, \(\mathit{Pb}_{i}\) is used to refer to \(\mathit{Pbest}_{i}\) and \(\mathit{Pg}\) is used to refer to \(\mathit{Gbest}\). The update formulas for \(v_{i}\) and \(X_{i}\) are shown in Equations (7) and (8):  
\[V_{il}^{t+1}=\omega V_{il}^{t}+c_{1}\tau_{1}\big{[}\mathit{Pb}_{il}^{t}-X_{il}^ {t}\big{]}+c_{2}\tau_{2}\big{[}\mathit{Pg}_{d}^{t}-X_{il}^{t}\big{]} \tag{7}\]  
\[X_{il}^{t+1}=X_{id}^{t}+V_{il}^{t+1} \tag{8}\]  
where \(V_{il}^{t}\) and \(X_{il}^{t}\) denote the velocity and position of the \(i\) particle at the \(t\) iteration in the \(d\)-th dimension; \(\mathit{Pb}_{il}^{t}\) is the best position searched by the \(i\) particle at the \(t\) iteration in the \(d\)-th dimension, and \(\mathit{Pg}_{d}^{t}\) is the best position searched by the whole swarm at the \(t\) iteration. \(t\) and \(t+1\) are the current and next iterations, respectively. \(\omega\) are the inertia weights, and \(c_{1}\) and \(c_{2}\) represent the acceleration coefficients of the particles with \(\mathit{Pb}_{il}^{t}\) and \(\mathit{Pg}_{d}^{t}\) weights, respectively. \(\tau_{1}\) and \(\tau_{2}\) are random numbers in the range [0, 1]. The personal historical best position and global best position of each particle are updated in each iteration using Equations (9) and (10), respectively:  
\[\mathit{Pb}_{il}^{t+1}=\left\{ \begin{array}{l}X_{il}^{t+1},f\Big{(}X_{il}^{ t+1}\Big{)}\leq f\big{(}\mathit{Pb}_{il}^{t}\big{)}\\ \mathit{Pb}_{il}^{t},f\Big{(}X_{il}^{t+1}\Big{)}>f\big{(}\mathit{Pb}_{il}^{t} \big{)}\end{array} \right. \tag{9}\]  
\[\mathit{Pg}_{d}^{t+1}=\left\{ \begin{array}{l}\mathit{Pg}_{d}^{t},f\big{(} \mathit{Pg}_{d}^{t}\big{)}\leq\min_{i}\Big{(}f\Big{(}\mathit{Pb}_{il}^{t+1} \Big{)}\Big{)}\\ \mathit{Pb}_{il}^{t+1},f\big{(}\mathit{Pg}_{d}^{t}\big{)}>\min_{i}\Big{(}f\Big{(} \mathit{Pb}_{il}^{t+1}\Big{)}\Big{)}\end{array} \right. \tag{10}\]  
In the above equation, \(f\) is the objective function of the optimization problem, and \(\mathit{Pb}_{il}\) and \(\mathit{Pg}_{d}\) are updated as an example for taking the minimum value. Thus, the particle velocity update equation (Equation (8)) consists of three components.