# Prediction Model for Shield Tunneling Roll Angle and Pitch Angle: A PCA-PSO-LGBM Approach
## 2 Methodology
### Particle Swarm Optimization  
The Particle Swarm Optimization (PSO) algorithm is an optimization technique based on swarm intelligence, proposed by [PERSON] and [PERSON] in 1995. It simulates the social behavior of bird flocks in nature, seeking optimal solutions to complex problems through information sharing and collaboration among individuals. The PSO algorithm designs a massless particle to simulate birds in a flock, flying at a certain speed within the search space. Each particle has only two attributes: velocity and position. The position of the particle represents a potential solution, while the velocity determines its direction and distance of flight. Particles adjust their positions based on their own experiences and the experiences of the group, gradually approaching the optimal solution. The implementation process of Particle Swarm Optimization can be divided into the following steps.  
* Step 1: Initialize the particle swarm Initialize the particle swarm. First, create a particle class where each particle has position, velocity, and fitness values. These particles constitute the initial population. Next, define the fitness function for the problem, and set the population size (number of particles)and number of iterations. Randomly initialize each particle's position and velocity and set each particle's personal best position and the global best position for the entire swarm.
* Step 2: Evaluate fitness  
For each particle, calculate the fitness value based on its position. The fitness value is the objective function value at that position, which is the performance measure of the problem to be optimized.
* Step 3: Update the best values  
For each particle, if the current position's fitness value is better than its personal historical best position's fitness value, update the personal historical best position. Within the entire swarm, find the particle with the best fitness value and set its position as the best global position.
* Step 4: Update velocity and position  
This step is the core of the PSO algorithm. Based on the particle's current position, velocity, personal historical best position, and global best position, update the particle's velocity and position using the following equation:  
\[v_{i}^{t+1}=\omega\cdot v_{i}^{t}+c_{1}\cdot r_{1}\cdot(\mathit{pbest}_{i}-x_ {i}^{t})+c_{2}\cdot r_{2}\cdot(\mathit{gbest}-x_{i}^{t}), \tag{6}\]  
\[x_{i}^{t+1}=x_{i}^{t}+v_{i}^{t+1}, \tag{7}\]  
where \(v_{i}^{t+1}\) is the velocity of particle \(i\) in the next iteration \(t+1\). \(\omega\) is the inertia weight, controlling the degree to which the particle's velocity is retained and affecting the algorithm's global search capability. \(v_{i}^{t}\) is the velocity of particle \(i\) at the current iteration \(t\). \(c_{1}\) and \(c_{2}\) are acceleration coefficients, representing the individual learning factor and social learning factor, respectively. They control the extent to which particles move towards the individual optimum and the global optimum. \(r_{1}\) and \(r_{2}\) are random numbers within the interval [0, 1], adding randomness to the algorithm. \(\mathit{pbest}_{i}\) is the individual best position found by particle \(i\) so far. \(\mathit{gbest}\) is the best global position found by the entire swarm so far. \(x_{i}^{t}\) is the position of particle \(i\) at the current iteration \(t\). \(x_{i}^{t+1}\) is the position of particle \(i\) in the next iteration \(t+1\).
* Step 5: Check termination conditions Determine if the maximum number of iterations has been reached or if any other exit criteria have been met. If so, terminate the loop; otherwise, return to step two for further iterations.
* Step 6: Output the optimal solution found, which corresponds to the solution at the global best position.