# On the Application of Machine Learning to the Design of UAV-Based 5G Radio Access Networks
## 4 ML-Based Designs
### Choice of the Number of UAVs Acting as BSs  
When UAVs are used as BSs to serve ground users, the choice of the number and positions of UAVs greatly impacts the transmit power of each UAV, the coverage area, and SINR at the receivers [1, 3, 7, 20, 63]. Joint optimization of the number and positions of the UAVs might be too complex to be performed in many scenarios of interest due dynamic system requirements of U-RANs, especially when UAVs have to be integrated with ground BSs. For such a reason, they are often optimized separately [4, 10, 19, 20, 34, 35, 39, 49]: in the first step, the best number of UAVs is found and, then, the optimal UAV positions is obtained for such a number. The former step is discussed herein, whereas the latter one is deferred to the next subsection. The number of users also affects the distance between the UAVs and their flying altitudes. The most appropriate number of UAVs depends on the considered scenario. Let us consider an application where multiple UAVs share the same file to be requested by users and, moreover, the users have device-to-device (D2D) communication links in order to facilitate file download (see Figure 8). In this case, the optimum number of UAVs can be obtained by using RL methods in combination with SL. Figure 7: ML black box for choosing the best UAV based on traffic features. As a matter of fact, UAVs need high altitude to better support users in LoS conditions and manage interference effectively. If user patterns change, the number of UAVs has to be updated accordingly. This can be done by operating on a slot-by-slot basis: in each time slot, user patterns, such as activation period, payload, delay sensitivity, movement behavior and densities, are monitored. Joint control of altitude and interference as a function of user patterns is a challenging task. To simplify the matter, static scenarios can be considered, and the number of UAVs to support a given area can be calculated through simulation by using data from telecommunication operators or via sophisticated time-consuming optimization methods. In this scenario, RL can be helpful in an offline manner, in order to generate a huge amount of data set for SL. In this case, the UAVs are the agents, the current number of UAVs is the state, the action consists of increasing the number of UAVs by one and the reward function can be the number of supported users. In these static scenarios, by changing the number of users and interference-sensitive users available in each area, the optimum number of UAVs can be calculated. If UAVs are employed to serve delay-sensitive users, the dataset can be used to obtain the number of UAVs in real time by means of SL approaches. In this case, the users' behavior in a certain time slot, their sensitivity to the interference, and their communication requirements are the features that can be used as training data set to the ML black box and its label can be the number of the UAVs. Knowing the number of UAVs, the altitude of each UAV from the ground can be easily computed in order to cover the area with minimum overlap, in the cases where the UAVs are equally distributed in the area. Despite of several assumptions made, this ML algorithm can be the best available method to calculate the number of UAVs in each area and it is worthy to be investigated. Moreover, when a dataset is not available, the efficiency of an evolutionary algorithm, such as GA, to find the optimal number and positions of the UAVs should deserve further investigations. The percentage of failure in downloading the file by the users is another loss function, reward and punishment, in which adding or decreasing one UAV can be considered as an action and the number of UAVs is instead the state. The flowchart of this process is reported in Figure 9. As a first step, a certain number of the scenarios is defined and the number of UAVs is obtained by using RL with defined loss function. The results are stored as the input dataset and desired outputs.