## 4 Problem Solution
### Device Association Strategy  
In this subsection, we solve the device association subproblem in each time slot to obtain the device association strategy in each time slot; here, we do not consider the device power optimization, so the PDs are assigned equal power, and then, the optimization problem \(\mathbf{P1}\) in each time slot is transformed as follows  
\[\mathbf{SP1:} \max_{\mathbf{x}_{\text{u}}(t),\mathbf{x}_{\text{b}}(t)}\frac{ \sum_{i=1}^{I}R_{i  
dimension is too high if solving for the whole association matrix. To reduce the solution complexity, this section adopts the genetic algorithm [32] for solving **SP1**. The genetic algorithm is able to achieve a global stochastic search to obtain the global optimal solution by simulating the evolutionary phenomenon of species in the biological world. The algorithm works in an encoded manner, can search multiple peaks in parallel, and does not operate on the parameters themselves, which has good operability and strong robustness [33].  
The genetic algorithm mainly consists of chromosomes, genes, population individuals, fitness function, a selection process, a replication process, a crossover process, and a mutation process. Among them, a chromosome represents a feasible solution to the problem to be solved, while all the constituent elements in each feasible solution can be seen as genes in the chromosome, and the carrier of the chromosome is called the population individual; the fitness function represents the degree of adaptation of the population individuals to the survival environment and can be used to measure the chromosomal merit of the population individuals in the evolutionary process; the selection process selects the better individuals from the current population so that they can continue to evolve without being eliminated; the replication process indicates that in each evolutionary process, the best individuals from the previous generation are retained and replicated intact to the next generation; the crossover process can be seen as a hybridization of genes in the chromosomes of population individuals, in which the selected parent chromosomes are randomly matched two by two to generate a new set of chromosomes according to the crossover method, and the crossover process is used to retain the good genes in each evolutionary process so that the result obtained is close to the local optimal solution; while the mutation process is used to achieve the global optimal solution by randomly selecting several genes on the chromosomes for random modification, thus introducing new genes into the current gene sequence in order to break the search limit to find the global optimal solution [34].  
In problem **SP1**, by combining the device and UAV association strategy \(\mathbf{x_{u}}(t)\) and the device and ground 5G base station association strategy \(\mathbf{x_{b}}(t)\), we can represent the overall device association decision as \(\mathbf{A}(t)=\mathbf{x_{u}}(t)\times\mathbf{x_{b}}(t)\), and  
\[a_{i,j}(t)=\big{\{}x_{i,\mu}(t),x_{i,b}(t):\forall j\in\mathcal{U}\cup \mathcal{B},i\in\mathcal{I},t\in\mathcal{T}\big{\}}. \tag{11}\]  
At this time, the matrix \(\mathbf{A}(t)\), as a feasible solution in problem **SP1**, can be used as a chromosome in the genetic algorithm, and each element in \(\mathbf{A}(t)\) is called a gene on the chromosome of the population individual. In addition, the fitness function is set to the total system energy efficiency in each time slot as follows  
\[fitness=\frac{\sum_{i=1}^{I}R_{i}(t)}{\sum_{i=1}^{I}E_{i}(t)}. \tag{12}\]  
Based on this, in order to solve the problem **SP1**, we propose a genetic algorithm-based device association strategy, as summarized in Algorithm 1. First, the population is initialized (lines 2-3), and a certain number of feasible solutions to problem **SP1** are randomly generated as for the initial population, and the genes of each individual chromosome are binary encoded, while each feasible solution needs to ensure that the constraints \(C_{1}\)-\(C_{5}\) are satisfied.