## 3 Methods
### Fire Point Location
The best fitness is defined as the shortest flight path of the UAVs and can be expressed as follows:  
\[Fitness=\min(\sum_{i=1}^{N1}\sqrt{\left(x_{i+1}-x_{i}\right)^{2}+\left(y_{i+ 1}-y_{i}\right)^{2}+\left(z_{i+1}-z_{i}\right)^{2}}) \tag{4}\]  
where \(\left(x_{i+1},y_{i+1},z_{i+1}\right)\) and \(\left(x_{i},y_{i},z_{i}\right)\) represent the 3D coordinates at \(i_{th}\) and \(i+1_{th}\) path points in the UAV flight environment, respectively. \(N1\) is the number of the path points, including the starting point, the particle position, and the ending point. In addition to continuously optimizing the flight direction of the UAVs based on the fitness function, the PSO algorithm needs to be constrained by the terrain and environment. To avoid collisions, UAVs should always fly higher than the terrain height. Moreover, toplan better paths and reduce costs, UAVs are stipulated to only work within designated areas. The constraints are expressed as follows:  
\[1\leq x_{i}\leq x_{max} \tag{5}\]  
\[1\leq y_{i}\leq y_{max} \tag{6}\]  
\[Z(x_{i},y_{i})<z_{i}\leq z_{max} \tag{7}\]  
where \((x_{max},y_{max},z_{max})\) represents the maximum range that UAVs can fly, \(Z(x_{i},y_{i})\) represents the height of the mountain forest under the \((x_{i},y_{i})\) coordinate according to the Equation (1). In order to ensure the feasibility of the UAV flight trajectory and reduce the algorithm calculation time, it is necessary to smooth the flight trajectory. Since the flight path of the UAV is related to ordered spatial point coordinates, this paper utilizes a cubic B-spline interpolation algorithm to smooth the flight path [32; 33; 34]. The sequence of coordinates of the space points flow by the UAV can be represented as \(\{S,T_{1},T_{2},\ldots T_{\rm{N1}},\mathrm{E}\}\), where \(S\) is the starting point coordinate, \(E\) is the ending point coordinate, \(T_{i}\) is the particle point coordinate from the particle swarm optimization algorithm. Based on the cubic B-spline interpolation algorithm, the \((X_{t},Y_{t},Z_{t})\) coordinates of any point in the smoothed UAV flight path can be represented as follows:  
\[X_{t}=\sum_{i=0}^{m}X_{i}F_{i,k}(t) \tag{8}\]  
\[Y_{t}=\sum_{i=0}^{m}Y_{i}F_{i,k}(t) \tag{9}\]  
\[Z_{t}=\sum_{i=0}^{m}Z_{i}F_{i,k}(t) \tag{10}\]  
where \((X_{i},Y_{i},Z_{i})\) represents the coordinate of the control point in the cubic B-spline interpolation algorithm, \(F_{i,k}(t)\) represents cubic B-spline basis function, \(k\) is the order, \(m\) is the number of control points. The procedure for mountain forest fire point location based on the UAV swarm path planning algorithm is illustrated in Figure 4. Firstly, initialize particle swarm parameters, such as the particle swarm size, dimension, number of iterations, inertia weight, learning factor, and so on. Secondly, randomly initialize the position and velocity of each particle, record the individual optimal position and the group optimal position, and calculate the fitness value of each particle according to Equations (4) and (8)-(10). Thirdly, check if the particle's position complies with the stipulated conditions according to Equations (5)-(7). Fourthly, update the velocity and position of each particle according to Equations (2) and (3). Fifthly, update the historical optimal fitness value and position of each particle and the group until the iteration is completed. Finally, output the particle position and draw the UAV flight path diagram along with the mountain forest fire location.