An UAV-Assisted Edge Computing Resource Allocation Strategy for 5G Communication in IoT Environment

. 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.


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].e 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].erefore, 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 ings (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-ofsight 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].
ere 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 overheadaware 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.
e 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.en, 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.

System Modeling
2.1.System Model.e 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 l n � (x n , y n ).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 U I � (x I , y I ) and U F � (x F , y F ), 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 T � Kδ; 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 (x[i], y[i]) and the maximum flight speed of the UAV is v max , and then, the trajectory of the UAV can be constrained as where 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 as where represents the flight speed of the UAV in the ith timeslot.α � 0.5Jδ and J is a constant related to the UAV payload.

Channel Model.
Because the wireless channel between N ground users and UAV depends on the line-of-sight (LoS) channel.erefore, the channel gain between the UAV and user n in the ith timeslot can be written as where h 0 is the channel gain at a distance of 1 m, d n [i] 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 P U and the offloading rate of the UAV data can be calculated as where B represents the system bandwidth, σ 2 is the additive Gaussian white noise power, and β 0 represents the received signal to noise ratio (SNR) at a distance of 1 m.

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.

Propulsion Energy Consumption Model for UAV.
e unit energy consumption (J/m) for the UAV during its flight at a speed of v can be calculated as where V 2 tip denotes the tip speed of the rotor blades and V 0 denotes the average rotor-induced hover speed.ρ is the air density.A denotes the area of rotor disc.τ 0 denotes the body drag ratio.P 0 and P u denote the initial and process values of hovering power, respectively.
For any given UAV trajectory U(i) { }, the propulsion energy consumption can be expressed as where v(i) ≜ U(i) represents the speed of the UAV and ‖v(i)‖ is the speed of the UAV at the moment i.

Communication Energy Consumption Model of UAV When Offloading
Tasks. e time-division multiple access approach is considered here.Specifically, the UAV can establish contact with at most one ground user at any moment, and φ n (i) � 1 indicates that the ground user n has established contact with the UAV.Otherwise, φ n (i) � 0. φ n (i)   is the user scheduling function, which should meet the constrains as e data volume D n of the subtask offloaded from ground user n to the UAV is a function of the variable T, U(i), and φ n (i), which can be expressed as Hence, when a task packet with data size (1 − ϖ n )D n is offloaded to the ground base station at the moment i, we can get where D n denotes users' total computation volume and ϖ n denotes the bit allocation coefficient of the system.en, the communication energy consumption of the UAV when offloading tasks can then be obtained as

Computational Energy Consumption of UAV.
e energy consumed in local execution is directly determined by the CPU workload F, which can be formulated as Journal of Robotics where 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 ϖ n D n within time T can be calculated as where the coefficient G � 10 − 11 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.e optimization objective is to minimize the energy consumption of the UAV, which needs to take the user scheduling function φ n (i), the bit allocation coefficient of the system ϖ n and the UAV trajectory U(i) { } into consideration.en, the problem can be formulated as min It should be noted that the problem requires to jointly optimize the UAV trajectory U(i), the communication scheduling φ n (i), and the bit allocation coefficient ϖ n .And the trajectory U(i) and the communication schedule φ n (i) 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.

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.e 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.

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.ere are a variety of encoding methods.Since in the energy consumption minimization model for task offloading, the scheduling decision variable φ n is a binary vector, binary encoding is most suitable and conforms to the encoding principle of minimum symbol set.e population size is set to be Q and task offloading decisions are randomly generate, which should be encoded based on the binary chromosome encoding method.en, the initial chromosome population S(0) can be obtained.
Since an offloading decision variable φ n 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, φ n � 0. Suppose that a mobile application contains n number of subtasks, where ϑ 0 number of tasks must be executed locally and ϑ 1 number of tasks can be offloaded, and ϑ 0 + ϑ 1 � n. erefore, it is sufficient to make offloading decisions for the ϑ 1 number of subtasks.Namely, a chromosome can be constructed by using ϑ 1 number of binary bits (genes) in the genetic algorithm, and after arriving at the optimal solution, the completed offloading decision φ n can be formed by combining them with another ϑ 0 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.

4
Journal of Robotics

Fitness Function.
e optimization problem with constraints can be converted to an unconstrained problem by introducing a penalty function [18,19].e 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.
e specific process can be written as where c 1 , c 2 , and c 3 are penalty factors, which are the weights of the inequality constraint functions in the optimization problem.e 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

Selection.
e 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.
e 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 p a,b j that are always distributed in the interval [0,1] and satisfy us, 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 p a,b j .For each random number, if it is within [ b−1 r�1 p a,r j ,  b r�1 p a,r j ], the individual corresponded to the task will be selected to generate the next population with W number of individuals.
us, 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.erefore, 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.e 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].
e genetic algorithm with the Journal of Robotics 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.

Crossover and Mutation.
Individuals are selected for the crossover and mutation operations based on the probabilities of crossover and mutation.e crossover operation for two 6 × 4 matrices is shown below, with the positions of the lines chosen at random: Before crossover: After crossover: e 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].e 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, i � i + 1.

Experiments and Analysis
In the simulation experiments, numerical results will be provided to validate the proposed algorithm.e altitude of the UAV is set to H � 100 m, and the total communication bandwidth is B � 3 MHz.
e SNR is h 0 � 60 dB, and the communication power consumption of the UAV is fixed at P U � 75 W. e maximum flight speed is v max � 60 m/s, and the initial and final positions of the UAV are set to U I � [0, 0] T and U F � [1200, 1200] T .e specific simulation parameter settings for the scenario when the number of users is N � 50 are shown in Table 1.
e parameters of the genetic algorithm are set as follows.
e number of populations is 50.e maximum number of iterations is 500.e crossover probability is 0.7, and the initial mutation probability is 0.01.e penalty factors c 1 , c 2 , and c 3 are set to be 107.

UAV Trajectory.
e 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.
e 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.
us, 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.

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].

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. e 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.e 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.

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. e 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.
e 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.e 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].

Effect of the Number of Mobile Terminals on Total Cost.
e 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.erefore, 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.e total cost of Ref. [10] and Ref. [12] grows rapidly to over 4 × 104 due to their poor performance in finding the optimal solution.e 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.Maximum task number of each level Proposed algorithm Ref. [16] Ref. [12] Ref. [10]  Ref. [12] Ref. [10] Figure 5: Effect of the number of tasks on total time.

Effect of the Number of MEC Servers on Total Cost.
e 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.e proposed method has the smallest total computational cost, which is less than 0.2 × 105 when the number of MEC servers is 100. is 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.

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.e simulation results show that (1) e 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.e 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.
e 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.erefore, in future research studies, the focus will be attached on the scenarios of multiple UAVs serving ground users.

Figure 4 :
Figure 4: Effect of the number of tasks on total cost.