## 3 System Model and Problem Formulation
### Problem Formulation  
The main objective of UAVs in conducting search and rescue missions is to swiftly locate and approach the victim UEs to provide assistance. Therefore, there are two primary challenges: firstly, locating all UEs to determine the end point for the UAV, and secondly, finding an optimal trajectory to reach the UEs rapidly.  
With 5G NR positioning techniques, the estimated coordinates of UEs can be denoted as \(\hat{P}_{u_{i}}=(\hat{x}_{ue_{i}},\hat{y}_{u_{i}},\hat{z}_{u_{i}})\), where \(i=0,1,\ldots,M\). \(M\) is less than the total number of UEs \(|U|\). The reason is that some UEs may not be located because of the bad downlink or uplink reference signals when transmitting over disaster environment. Here, we define the estimated Emergency Area (EA) as a two-dimensional circle of center \(\hat{C}_{EA}\) and radius \(\hat{\rho}_{EA}\), calculated as follows:  
\[\hat{C}_{EA}=(\hat{x}_{EA},\hat{y}_{EA})=\left(\sum_{i=1}^{M} \frac{\hat{x}_{ue_{i}}}{M},\sum_{i=1}^{M}\frac{\hat{y}_{ue_{i}}}{M}\right) \tag{1}\] \[\hat{\rho}_{EA}=\max_{i=1}^{M}\{\left\|\hat{P}_{u_{i}}-\hat{C}_{ EA}\right\|\}=\max_{i=1}^{M}\biggl{\{}\sqrt{\left(\hat{x}_{ue_{i}}-\hat{x}_{ EA}\right)^{2}+\left(\hat{y}_{ue_{i}}-\hat{y}_{EA}\right)^{2}}\biggr{\}}\]  
In the three-dimensional space, the altitude of the EA is denoted as \(\hat{H}_{EA}=\max_{i=1}^{M}\{\hat{z}_{ue_{i}}+H_{0}\}\), where \(H_{0}\) is a constant value. \(H_{0}\) means that the UAV should maintain a certain flight altitude to ensure LoS connectivity with most UEs. At each time, the UAV always flies towards the estimated EA until it arrives. The trajectory of the UAV from the start point \((0,0,0)\) to the final point \(P_{uav}^{(N)}=(x_{uav}^{(N)},y_{uav}^{(N)},z_{uav}^{(N)})\) can be denoted as \(T_{juav}=\{(x_{uav}^{(j)},y_{uav}^{(j)},z_{uav}^{(j)})|j=0,1,\ldots,N\}\), where \(T_{juav}\) represents the \(j\)th coordinateof UAV and \((x_{uuc}^{(0)},y_{uuc}^{(0)},z_{uuc}^{(0)})=(0,0,0)\). Therefore, the problem formulation can be described as:  
\[\begin{split}\pi^{*}=\operatorname*{arg\,min}_{\pi}\sum Tj_{uav} \\ \text{s.t}\left\|P_{uav}^{(N)}-\left(\hat{C}_{EA},\hat{H}_{EA} \right)\right\|<\epsilon\end{split} \tag{2}\]  
where  
\[\sum Tj_{uav}=\sum_{j=0}^{N-1}\parallel P_{uuc}^{(j+1)}-P_{uuc}^{(j)}\parallel, \tag{3}\]  
where \(\pi\) represents the distance the UAV needs to fly and the strategies for generating such a flying trajectory, respectively, and the constraint \(\left\|P_{uav}^{(N)}-\left(\hat{C}_{EA},\hat{H}_{EA}\right)\right\|<\epsilon\) serves to confine the ultimate convergence location of the UAV within a specific proximity of the equivalent center of the UEs. This is imperative due to the inherent limitation on the communication radius of the 5G base station mounted on the UAV, necessitating the UEs to maintain a position within the effective communication sphere to ensure seamless connectivity. Moreover, \(\epsilon\) usually represents a preset experience value determined by the performance of the 5G base station on the UAV. The formulation (2) indicates that the UAV should find an optimal strategy \(\pi^{*}\) to guide its flight within a three-dimensional range with \((\hat{C}_{EA},\hat{H}_{EA})\) as the center and a radius of \(\epsilon\) before it can stop.  
**Remark 2**: _During the execution of long-duration missions, the energy consumption of drones and 5G base stations emerges as a primary concern. As aerial platforms, drones possess inherent limitations in terms of fuel capacity or battery life, which directly impacts their operational endurance and ability to sustain missions over extended periods. On the other hand, 5G base stations require substantial amounts of power to transmit and receive high-speed data, thereby augmenting the overall energy demand. Consequently, it becomes imperative to explore strategies aimed at optimizing energy consumption, such as implementing dynamic power management algorithms for the 5G base stations and adopting energy-efficient flight profiles for the drones._