## 3 Simulation System
### Optimization of UAV Flight Path  
Using the created fingerprint database, localization simulations are performed to determine the flight paths of UAVs that can perform localization with higher accuracy.  
The determination of UAV flight paths can be viewed as an optimization problem that aims to minimize the 90 th percentile of the cumulative distribution of localization errors as our designed objective function. In order to study the effect of using UAVs, this paper examines the case where UAV sensors are hovering in the air and the case where a single UAV moves in a circular orbit. In the former case, the position coordinates of the sensors are used as input variables, and in the latter case, the position coordinates of the center of the circular orbit and the radius of the circular orbit are used as input variables.  
The RSSI used to evaluate the localization error is generated according to a probability distribution and is affected by the terrain, so the output of the objective function is a nonlinear function. In addition, the position coordinates take continuous values in space, and there are many different ways to take a path, making optimization by a full search difficult. Therefore, as explained in Appendix A, the particle swarm optimization (PSO) method is used as an approximate solution method that is compatible with nonlinear systems [19,20]. Given an objective function to be searched for, multiple particles move around in the search space in search of the optimal solution while sharing information with each other. PSO has attracted attention because of its simple algorithm, flexible parallel processing, and potential for various improvements [21]. It also works well with nonlinear systems and is suitable for cases such as this study.  
Based on the basic algorithm of PSO, we organize the optimization problem in this study. The optimization problem is to find the UAV sensor position coordinates \(\mathbf{u}\) that minimize \(E(\mathbf{u})\) with the 90% cumulative distribution value of localization errors as the objective function \(E(\mathbf{u})\). In this study, the CDF 90% value is used as an indicator of reliability as a location estimation system, but the objective function in this algorithm can be flexibly set according to the system designer's policy [11].  
\[\min_{\mathbf{u}}E(\mathbf{u}),\ \ \mathbf{u}=(\mathbf{u}_{1},\ldots,\mathbf{u}_{M} )\in\Gamma \tag{11}\]Here, \(\Gamma\) is the three-dimensional space that can be taken by the UAV sensor, and \(\mathbf{u}\) is normalized so that each element is \(0\leq\mathbf{u}\leq 1\). The position and velocity of the particles are updated by the following equations, respectively [11].  
\[\mathbf{u}_{i}(t+1)=\mathbf{u}_{i}(t)+\mathbf{v}_{i}(t+1) \tag{12}\]  
\[\mathbf{v}_{i}(t+1)=w\mathbf{v}_{i}(t)+c_{1}\Big{(}\mathbf{u}_{i}^{\text{bbest }}-\mathbf{u}_{i}(t)\Big{)}+c_{2}\Big{(}\mathbf{u}_{i}^{\text{gbest}}-\mathbf{ u}_{i}(t)\Big{)}, \tag{13}\]  
where \(t\) is the number of iterations to date, \(\mathbf{u}_{i}^{\text{bbest}}(t)\) is the personal best, and \(\mathbf{u}_{i}^{\text{gbest}}(t)\) is the value called the global best. The personal best is the particle position with the best value to date for that particle, and the global best is the best value of the personal best for all particles. The particle moves and searches for the optimal solution by iteratively updating \(t_{\text{MAX}}\) times, referring to the direction of the personal best and global best. The PSO parameters used in this paper are listed in Table 3.