{'fraction_non_alphanumeric': 0.030770045546022667, 'fraction_numerical': 0.0061434170109098615, 'mean_word_length': 4.842512376237623, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Reinforcement Learning Environment for Multi-Service UAV-enabled Wireless Systems

We design a multi-purpose environment for autonomous UAVs offering different communication services in a variety of application contexts (e.g., wireless mobile connectivity services, edge computing, data gathering). We develop the environment, based on OpenAI Gym framework, in order to simulate different characteristics of real operational environments and we adopt the Reinforcement Learning to generate policies that maximize some desired performance.The quality of the resulting policies are compared with a simple baseline to evaluate the system and derive guidelines to adopt this technique in different use cases. The main contribution of this paper is a flexible and extensible OpenAI Gym environment, which allows to generate, evaluate, and compare policies for autonomous multi-drone systems in multi-service applications. This environment allows for comparative evaluation and benchmarking of different approaches in a variety of application contexts.


I. INTRODUCTION
In the next years, a boost of advanced mobile services is expected, by the integration of a different variety of devices that may exploit the access network not only for throughput based services but also for support in computing tasks. A key role will be played by Unmanned Aerial Vehicles (UAV), as envisaged by 3GPP for 5G and beyond networks [4], as we expect UAVs to provide not only high throughput but also massive data processing. In this case, it is beneficial to exploit either network-based processing or mobile computing. Furthermore, UAVs are expected to be exploited to provide messaging/sensing services to connected devices (things) [1]. Thereby, we address in this paper, in a holistic way, the provisioning of three kinds of services through UAVs: i) throughput provisioning, ii) edge computing) and iii) data collection.
Specifically, we present a framework based on Reinforcement Learning (RL) to make UAVs (drones in our case) learn how to provide these services by maximizing some specified Quality of Experience (QoE) of the users, while minimizing resources (e.g., battery energy) at the same time 1 .
To optimize the desired performance, UAVs have to choose proper actions to be executed during their missions. In this context, the difficulty of providing exact models of the environment makes RL techniques very useful, as agents can learn from past experience, rather than computing solutions from a given model. RL approaches however require the execution of many trials that cannot be done with real UAVs, therefore environments simulating relevant UAV behaviours are needed in order to train the policies that will then be run on real UAVs.
Defining a multi-UAV environment for providing multiple services in an environment can be a complex task depending on the required level of reality. Moreover, the environment should be easy to use and to extend to match the different needs of researchers studying similar use cases. Finally, when used as a system for RL, the environment should provide the necessary features to enable the execution of RL algorithms. Generating mission specific behaviors, like the ones presented in this paper, is also a key goal of the EU SESAR project BUBBLES 2 on which this work is inspired.
The contribution of this paper is thus to describe the development of a flexible and extendable Multi-UAV Multi-Service environment compliant with the OpenAI Gym environment, allowing the setting of different operating usecases and enabling to run different RL algorithms. The environment is designed with specific attention to scalability and extendability, in order to be useful to other researchers for new experimental use-cases. Moreover, compliance with OpenAI Gym allows exploiting many resources developed in such an environment and to create common benchmarks that will enable comparative analysis of different techniques and results.

II. RELATED WORK
Many recent papers are focused on the use of UAVs for providing a variety of services and using RL techniques. In the following, we summarize some papers strictly related to the issues covered by the proposed environment.

A. Multiple UAVs and Resource Allocation
Use cases and inter-operations with the cellular networks are analyzed in 3GPP technical specification [4], with particular reference to possible applications such as the adoption of UAV to support high resolution video live broadcast application, e.g. with 360 degree spherical view camera system carried on a UAV, as well as the adoption of UAVs swarms in logistic. In [3] the authors describe how UAVs swarms can be integrated in 5G and beyond cellular systems either as relays, BSs or users. In [12] cache-enabled UAV is used to assist mobile-edge computing and the best 3D position among IoTs is searched to maximize data throughput. As for mobile streaming service, UAVs can provide flexible resource allocation; the problem of maximizing the QoE (minimize freeze time) in the mobile streaming services provided through UAVs is solved in [6], where the problem is addressed in terms of power/bandwidth allocation. Referring to UAVs swarm, they can also provide a service of wireless power transmission for multiple energy receiver; this service is described in [15], [14], and [16]. In the latter, a trajectory is designed to maximize the amount of energy transferred to all ERs during a finite charging period. In [15], [14], alongside the power transfer service, UAVs also provide clients (IoTs) edge-computing, with a binary [15] or a partial [14] tasks offloading.

B. Path Planning and RL Approaches
Optimal joint resource allocation and path planning are definitively relevant for UAV swarms development, and it may leverage learning for fast and flexible adaptation to the environment as discussed in [9]. Path planning forms the basis of any resource allocation algorithms for multi-UAV systems, and it poses specific challenges, as detailed in [8]. One possible application for which path planning is needed is that of energyefficient mobile computing, as in [10]. Other works (as [5]) focus on data gathering taking into account also the energy efficiency, where deep-learning techniques are used: here is planned the best path for both a UAV and a mobile charging station. [13] uses Deep Learning to pre-train an UAV employed to collect data from various IoTs devices trying to minimize to Age of Information to enhance data freshness. Among others, machine learning techniques are the most relevant for optimizing resource allocated to multiple UAVs in providing communications services; a survey dealing with these issues can be found in [7].

C. Discussion
Although many approaches have been proposed to address the deployment of multiple UAVs for delivering services, all these methods are based on specific settings (using specific simulators, environments, and experimental procedures) that are difficult to replicate and to be compared one each other.
The Multi-UAV Multi-Service OpenAI Gym environment proposed in this paper has the goal of unifying these efforts in a common setting for developing and comparing multi-UAV RL techniques in different use-cases.
Moreover, in contrast with other Open AI gym environments modelling UAVs (such as gym-pybullet 3 ), the Multi-UAV 3 https://github.com/JacopoPan/gym-pybullet-drones Multi-Service OpenAI Gym presented here is focused on highlevel interactions with the environment including modelling of users receiving services from the UAVs.
The presented environment allows us to easily model a Multi-UAV multi-service problem to find a behaviour of the UAV team according to some specific QoE performance metrics.
The problem discussed in this paper is different with respect to the literature mainly due to the UAV motion. Many other papers refer to UAV motion as an high-level motion, meaning that they are able to move from a cluster centroid (of users) to another one, assuming that UAVs know exactly where the users are located. This assumption is removed in the problem considered in this paper, thus UAVs can perform smoother movements from a cell (of the considered area) to another one, making the scenario more realistic. This kind of UAV motion, combined with the usage of our OpenAI Gym environment, allows for easy reproducibility of the results, for comparison with other methods and can be extended to other different multi-service use-cases.

III. MULTI-UAV MULTI-SERVICE ENVIRONMENT
The developed Multi-UAV Multi-service framework supports a variety of settings. The environment involves a volume of operations which is partitioned into K small cells whose size A k , k = 0, · · · K − 1 can be flexibly set according to the desired resolution per cell 4 . Obstacles can be randomly generated by setting the coverage percentage of the obstacles for the whole operational volume. Maximum building height can be selected and, according to this choice, different heights for each building are randomly generated.
We can set the presence of C clusters of users, whose centroid locations are generated by drawing samples from a uniform distribution; we can also set U users, spread out along the generated centroids by using a truncated (bounded) normal distribution. Each user requests one out of N serv services (as throughput request, edge-computing or data gathering), with some parameters stored as attributes of each user.
In the environment considered in this paper, N drones can be deployed, and M Charging Stations (CS) are made available at locations placed in points made equidistant from the middle of the operational volume. These charging stations are placed at equal distance one from another. Drones are supposed to serve users while flying (except for some particular cases explained later on) and their performance are evaluated according to predefined metrics.
Each drone is associated with an agent characterized by a state representation (including its position and other desirable state variables) and an action space (that can vary according to the operational scenario).
The following general assumptions are considered: • Multi-agent distributed system: UAVs do not know anything about other agents and do not communicate with each other; • UAVs do not have a detailed map of the scenario, thus they implicitly learn to avoid obstacles; • UAVs have a given footprint (i.e., a circular range around them) and each UAV can detect and serve only users inside it; • in the 2D setting, the UAVs are assumed to fly at a unique altitude above the tallest building, thus without obstacles. The following configurations can be set: • static or dynamic service requests; • stationary/moving users; • perfect/noisy estimate of UAVs position; • single/multiple services; • 2D or 3D setting; • limited/unlimited UAV battery; • limited/unlimited UAV bandwidth. Other features can be easily introduced in our environment.

IV. EXPERIMENTAL SCENARIO
As already mentioned, the developed Multi-UAV Multiservice environment can be configured to describe different operational use-cases (see Table III). In this section, we describe some configurations for which we report the relevant experimental analysis.
For these experiments, four UAV state space representations have been considered, with coordinates (x U AV , y U AV , z U AV ) and battery level B l :   Table I shows some parameters used to configure the usecases evaluated in this paper.
For what concerns the battery consumption, it is assumed that each UAV loses 1 minute of battery autonomy for each action performed. With a bang-coast-bang acceleration profile, each drone travels 240 meters in approximately 60 seconds,  Table II.
In these experiments, in addition to the framework general assumptions described in the previous section, we considered the following: i) Motion: -UAVs cannot fly over the tallest building; when a UAV goes toward a charging station, it follows an A* path planning algorithm (based on the charging stations and obstacles positions within the scenario); each agent timing law has a trapezoidal speed profile and a bang-coast-bang acceleration (as in [11]) when moving from a cell to another; each movement is considered from the center of a cell to the center of the next one. ii) Charging: no services are provided when going to CS or charging; -UAVs leave a CS only when the battery is fully recharged; -UAVs learn with RL when it is time to go back to a CS; then they will go back according to A* algorithm.

A. Reinforcement Learning configuration
The implemented environment allows initializing the stateaction matrix, i.e. the Q-table, as follows: • zero initialization; • random initialization; • maximum reward initialization; • prior knowledge initialization. For our training process, we used the random initialization approach. We compared two different standard RL algorithms, Q-learning and SARSA algorithms, with -greedy exploration strategy.
The reward functions used in the experiments vary according to the specific use case, as different variables are taken into account.
Referring to the parameters described in Table II, the reward function used for the use cases 1-3 is; The reward used for the use cases 4-5 is: where: where w s and w c represent the weights parameters for the service and cost rewards,respectively; r u is computed as in (1) and the reward cost is: Finally, the reward function used for the use cases 6-9 is: R i 3 = w s (w u r u + w tr s tr + w ec s ec + w dg s dg ) + +w c (r cp + r cs ) where w s and w c are computed as in (3), r cp is the same as (5) and r cs represents the cost due to the throughput request service (which is considered negligible for these usecases, but that could be added in future); w u , w tr , w ec , w dg are the weights corresponding respectively to the percentage of i) covered users (regardless of the service requested), ii) throughput requests covered, iii) edge computing requests covered, iv) data gathering requests covered.

B. Service-oriented Performance metrics
We chose three different assessment (or Quality of Experience-QoE) parameters: • QoE 1 : percentage indicating how much a user is covered based on his/her time service request (i.e., "completion percentage" per service); • QoE 2 : indicates the iteration steps between the request and the complete provision of the service; • QoE 3 : the percentage of the users covered by the UAVs service. Many others could be selected according to the desired goals. Notice that during training, the agent moves only according to the reward (i.e., they do not follow QoEs trends).

A. Parameter settings
We studied and tested 9 different cases, by varying several parameter settings in order to progressively increase the complexity level of each scenario: environment dimension, number of UAVs and users, service request and users motion are just some of all the settings modified for each analyzed case. All the study cases are illustrated in Table III. Let us remark that in these cases we have considered the UAVs as the only service access points. Still, the architecture can naturally include information about other service access points by suitable adapting the reward function.

B. Performance analysis
The performance was compared with a specific baseline behaviour. With baseline behaviour here it is meant a static behaviour which is always the same and that allows each drone to go to the closest charging station when its battery level is equal to 15% of the overall capacity; the return is always managed through A*. This baseline behaviour is based on the following steps: 1) the first drone will follow a square trajectory on the map by moving two cells away from the edge of the considered area; 2) the second one will move only along the y-axis of the considered area; 3) the third one will move only along the x-axis of the considered area; 4) and so on, with each next drone moving according to 1. and 2. starting from where it was initially placed.
In a 3D environment, the assumption that the drone cannot fly higher than the tallest building is removed. Thus in this case, in order to avoid a building, a drone will simply fly over it whatever the height of the obstacle is.  Figure 2 shows the QoE metrics in two of the analyzed cases (Case 1 and Case 5), comparing Q-learning algorithms performance. Table IV provides instead a quick visual comparison of agents performance for each case of study.
The performed experiments point out that the number of UAVs crashes dramatically increases when the error measure on the position of the drones is introduced. Moreover, the baseline behaviour is always the worst choice in terms of performance (but the best in term of safety) w.r.t. the RL approaches.
Our Multi-UAV Multi-Service OpenAI Gym environment allows to configure and extend many different experiments and use-cases, by modelling problems similar to the one faced here. In this way, many different configuration tests and the related outcomes can be investigated and compared to improve the overall performance in each case of study. Figure 1 shows a screenshot of a training session related to a specific 3D scenario.

VI. CONCLUSION AND FUTURE WORK
In this work we have presented an environment to model Multi-UAV Multi-Service use-cases and to run comprehensive Reinforcement Learning algorithms. The architecture encompasses several scenario models and design choices. Experimental results show that the architecture provides a flexible and scalable environment for the design of different service criteria. This paves the way for future works related to the multi-UAV application systems. Besides, the architecture modularity allows for extension in terms of: i) communication layer modelling (e.g. path loss models and fading in the considered environment), ii) adoption of neural network Deep RL algorithms for huge state space handling.
Finally, we believe that the Multi-UAV Multi-Service Ope-nAI Gym environment can boost reproducibility of results as well as comparison among different approaches in use-cases that are realistic in terms of modelling user-oriented services.
VII. ACKNOWLEDGEMENTS This paper has been partially supported by BUBBLES Project. BUBBLES project has received funding from the SESAR Joint Undertaking under the European Union's Horizon 2020 research and innovation program under grant agreement No 893206. Research has been partially supported also Fig. 2. QoEs (vertical lines represent the standard deviation) and rewards trends when Q-learning algorithm is applied: the first horizontal row of graphs represents Case 1, the second one refers to Case 5, while the third one represents the rewards for Case 1 and Case 5 (from the left to the right). by the ERC Advanced Grant WhiteMech (No. 834228) and by the EU ICT-48 2020 project TAILOR (No. 952215).