Multi-task offloading scheme for UAV-enabled fog computing networks

In unmanned aerial vehicle (UAV)-enabled fog computing networks, how to efficiently offload multiple tasks to the computing nodes is a challenging combinatorial optimization problem. In this paper, in order to optimize the total delay for the UAV-enabled fog computing networks, a simple scheduling algorithm and a multi-task offloading scheme based on fireworks algorithm (FWA) are proposed. First, the system model of multiple tasks offloading in UAV-enabled fog computing networks is described in detail. Then, a simple scheduling algorithm is proposed to optimize the delay of the tasks allocated to a single node. Based on the scheduling algorithm, a multi-task offloading scheme for all tasks and all computing nodes is presented. Finally, simulation results show that the performance of a proposed scheduling algorithm and offloading strategy outperforms than that of a genetic algorithm and a random algorithm. This result can provide an effective optimization for multi-task offloading in UAV-enabled fog computing networks.


Motivation
In recent years, with the popularization of smartphones and various new applications, wireless data traffic has increased thousands of times [1,2]. The increasing demand of users has promoted the continuous progress of communication technology. Meanwhile, fifth generation (5G) has gradually started commercialized [3]. Since the future wireless communication system is no longer only refer to the simple ground communication, but wants to make a full use of the multi-dimensional information of space, ground, and sea to realize the comprehensive management of complex networks of time and space. In the backgrounds, unmanned aerial vehicle (UAV) communications have received extensive attention worldwide [4,5].
With the advent of ultra-reliable low-latency communications, delay-sensitive and reliability-aware task demands are also rapidly increasing. Computation-intensive tasks or applications, such as image-or video-based applications, require higher processing power and energy consumption resources [6]. For UAV networks, due to their own computing resources and battery energy constraints, intensive tasks will affect the realtime operation of the UAV system, or even cause tasks to be blocked. At the same time, with the rapid development of cloud computing and Internet services, the core network of the cellular network has become more and more complex. In this context, Cisco first proposed the concept of fog computing in 2011, which uses a distributed service computing model based on paravirtualized architecture. The terminal can access its own local cloud based on any network device at any time and from anywhere (local cloud), and it is also known as the fog node. Unlike cloud computing, which relies on centralized high-performance computing devices to emphasize overall computing power, fog computing wins by volume, emphasizing the number of compute nodes, regardless of the strength of a single compute node. The paravirtualized architecture can process computing requirements hierarchically and sub-regionally to resolve possible network congestion and reduce latency. The OpenFog Consortium released the OpenFog Reference Architecture in February 2017, setting a fog computing standard to meet the data-intensive requirements of IoT, 5G, and artificial intelligence applications, which was adopted as an IEEE standard in February 2018. The fog computing has the characteristics of low delay and position sensing. It is suitable for a wide geographical distribution and mobility applications. It can support more edge nodes, making the deployment of the mobile service more convenient and meet a wider range demand for node access. The functions of neighbor node discovering, data relay, and other functions of D2D communication, as well as low latency and high data rate, also provide technical support for fog computing.
In a fog computing network, the fog node has the ability of computing, storing, and communicating. Therefore, UAV-enabled fog computing network combines the advantage of the UAV and fog computing network and provides an effective strategy for the multi-task offloading.

Related research
It is well known that UAVs can utilize their own mobility to get rid of space constraints and establish the flexible communication, but their limited computing resources and battery power also make UAVs endure a challenge. In [7], an offloading algorithm is proposed to assist UAV in performing computationally intensive tasks. This algorithm provides two methods for task offloading. The first offloading method is airborne offloading, where UAV can offload their computing tasks to UAV nearby with computing and energy resources available. The second offloading method is ground offloading, which allows tasks to be offloaded from a multi-level edge cloud unit connected with a ground station to an edge cloud server. In [8], the authors focus on a scenario of a group of small UAVs performing an exploration mission. They give a comprehensive proof of the existence of Nash equilibrium and present a distributed algorithm that converges to this equilibrium.
In paper [9], combining UAV-aided communication and mobile edge computing (MEC) is presented as a promising paradigm, and it can cope with the surging demands for Big Data processing in UAV-aided IoT applications. The energy consumption for accomplishing the tasks can be effectively reduced based on the proposed algorithm. In paper [10], the authors propose a novel UAV-enabled MEC system which can interact with IoT devices, UAV, and edge clouds (ECs). To improve the quality of service, an optimization problem which minimizes the weighted sum of the service delay of all IoT devices and UAV energy consumption is formulated and solved. In paper [11], the authors present a new architecture for UAV clustering to enable efficient multi-modal multi-task offloading to overcome the heavy overhead of real-time interaction. Then the computing, caching, and communication resources are collaboratively optimized with AI-based decision making.
In paper [12], the authors study the task offloading problem between the Internet of Things mobile devices (IMDs) and the UAV to minimize the overall energy consumption for UAV-aided edge computing networks. The task offloading decision-making, bit allocation during transmission, and the UAV trajectory are jointly optimized to solve the problem. In paper [13], the authors optimize the deployment of UAVs in the consideration of their number and locations. Meanwhile, task scheduling is also optimized to provide high-quality services for all mobile users. For each mobile user, the problem that its task is executed locally or on a UAV is discussed and analyzed in detail. Then, a two-layer optimization method is presented to solve the problem. In paper [14], the authors solve the problem of offloading heavy computation tasks of UAVs while achieving the best possible tradeoff between energy consumption, time delay, and computation cost. And the scenario of a fleet of small UAVs performing an exploration mission is considered. The problem is formulated as a non-cooperative theoretical game with N players and three pure strategies. In paper [15], an energy-efficient computation offloading with an emphasis on physical-layer security is presented and discussed. Several energy-efficiency problems for secure UAV-MEC systems are formulated and transformed into convex problems. Then, their optimal solutions are obtained. In paper [16], the authors propose a novel game-theoretic and reinforcement learning framework for computational offloading for the mobile edge computing network which is operated by multiple different service providers. Then, the network operation is modeled to a two-level hierarchical model. The upper one is formulated as a cooperative game, and the lower one is modeled as several noncooperative subgames.

Contributions
In the work mentioned above, the conventional optimization methods are mostly used to solve the task-offloading problem for MEC or fog networks. And few works consider the scenario of multiple tasks. In our scenario, multiple tasks can be allocated to multiple computing nodes and one computing node may need to be allocated multiple tasks. Therefore, how to allocate these tasks to multiply computing nodes and how to schedule these tasks allocated one computing node are crucial problems to be solved. In this paper, an efficient schedule algorithm for the tasks to be allocated one computing node and a multi-task offloading scheme based on improving fireworks algorithm for UAV-enabled fog computing networks are proposed. The main contributions of our work are as follows: 1) We propose an efficient schedule algorithm for the tasks to allocated one computing node.
2) A multi-task offloading scheme based on improving fireworks algorithm for UAVenabled fog computing networks.
3) Simulation results validate the efficiency of the proposed scheme.

Paper organization
The remainder of this paper is organized as follows. In Section 2, the system model of multiple tasks offloading for UAV-enabled fog computing networks is presented, which includes the air-to-ground (A2G) channel model and the task offloading model. Then, the method we used in this paper is introduced and the problem is formulated in Section 3. In Section 4, a task scheduling algorithm and a multi-task offloading scheme based on fireworks algorithm are proposed to improve the performance of the system. Simulation results are provided and discussed in Section 5, and the paper is concluded in Section 6.

System model
In this paper, one UAV and multiple computing nodes coexist in the UAV networks as shown in Fig. 1. We assume that N computing nodes (CNs) are uniformly distributed in the cellular with the radius of R. One UAV with M different tasks is hovering in the center of the cellular. The UAV offloads M tasks to the CNs, and the CNs return the results to the UAV after completing the calculation. Of course, only the CNs that their quality of service (QoS) can be satisfied has the chance to be selected to compute the tasks. We denote ith CN as CN i i ∈ {1, 2, 3, ⋯, N} and jth task as TASK j j ∈ {1, 2, 3, ⋯, M}, respectively. In our scenario, we consider that the number of tasks is greater than the number of CNs. So one CN is usually allocated to multiple tasks. It is assumed that the orthogonal frequency division multiplexing (OFDM) channels are adopted for the communication between the UAV and the CNs in the networks. In Fig. 1, the blue block and the yellow block represent the communication capabilities and computing capabilities of the CNs, respectively. Therefore, how to efficiently offload these tasks to CNs is a challenging problem.

Channel model
For A2G communication, it is well known that a classical UAV communication mode can be adopted. And the path loss model can be represented as [17]: where A = η Los − η NLos ,B = 20 log f + 20 log(4π/c) + η NLos , h is the height of the UAV, d denotes the distance between CN and the UAV's projection on the ground, and a and b are the constants related to the propagation environment, which are usually suburban, urban, dense urban, and highrise urban. η Los , η NLos are the average additional loss of the free propagation space loss which changes with the environment, c is the propagation speed of light, and f is the carrier frequency.
In general, we can assume that the allocated transmission power at the UAV for every CN is the same to P t . Then, the signal-to-noise ratio of CN i can be written as Here, PL i is the path loss between the UAV and CN i , and N 0 is the noise power. Next, the data transmission rate of CN i can be calculated as Here, B is the sub-channel bandwidth. Then, we denote the data size of each task as Taking into full account the diversity of the tasks, three different distributions of the data size of the tasks are considered in our paper: uniform distribution, Gaussian distribution, and Pareto distribution [18]. Meanwhile, the transmission delay m i,j for offloading TASK j to CN i is mainly determined by the data size of the task and the transmission rate R i . Then, m i,j can be expressed as

Computing model
The computing ability of the CN i is only related to the frequency f i of its CPU. We denote the required CPU cycles to process each bit of data as η i . If the CN i computes TASK j , then the computing delay p i,j can be obtained as

Method and problem formulation
Multi-task offloading is a crucial issue for UAV-enabled fog computing networks. Therefore, how to allocate these tasks to multiply computing nodes and how to schedule these tasks allocated one computing node are crucial problems to be solved. For the first problem, it is a combinatorial optimization problem, and we propose an algorithm based on the fireworks algorithm. For the second problem, an efficient schedule algorithm is presented to solve it. In UAV-enabled fog computing networks, UAV may encounter multiple computing task requirements. And the sizes of these tasks are different in general. Meanwhile, for the CN, their communication and computing abilities are also unequal. For the task offloading scheme, the delay is a very important performance index. The delay consists of three parts: the transmission delay, computing delay, and the delay of the result return. And the delay of the result return to the UAV can be ignored because the data size of the return result of the task is usually very small [19]. Next, we define a binary decision variable μ i, j to indicate if TASK j is allocated to CN i . We have Considering that the CN usually has a certain storage space, the allocated tasks to the CN can be offloaded continuously. That is, UAV can immediately offload the next task after the last task is offloaded. But for the computing, the CP must wait until the transmission of the task is completed. Therefore, there may be a gap between the transmission of the next task and computing of the current task. Now, we denote the number of tasks allocated to CN i as M i . And we have P N i¼1 M i ¼ M . Then, how to calculate the delay in completing these tasks for CN i is a very challenging problem. And how to schedule these tasks for CN i is also a crucial problem to be solved.
The key performance indices for UAV networks include capacity, delay, energy, reliability, and cost. The quality of service for task-offloading mainly depends on system delay [20,21]. For the multi-task offloading problem in UAV-enabled fog computing networks, how to minimize the delay is a realistic and very challenging issue. Therefore, in this paper, the delay-sensitive multitask offloading strategy is mainly studied to reduce the system delay.
We denote the delay that CN i completes these allocated tasks as T i . Then, system delay can be written as an optimization problem s:t: Multi-task offloading scheme for UAV-enabled fog computing networks 4.1 Task scheduling algorithm As mentioned above, task scheduling in the CNs has a great impact on system performance in terms of the delay. Actually, it is not easy to get the expression of T i . Considering the relationship between the communication ability and the computing ability of the CN, the scenario can be divided into two possibilities: communication delay is smaller than the computing delay or the computing delay is smaller than the communication delay. Next, we propose a simple scheduling algorithm. If the communication delay is smaller than the computing delay, we sort the tasks from the smallest to the biggest. If the computing delay is smaller than the communication delay, we sort the tasks from the biggest to the smallest. Next, we analyze the mechanism in detail.
1. Computing delay is smaller than communication delay and sorts the tasks from the biggest to the smallest. Firstly, we consider a very friendly condition. We assume that the communication delay of every task is smaller than the computing time of the previous task, that is m j + 1 < p j . In this case, the total delay of CN i is the transmission time of all tasks allocated to CN i plus the computing time of the last task, as shown in Fig. 2a. For the example in Fig. 2a, we can obtain the delay as But in other conditions, such as TASK 2 , it has not completely arrived when the computing of TASK 1 is finished, as shown in Fig. 2b. In this case, CN must wait until the communication of the next task is completed. And there is a waiting time w j = m j − p j − 1 before the next task will be computed. Then, the delay can be written as T total = m 1 + m 2 + p 2 + p 3 for this example. 2. Communication delay is smaller than computing delay and sorts the tasks from the smallest to the biggest. Similarly, we consider a very friendly condition firstly as shown in Fig. 2c. In this situation, we also assume that the transmission time of the task is smaller than the computing time of its previous task, that is m j + 1 < p j . Then, the total delay is the computing time of all tasks allocated to CN i and transmission time of the first task. So, it can be written as But in other conditions, such as TASK 2 , it has not completely arrived when the computing of TASK 1 is finished, as shown in Fig. 2d. In this case, CN must wait until the communication of the next task is completed. And there is a waiting time w j = m j − p j − (2020) 2020:230 1 before the next task will be computed. Then, the delay can be also written as T total = m 1 + m 2 + m 3 + p 3 for this example. Based on the analysis above, the proposed scheduling algorithm is as follows.

The preliminary of fireworks algorithm
Fireworks algorithm is a relatively novel swarm intelligence algorithm proposed by Professor Tan Ying and others inspired by the explosion of fireworks in the night sky [22]. The fireworks algorithm constructs a fitness function according to the optimization objective function of the problem, and each solution corresponds to a firework position. Randomly initialize a certain number of locations to set off fireworks. Then, we can simulate the explosion of fireworks to generate explosive sparks scattered near the fireworks. Next, randomly select a small number of fireworks to implement Gaussian explosion operation. Then, the position of the explosion spark corresponds to the new generated solution. Thus, the optimal solution to the problem will be obtained through multiple iterations. The process of firework explosion is also the process of optimizing in the feasible solution space along with the operations such as explosion sparks and mutated sparks. The firework algorithm not only inherits many advantages of the existing intelligence optimization algorithm, but also has obvious own advantages. At the beginning of each iteration, the firework needs to be exploded and produces many sparks different from the firework itself within the radiation range. In this way, the firework algorithm has the powerful search ability. Each individual can only perceive the local information, and the ability or rules of the individual are very simple, so the composition and implementation of the algorithm are very easy to implement. Using simple interaction rules, through the interaction between individuals in the way of cooperation and competition, the complex behaviors of individual individuals in the whole group show the characteristics of intelligence. The individuals in the group are relatively simple, without a direct central control constraint, and each individual interacts locally, which is essentially a distributed method, showing the characteristics of highly parallel, especially suitable for parallel processing. Since the individuals are relatively independent, the collaboration between individuals usually achieves information exchange through indirect methods. Adding or reducing some individuals has no dramatic impact on the system, thus ensuring the system has a strong scalability. Because only the adaptability of each individual is used to evaluate the solving ability of the system, the requirements for the solved problems are very low, even do not require the explicit expression of the solved problems.
In this paper, the delay-sensitive multitask offloading strategy is mainly studied. The formulated problem can give full play to the advantages of the fireworks algorithm so as to reduce the total delay and improve the system performance.

Multi-task offloading scheme based on fireworks algorithm
In this subsection, a multi-task offloading scheme based on fireworks algorithm is proposed. The scheme can search for optimal solutions more thoroughly due to its explosion mechanism. Compared with other classical intelligent algorithms, it has a very good performance. The proposed scheme is as follows:

Initialization coding
In this paper, the feasible solution is mapped to a real number coding for the firework algorithm. Initialization coding corresponds to the initial firework position. The specific coding strategy is as follows. Assume that a single UAV carries M tasks with different amount of computations. Then, the position of a firework is encoded as an M-dimensional vector, denoted as X i = (x 1 , …, x m , …, x M ), x m ∈ [1, N]. And each element represents a task. For example, the vector X i = (1, 4, 2, 2, 1, 3, 1, 2, 3) represents a feasible solution that is randomly generated for the case that 9 tasks need to be offloaded to 4 computing nodes. The position sequence number in the row vector represents the index of all tasks. For X i , the corresponding task offloading strategy is that TASK 1 , TASK 5 , and TASK 7 are offloaded to CN 1 ; TASK 3 , TASK 4 , and TASK 8 are offloaded to CN 2 ; TASK 6 and TASK 9 are offloaded to CN 3 ; and TASK 2 is offloaded to CN 4 , as shown in the system model of Fig. 1. In our algorithm, we denote the number of fireworks as N c .

Explosion operator
We denote an explosion radius as A i and the number of explosion sparks as S i , respectively. And the sparks are generated around. Compared with bad fireworks, fireworks with good fitness values have more explosion sparks and a smaller explosion radius [23]. A i and S i can be determined by the fitness value of each firework in the population according to the following formula: where f(X) is the fitness function of the feasible solution X, y min = min(f(X i )) and y max = max(f(X i )) are the minimum and maximum fitness values in the current firework population, respectively. A and S are the constants used to adjust the explosion radius and the number of explosions, respectively. ε is a smoothing parameter used to avoid the case that the denominator is equal to 0.
Meanwhile, the fireworks with good fitness values often generate excessive sparks so as to fall into the local optimal values, and the fireworks with poor fitness values do not generate sparks again. To avoid these cases, we limit the number of sparks S i as follows [23]: where a and b are constants which are used to specify the upper and lower limits of the number of sparks generated, and round(⋅) is rounding functions.

Mutation operator
In order to maintain the diversity of the population, a mutation operator is introduced to generate new sparks. We denote Gaussian spark number as GN. Then, GN fireworks will be selected from the N c fireworks to implement Gaussian mutation. For each selected firework, we randomly select kth element and perform the following operations for each selected element to form the new sparks: where e~N(1, 1) is a Gaussian variance with the mean of 1 and the variance of 1 [23].

Correction
The new sparks generated in the above two operations may escape the feasible region. So for every new generated spark, it should be checked. If the kth element of spark X i is out of the feasible region, the correction value of X i can be obtained by the mapping rule of the following formula: where x U and x L are the upper and lower boundary values of the elements, respectively.

Elite strategy
In order to keep the optimal solutions to the next generation, at the end of each iteration, the original firework population and the abovementioned generated  sparks by explosion and mutation operations are retained in a temporal population. Next, we sort these sparks according to their fitness functions in descending order. Then, the elite selection strategy is adopted to select top N c sparks as the next generation of the population.
Based on the analysis above, a multi-task offloading scheme based on fireworks algorithm for UAV-enabled fog computing networks is presented as follows.

Results and discussion
In this section, a MATLAB simulation was conducted to evaluate the performance of the proposed scheme. We assume that N CNs are uniformly distributed in the cellular with the radius of R. One UAV with M different tasks is hovering in the center of the cellular. The simulation parameters are shown in Table 1. Figures 3 and 4 describe the delay of the CN in two scenarios that the computing delay is smaller than communication delay and communication delay is smaller than the computing delay under different task scheduling algorithms. In order to verify the advantages of the proposed scheduling algorithm, the random algorithm and the exhaustive algorithm are compared with it in this simulation. Dark blue, light blue, yellow, and brown represent random algorithm, small to a large algorithm, large to a small algorithm, and exhaustive algorithm, respectively. It can be seen from the figure that no matter the size of tasks obeys the Gaussian distribution, uniform distribution, or Pareto distribution, when the node's computing delay is smaller than the communication delay, the delay of the large to a small algorithm is close to exhaustion, that is, close to the optimal strategy, which is obviously better than the small to a large algorithm and random algorithm. Conversely, when the node's communication delay is smaller than the computing delay, the total delay of the small to a large algorithm is close to the exhaustion algorithm. Therefore, no matter what distribution the size of tasks follows, our proposed scheduling algorithm can get a very good performance. Figures 5 and 6 show the CDF of the delay of a single node under different scheduling algorithms when the size of the task follows a Gaussian distribution in the above two scenarios. The results are obtained by Monte Carlo simulations. When the computing delay of the node is smaller than the communication delay or the communication delay of the node is smaller than the computing delay, our proposed scheduling  algorithm is close to the exhaustive algorithm. This further validates the efficiency of our proposed scheduling algorithm. Next, the total system delay is simulated and discussed. The genetic algorithm (GA) and the random algorithm (RA) are also considered as the benchmark. From Fig. 7, it can be intuitively seen that the performance of the RA is worst. Compared with the RA, GA can get a better performance. But for GA, it is difficult to jump out of the local optimal solution sometimes. But for our proposed algorithm based on the schedule algorithm and firework algorithm, it can get the best performance compared with the other two algorithms. Meanwhile, the proposed algorithm can get fast convergence. Figure 8 shows the CDF curves of the total system delay under different algorithms. From this figure, it can be seen that the performance of the RA is worst due to the randomness of allocation. And the total system delays of these three algorithms are about in the range of 11 to 41 s. Compared with the RA and GA, the proposed algorithm can reduce the total system delay by 15 s and 2 s, respectively. This shows the efficiency of our proposed algorithm. Figure 9 shows the relationship between the number of tasks and the total system delay of the GA and our proposed algorithm. It can be observed from the figure that the system delay increases with the increasing of the number of tasks for the two algorithms. Meanwhile, the system delay will increase by about 10 s for each additional 4