Abstract

As the computing capacity of existing mobile devices cannot fully meet the needs of users for communication quality, a computing resource allocation strategy for 5G communication in the Internet of Things (IoT) environment is proposed by applying UAV-assisted edge computing. First, a system model is constructed with the UAV deployed with mobile edge computing (MEC) servers to provide assisted computing services for multiple users on the ground. Based on the optimization of the UAV trajectory, communication scheduling, and the energy consumption model of the UAV, the problem of the total computational cost minimization is formulated. Then, the genetic algorithm is improved by introducing a penalty function to solve this problem, in which selection, crossover, and mutation operations are iterated to obtain the optimal allocation strategy for computational resources. Finally, a simulation platform is constructed to analyze the proposed method. The results show that the total cost and total time of the proposed strategy are better than other comparison strategies.

1. Introduction

With the increasing demands in applications and the rapid development of computing capacity, innovative applications are emerging quickly, making it difficult for the traditional 4G network architecture to serve exponential growth of data flows, diverse terminal devices, and various kinds of complex service scenarios [1]. The context of the Internet of Everything also places higher demands on wireless communications in terms of mobile performance, security, network delay, and communication reliability. At the same time, people have higher requirements for computational performance as artificial intelligence is developing quickly. However, the computing capacity of existing mobile devices cannot fully meet users’ demands for communication quality [2, 3]. Therefore, mobile edge computing (MEC) technology is proposed to improve the system computing capacity so as to meet the users’ demands for communication. In addition, 5G has become a key technology to achieve the best performance of MEC systems in the Internet of Things (IoT) environment, which can effectively solve the problems of delay, lack of storage, and poor computing capacity in wireless communication networks by combining reasonable resource optimization strategies for computing, storage, and communication [4]. It can also give full play to the characteristics of MEC networks, such as low response delay in computation task offloading and good network scalability [5].

By introducing UAVs into the MEC system, the flexible deployment of UAVs allows users to jointly collaborate on computing and communication, which improves the performance of the MEC system [6, 7]. However, the relationship between the trajectory control strategy and the capacity and energy consumption of traditional communication systems is unclear due to the fast mobility of UAVs. It is necessary to combine the classical air-to-ground line-of-sight channel model with a comprehensive multiobjective strategy optimization to improve the effectiveness of the algorithm based on the mobility of UAV during the communication [8].

There have been some research studies on traditional computation task offloading and resource allocation optimization at home and abroad. In Ref. [9], an exact linear search-based algorithm is proposed for finding the optimal solution by fixing the status update rate. As a design alternative, a low complexity concave-convex procedure (CCP) is also formulated for finding a near-optimal solution relying on the original problem’s transformation into a form represented by the difference of two convex problems. In Ref. [10], the optimization problem of computational resource allocation was transformed into the optimal matching for weighted bipartite graphs, which was solved by adding fake containers, thus obtaining the optimal strategy for resource matching of tasks in edge servers. But further improvement should be considered on the quality of service. Reference [11] proposed a dynamic resource allocation algorithm in the cloud edge environment and obtained the optimal scheme of resource scheduling based on tabu search algorithm, but the multiobjective optimization effect is not good. Reference [12] designed a multiobjective resource allocation method, in which Pareto archiving evolution strategy is used to optimize the time cost of IoT application, load balance, and energy consumption of MEC server, so as to find the optimal resource allocation scheme, but there is still room for further optimization for calculating delay. In Ref. [13], an enhanced resource allocation strategy in MEC using the reinforcement learning-based MOACO algorithm was proposed, in which MEC is used to predict the factors affecting delay and evaluate the performance of adjacent user equipment. A cognitive agent model was established to evaluate the validity of resource allocation. Zhang et al. proposed a MEC resource offloading method based on the UAV architecture and alternatively solved the problem of computational resource energy consumption and communication delay combined with an iterative algorithm, which improves the efficiency of optimal resource management [14]. However, the performance of overall optimization for multiple UAVs still needs to be improved. An iterative optimization algorithm with a double-loop structure for the optimal configuration of multi-UAV-assisted MEC systems was proposed by Zhang et al. [15]. Based on partial computing offload mode, jointly optimize user association and CPU cycle frequency for resource scheduling. In Ref. [16], a strategy for formulating and solving computational offloading problems using a model-free reinforcement learning framework was studied. And select an optimal overhead-aware computational offloading action based on its state, enabling the optimization of computational offloading policies in wireless cellular networks in MEC. However, the communication delay is still large due to the inadequacy of communication policies.

Based on the aforementioned analysis, an UAV-assisted edge computing resource allocation strategy for 5G communications in the IoT environment is proposed to address problems of energy consumption and delay in existing MEC networks. The main contributions are summarized as follows:(1)In this article, a new mobile edge computing system is studied. In this system, the ground base station is used to serve the UAV for computing diversion, and some computing tasks are unloaded to the ground base station. Then, based on the energy consumption model of the rotor UAV, an optimization problem is formulated to minimize the total UAV energy consumption, At the same time, it meets the requirements of single target calculation and unloading of multiple ground base stations.(2)In order to reduce the total system cost, the proposed method applies an improved genetic algorithm to solve the problem, in which the penalty function and combinatorial coding are used to improve the global search capability so as to obtain the optimal resource allocation scheme while improving the allocation efficiency.

2. System Modeling

2.1. System Model

The scenario studied is the uplink communication in an UAV-assisted MEC system, where users on the ground perform computing tasks with the help of UAVs, as shown in Figure 1. In the system, there is a single-antenna rotary-wing UAV with a MEC server and N number of users on the ground, which can be denoted as . Considering the three-dimensional Cartesian coordinate system, the position of the nth ground user can be denoted as . In addition, as the UAV flies in a defined region and provides assisted computing service to the ground users, the initial and final positions of the UAV can be denoted as and , respectively.

Assume that each ground user offloads a portion of the computational task to the UAV and the remainder is executed locally due to the lack of computing capacity. It is also assumed that the total execution time T can be divided equally into K timeslots, where ; here, refers to the length of the timeslot which is small enough to ensure that the position of the UAV does not change within each timeslot and denotes that there are K number of timeslots. In the ith timeslot, the position of the UAV can be represented as and the maximum flight speed of the UAV is , and then, the trajectory of the UAV can be constrained aswhere the initial and final positions of the UAV during its flight are given and the flight speed of the UAV must not exceed the specified maximum flight speed. In addition, the energy consumption of the UAV during the flight in the ith timeslot can be calculated aswhere represents the flight speed of the UAV in the ith timeslot. and J is a constant related to the UAV payload.

2.2. Channel Model

Because the wireless channel between N ground users and UAV depends on the line-of-sight (LoS) channel. Therefore, the channel gain between the UAV and user n in the ith timeslot can be written aswhere h0 is the channel gain at a distance of 1 m, is the distance between the user n and the UAV in the ith timeslot, and H denotes the fixed flight altitude of the UAV.

Additionally, assume that the transmitting power of the UAV is PU and the offloading rate of the UAV data can be calculated aswhere B represents the system bandwidth, is the additive Gaussian white noise power, and represents the received signal to noise ratio (SNR) at a distance of 1 m.

2.3. Energy Consumption Model

From the above analysis, the energy consumption of the UAV consists of three main parts: the propulsion energy, computational energy, and communication energy. It is described in detail in the following section.

2.3.1. Propulsion Energy Consumption Model for UAV

The unit energy consumption for the UAV during its flight at a speed of can be calculated aswhere denotes the tip speed of the rotor blades and denotes the average rotor-induced hover speed. is the air density. A denotes the area of rotor disc. denotes the body drag ratio. and denote the initial and process values of hovering power, respectively.

For any given UAV trajectory , the propulsion energy consumption can be expressed aswhere represents the speed of the UAV and is the speed of the UAV at the moment i.

2.3.2. Communication Energy Consumption Model of UAV When Offloading Tasks

The time-division multiple access approach is considered here. Specifically, the UAV can establish contact with at most one ground user at any moment, and indicates that the ground user n has established contact with the UAV. Otherwise, . is the user scheduling function, which should meet the constrains as

The data volume of the subtask offloaded from ground user n to the UAV is a function of the variable T, , and , which can be expressed as

Hence, when a task packet with data size is offloaded to the ground base station at the moment i, we can getwhere denotes users’ total computation volume and denotes the bit allocation coefficient of the system.

Then, the communication energy consumption of the UAV when offloading tasks can then be obtained as

2.3.3. Computational Energy Consumption of UAV

The energy consumed in local execution is directly determined by the CPU workload F, which can be formulated aswhere D represents the total data volume of system tasks. denotes the complexity of the application which obeys a Gamma distribution. In order to minimize CPU energy consumption, it is necessary to dynamically adjust the clock frequency in each CPU cycle to achieve the best working state. As a result, the computational energy consumption required to execute the computation task whose data size is within time T can be calculated aswhere the coefficient is a constant that takes the effective switching capacity and the probability of completion of the application execution into account.

To sum up, the total energy consumption of UAV is composed of propulsion energy consumption, calculated energy consumption, and communication energy consumption, which is calculated as follows:

2.4. Optimization Objectives

The optimization objective is to minimize the energy consumption of the UAV, which needs to take the user scheduling function , the bit allocation coefficient of the system and the UAV trajectory into consideration. Then, the problem can be formulated as

It should be noted that the problem requires to jointly optimize the UAV trajectory , the communication scheduling , and the bit allocation coefficient . And the trajectory and the communication schedule are both continuous functions with respect to time i. Furthermore, the problem constraints are nonconvex and contain binary constraints, making it difficult to obtain optimal results.

3. Computational Allocation Strategy Based on an Improved Genetic Algorithm

Minimizing energy consumption is a nonlinear 0-1 programming problem, so the binary coded genetic algorithm is selected to solve the problem. Genetic algorithm is an efficient global search algorithm, which has certain advantages in solving complex problems such as nonlinear, multipeaked, large space, and globalization. It is famous for simulating the law of “superiority and inferiority” in the evolution of organisms in nature. The main idea is to encode the solution of the objective optimization problem into chromosomes and then simulate the genetic evolution of the chromosomes to gradually approach the optimal solution.

3.1. Encoding and Initial Populations

When the genetic algorithm is applied to globally find the optimal offloading strategy of a task, each offloading strategy needs to be encoded into a corresponding chromosome to facilitate later genetic operations such as crossover and mutation [17]. In fact, encoding is the process of converting the feasible solutions of the actual problem from its solution space to the search space of the genetic algorithm. And choosing the appropriate encoding method is the fundamental task in solving the genetic algorithm.

There are a variety of encoding methods. Since in the energy consumption minimization model for task offloading, the scheduling decision variable is a binary vector, binary encoding is most suitable and conforms to the encoding principle of minimum symbol set. The population size is set to be and task offloading decisions are randomly generate, which should be encoded based on the binary chromosome encoding method. Then, the initial chromosome population can be obtained.

Since an offloading decision variable contains n number of decisions and it is known that those subtasks that can only be executed locally do not require a decision, they always have 0 decision, that is, . Suppose that a mobile application contains n number of subtasks, where number of tasks must be executed locally and number of tasks can be offloaded, and . Therefore, it is sufficient to make offloading decisions for the number of subtasks. Namely, a chromosome can be constructed by using number of binary bits (genes) in the genetic algorithm, and after arriving at the optimal solution, the completed offloading decision can be formed by combining them with another number of binary bits whose values are 0. An example of the combined encoding solution is shown in Figure 2.

As shown in Figure 2, the mobile application is divided into 10 subtasks, with 3 locally executed tasks and 7 offloading tasks. Only the decision variables of 7 offloading subtasks need to be encoded and solved. When the optimal solution is achieved, it is combined with the decision variables of the other 3 local subtasks to arrive at the final offloading decision.

3.2. Fitness Function

The optimization problem with constraints can be converted to an unconstrained problem by introducing a penalty function [18, 19]. The penalty function can combine the constraints with the objective function by introducing a multiplicative factor, and then, the optimization problem can be converted, while the optimal solution to the original optimization problem remains unchanged. The specific process can be written aswhere , , and are penalty factors, which are the weights of the inequality constraint functions in the optimization problem. The fitness function of the genetic algorithm can be combined with the original optimization problem based on the method of the penalty function. Since the proposed optimization problem is to minimize the total energy consumption of the task allocation under the constraints, the fitness function here will be designed to be inversely proportional to equation (15), which can be calculated as

3.3. Genetic Operations
3.3.1. Selection

The main function of selection is to simulate the operation of survival of the fittest in nature, select the chromosomes corresponding to some individuals with the best adaptation to produce the next generation, and eliminate the parents with poor adaptability [20, 21]. In this process, the number of individuals in parent and offspring populations should be the same.

The most common strategy used in selection is the “proportional selection” strategy. For example, the probability of selecting the bth element with priority a in a j th population can be expressed as

Proportional selection is usually achieved using the Roulette Wheel Selection (RWS) algorithm, which yields probabilities that are always distributed in the interval [0,1] and satisfy

Thus, for a population with a number of priority tasks in each generation, assuming that the total number of ath priority tasks is W and the RWS algorithm first generates W random numbers in the interval [0,1], [0, 1] and divides the wheel into W parts according to the individual probabilities . For each random number, if it is within , the individual corresponded to the task will be selected to generate the next population with W number of individuals. Thus, the RWS algorithm can be regarded as a scheme that decides whether to select an individual based on the probability corresponding to its fitness value. Therefore, this selection method has no safeguard mechanism and may allow some well-adapted individuals to be lost in genetics. According to the proposed model, elitist strategy selection is used to ensure that the better-adapted individuals will not be lost in the next generation. The elitist strategy selection is an improvement of the basic genetic algorithm. In order to prevent the optimal solutions generated during evolution from being destroyed by crossover and mutation operations, the optimal one in each generation will be copied directly into the next generation [22, 23]. The genetic algorithm with the introduction of elitist strategy tends to have faster convergence and better stability [24]. Since the execution time of tasks with higher priority affects the waiting time for the subsequent tasks with lower priority, the fitness value and the maximum time for the execution of tasks with the same priority should be considered simultaneously when performing elitist strategy selection.

3.3.2. Crossover and Mutation

Individuals are selected for the crossover and mutation operations based on the probabilities of crossover and mutation. The crossover operation for two 6 × 4 matrices is shown below, with the positions of the lines chosen at random:Before crossover: After crossover:

3.4. Genetic Update

The new population is formed by combining the population obtained through the above operations with the initial population, and the energy consumption and the corresponding fitness value of each individual in the new population need to be calculated [25, 26]. The minimum value is taken as the result of this iteration, and the individual with the greatest fitness value is selected to update the population, that is, .

4. Experiments and Analysis

In the simulation experiments, numerical results will be provided to validate the proposed algorithm. The altitude of the UAV is set to H = 100 m, and the total communication bandwidth is B = 3 MHz. The SNR is h0 = 60 dB, and the communication power consumption of the UAV is fixed at PU = 75 W. The maximum flight speed is  = 60 m/s, and the initial and final positions of the UAV are set to and . The specific simulation parameter settings for the scenario when the number of users is N = 50 are shown in Table 1.

The parameters of the genetic algorithm are set as follows. The number of populations is 50. The maximum number of iterations is 500. The crossover probability is 0.7, and the initial mutation probability is 0.01. The penalty factors , , and are set to be 107.

4.1. UAV Trajectory

The UAV trajectory based on the proposed method under different task execution time T is shown in Figure 3, where the red circle indicates the positions of the ground users.

As can be seen in Figure 3, when T = 30 s, the UAV flies along a closed-loop trajectory and has a small flight range. The UAV is farther away from the user when offloading data and the communication quality is poor. As T increases, that is, T = 60 s and T = 120 s, the distance between the UAV and users decreases and the flight range expands, improving the communication quality. When T is large enough, the UAV continues to fly along a closed-loop trajectory and serves one user for a certain number of timeslots. Thus, it can be concluded that the larger T leads to the greater flight range of the UAV, making it is closer to the users, and then brings better communication quality.

4.2. Comparison with Other Algorithms

To demonstrate the performance of the proposed method, it is analyzed in comparison with algorithms proposed in Ref. [10], Reference [12], and Ref. [16].

4.2.1. Effect of the Number of Tasks on Total Cost

When the weight of time in the total cost is 0.5, there are 10 levels of task priorities, and the effect of changes in the maximum number of tasks at each level on the total cost is shown in Figure 4. The horizontal coordinate indicates the maximum number of tasks at each level. In the experiment, for each level, a random number from 1 to the maximum is randomly generated and the tasks are numbered, and then, the dependencies on the tasks at the previous level are randomly generated according to the mutation of different tasks. The vertical coordinate shows the total cost corresponding to the allocation results obtained in different algorithms.

It can be seen in Figure 4 that the total cost grows gradually as the number of tasks at each level increases. Meanwhile, the lowest total cost is obtained in the proposed method as the UAV is used for computational task offloading and the improved genetic algorithm is introduced for problem-solving. When the task size is 30, the total cost reaches 1800. Both Ref. [10] and Ref. [12] use a traditional optimization algorithm, and the total cost grows most rapidly with the increase of tasks in each level. Reference [16] realizes the resource allocation based on a reinforcement learning network. However, it lacks a reasonable offloading target, so the total computational cost is higher than the proposed method. In addition, when there are more tasks per level, greater reduction in the total cost of executing all tasks can be achieved using the proposed method and the algorithm proposed in Ref. [16], while the proposed method has a more significant advantage.

4.2.2. Effect of the Number of Tasks on Total Time

When there are 10 levels in task priority, the effect of the change in the number of tasks on the total time to execute the same task is illustrated in Figure 5. The horizontal coordinate indicates the maximum number of tasks at each level, and the vertical coordinate indicates the total time to execute all tasks.

As depicted in Figure 5, the total computation time is the shortest due to the simplicity of the algorithm proposed in Ref. [10], which creates a weighted complete bipartite graph by adding false containers to achieve the optimal matching of task resources in the edge server. Reference [12] uses a Pareto archiving evolutionary strategy to optimize time cost, load balancing of MEC servers, and energy consumption. The overall time consumed rises rapidly with the increase of tasks due to too many optimization targets and the slow search speed of the optimization algorithm. The reinforcement learning network in Ref. [16] is more complex, and its search time is longer compared to the proposed method, which uses an improved genetic algorithm. And the proposed method introduces the UAV to dynamically adjust the offloading strategies and reduce the data transmission time; thus, its total time cost is 17 s when the task size is 30, which is about 39% less than Ref. [16].

4.2.3. Effect of the Number of Mobile Terminals on Total Cost

The effect of the change in the number of mobile terminals on the total system cost is shown in Figure 6.

As illustrated in Figure 6, when the number of mobile terminals is less than 30, the computing resources are less and the MEC server resources are relatively sufficient. Therefore, most tasks are unloaded to the MEC server for execution, and the overhead obtained by collaborative scheduling of different algorithms is not different. With the increase of mobile terminals, resources in the MEC server gradually decrease as the collaborative scheduling uses the computational resources of the mobile terminals. The total cost of Ref. [10] and Ref. [12] grows rapidly to over 4 × 104 due to their poor performance in finding the optimal solution. The proposed method allocates resources based on an improved genetic algorithm and the UAV platform, and its system cost is lower than that of Ref. [16] which applies the reinforcement learning network. Specifically, the cost of the proposed method is only half of that of Ref. [16] when there are 100 mobile terminals in the system, demonstrating that the resource allocation strategy in the proposed method is ideal.

4.2.4. Effect of the Number of MEC Servers on Total Cost

The effect of the change in the number of MEC servers on the total system cost is shown in Figure 7.

It is depicted in Figure 7 that the queuing time at the MEC server side decreases as the total computational cost gradually decreases. The proposed method has the smallest total computational cost, which is less than 0.2 × 105 when the number of MEC servers is 100. This is because the use of UAV allows dynamic adjust on the positions of MEC servers, causing less transmission loss. Furthermore, as the number of MEC servers continues to increase, all tasks are offloaded to the MEC server for execution when resources in the MEC server are sufficient. When the number of servers exceeds 70, the overhead of the whole system is almost unchanged, which shows that only increasing the number of MEC servers cannot increase the total overhead of the system. With the increase of MEC servers, the queuing latency decreases and the cost when all tasks are offloaded to MEC servers decreases at first, but it remains constant when there are enough MEC servers.

5. Conclusion

As a key and fundamental technology in 5G, the MEC system needs to meet the requirements of low latency and low energy consumption. Applying the high flexibility of UAVs, an UAV-assisted edge computing resource allocation strategy for 5G communication in the IoT environment is proposed. A system model of an UAV deployed with a MEC server to provide assisted computing services for multiple users on the ground is constructed. And the minimization of total system cost, which is composed of channel model and energy consumption model, is solved by the improved genetic algorithm, obtaining the best resource allocation strategy. The simulation results show that(1)The system model introduces the UAV-assisted edge computing with high flexibility, which can effectively reduce the total system time to be less than 17 s when the number of tasks increases.(2)Improving the genetic algorithm by using a penalty function and combination coding can enhance its ability of global optimization so as to obtain a resource allocation scheme that minimizes the total system cost. The total cost of the proposed method is 1800 when the number of tasks per level is 30 and it is less than 0.2 × 105 when the number of MEC servers is 100.

The main scenario studied in this article is a single UAV providing assisted computing services to users, while multi-UAV scenarios are more important in practical applications. Therefore, in future research studies, the focus will be attached on the scenarios of multiple UAVs serving ground users.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this article.