Energy-Efficient Task Migration and Path Planning in UAV-Enabled Mobile Edge Computing System

With the rapid development of unmanned aerial vehicles (UAVs) technology and the advent of the 5G era, the role of UAV-enabled mobile edge computing (MEC) system has attracted much attention, especially in the event of some emergencies. However, considering the limited battery life and computing capabilities of UAVs, it is challenging to provide energy-eﬃcient services for mobile devices. To solve this challenge, we propose an energy-eﬃcient dynamic task migration algorithm (EDTM) that minimizes the total energy consumption of the system while ensuring UAVs system load balance. Based on the improved ant colony algorithm and path elimination strategy, the proposed algorithm comprehensively considers task migration distance between UAVs, the load situation of UAVs, and environmental factors (e.g., wind speed and air density) and ﬁnally plans a reasonable task migration path. The simulation results show that the performance of the proposed EDTM is superior to the benchmark schemes.


Introduction
In recent years, 5G communication technology and the Internet of ings (IoTs) have developed rapidly. Mobile edge computing (MEC) attracts much attention, which can leverage the proximate computing resources to provide latency-critical and computation-intensive tasks for mobile users [1,2]. e computation tasks generated by mobile devices (MDs) can be offloaded to the nearby edge server, such as base stations. However, these edge servers are static. It is difficult to provide powerful and stable computing services for MDs when encountering emergency calls, disaster response, and rural environments. In these cases, UAVs can act as mobile edge servers to provide more flexible and dynamic services [3]. Compared with cellular-based MEC, UAVs have the advantages of fast, high mobility, and controllable mobile management [4].
Despite the advantages of UAV-enabled MEC, there are several challenges. First, the energy capacity of UAVs is constrained. To guarantee the quality of service (QoS) of MDs, it is crucial to consider the energy consumption of task migration. Second, the computation capabilities of UAVs is limited, a single UAV cannot support high computation loads, it is necessary to perform task migration with other UAVs, while ensure load balance among UAVs system.
ird, an energy-efficient path planning strategy is also a challenge in UAV-enabled MEC. With an optimal task migration path, UAVs can pay less migration energy cost under load balancing. In the literature, there have been some studies focused on task migration [5][6][7][8][9] in MEC and optimization UAV-assisted network [10][11][12][13][14]. However, on the one hand, these research works mainly focus on energy consumption optimization, while neglecting considering load balance in MEC system. erefore, the works related to dynamic task migration in MEC system cannot be efficiently applied in the UAV-enabled MEC systems. On the other hand, the existing works targeted on UAV-assisted network did not comprehensively considers task migration distance between UAVs, the load situation of UAVs, and environmental factors for the path planning of task migration with load balance within the UAVs systems, which is significant for task migration in UAV-assisted network.
In this paper, we consider a joint optimization problem that simultaneously considers the above challenges have not been sufficiently investigated and considering actual environmental factors, such as wind speed and air density. To address these challenges, we propose an energy-efficient dynamic task migration algorithm (EDTM) in a UAV-enabled MEC system, which minimizes the total energy consumption of the system under load balance. e main contributions of the paper are summarized as follows: (i) We formulate a system model in the UAV-enabled MEC system, which consists of communication model, task computation model, and energy consumption model. We fully consider the energy costs of the MDs and UAVs, including local computation energy consumption on MDs, edge computing energy consumption on UAVs, task migration energy consumption. (ii) We improve the ant colony algorithm and propose an EDTM algorithm to migrate computation tasks.
Considering the load balance of UAVs, we design a path planning elimination strategy, which comprehensively considers task migration distance between UAVs, the load situation of UAVs, and environmental factors. (iii) We conduct extensive experiments and the simulation results demonstrate that the proposed EDTM algorithm can achieve superior performance than the benchmark schemes, which can effectively reduce the total energy consumption of the system while ensuring the load balance of the UAVs system. e remainder of the paper is organized as follows. Section 2 introduces related works. In Section 3, the system model and problem are described. Section 4 presents the EDTM algorithm to solve the joint optimization problem. In Section 5, we evaluate the performance of the proposed EDTM with extensive simulation results. Finally, we conclude the paper in Section 6.

Related Works
We review the related works by two categories, i.e., dynamic task migration and UAV-assisted networks in MEC.

Dynamic Task Migration.
ere are some research efforts on dynamic task migration [5][6][7][8][9]. Wang et al. [5] described the task migration problem as a Markov decision process and designed an optimal service migration strategy in MEC. Kuang et al. [6] studied the partial offloading scheduling and power distribution problem for single-user MEC system. ey proposed an iterative algorithm to reduce energy consumption and achieve optimal delay performance. Moreover, the authors of [7] proposed a task migration energy optimization strategy by considering resource caching. Meanwhile, Anajemba et al. [8] studied cooperative offloading scheme in energy-efficient multiaccess edge computing and proposed a Lagrangian suboptimal convergent computation offloading algorithm. Zhou et al. [9] studied dynamic task offloading in MIMO MEC system with energy harvesting. e authors proposed an algorithm to minimize the time average of a weighted sum of energy consumption and execution delay, meanwhile stabilizing the battery energy queue. However, the above research works focus on energy consumption optimization, while neglecting considering load balance in the MEC system. erefore, they cannot be efficiently applied in the UAV-enabled MEC systems.

UAV-Assisted Networks.
UAVs have been deployed to enhance the network capacity and provide services to mobile users with or without infrastructure coverage which attracts much attention in the literature [10][11][12][13][14]. Particularly, the paper [10] studied energy-efficient resource management in UAV-assisted MEC. e goal is to jointly minimize the energy consumption at the IoT devices and the UAVs during task execution. Liu et al. [11] proposed a machine learning framework for trajectory design and power control for multi-UAV assisted networks. In addition, Li et al. [12] studied UAV-assisted MEC with the objective to optimize computation offloading with minimum UAV energy consumption. ey adopted the Dinkelbach algorithm and the successive convex approximation technique to solve it. Wu et al. [13] considered a multi-UAV enabled wireless communication system, where multiple UAV-mounted aerial base stations are employed to serve a group of users on the ground. Existing UAV communication and trajectory schemes are inefficient as they assume limited drone mobility and static transmission power. Garg [14] considered a multi-UAV system where UAV-mounted mobile base stations serve users on the ground and proposed an iterative approach using block gradient descent. To summarize, although some research problems related to UAV-assisted networks have been investigated. However, they did not comprehensively consider task migration distance between UAVs, the load situation of UAVs, and environmental factors for the path planning of task migration with load balance within the UAVs systems, which is significant for task migration in UAV-assisted network and motivates our research in this paper.

System Model
3.1. System Architecture. We consider a MEC system with multiuser and multiedge servers with dynamic task migration.
e system consists of M MDs and N UAVs that integrate MEC servers and communication circuits. We define M � 1, 2, . . . , M { }, m ∈ M, and U � 1, 2, . . . , { t, . . . , U}, ∀u ∈ U to represent the set of MDs and UAVs, respectively. As for the total time T for task migration 2 Complexity completion in the system, it is divided into F time slots on average. We use T· � 0, 1, . . . , F { }, t ∈ T to represent the set of time slots, where the length of all time slots t is τ. Moreover, the length of the time slot is small enough to ensure that the position of the UAVs during each time slot is approximately unchanged. e definitions of the main symbols involved in this paper are shown in Table 1.
In this paper, due to the strong mobility of MDs, UAVs will have dynamic task migration in the process of providing services (task processing) to MDs. In order to facilitate the understanding of dynamic task migration, we describe task migration in the UAV-enabled MEC system architecture with multi-user and multiedge server, as shown in Figure 1. Among them, UAVs are distributed around MDs to provide computing services for MDs. We select MD m for the paper detailed description. Initially, MD m was within the service coverage of UAV u. When MD m moved from the initial position 1 to position 2, MD m had already left the service range of UAV u. During the mobile process of MD m, its service quality will be seriously affected and even service termination will occur. In order to ensure the quality of the service, we need to migrate the tasks that were initially processed on UAV u. In addition, task migration also needs to consider whether location 2 is the endpoint of the MD m move. If position 2 is the endpoint of MD m during the movement, MD m will stop moving after reaching position 2; otherwise, MD m will continue to move after reaching position 2.
is greatly increases the difficulty of dynamic task migration. e above constitutes the most basic dynamic task migration process of a mobile device. In Figure 1 To facilitate the description of the dynamic task migration path, we also define the positions of UAVs and MDs in all time slots. We define the initial position of MDs at the origin (0,0,0) of the spatial rectangular coordinate system, and the direction in which the MDs are connected from position 1 to position 2 is the x-axis of the spatial rectangular coordinate system. erefore, a line perpendicular to the xaxis on the horizontal plane is the y-axis. e vertical plane can get the z-axis perpendicular to the x-axis and y-axis. Specifically for a certain UAV, we use x t u and y t u to represent the coordinates of the UAV u on the horizontal x-axis and yaxis in time slot t, that is, the horizontal position of the UAV u in time slot t. Based on the particularity of UAVs, we add a height variable z t u to represent the position of UAV u in the vertical direction in time slot t. erefore, the position of UAV u in time slot t is finally defined as the triple l t u � ( Because UAVs are widely distributed around MDs, and each MD can access a groups of UAVs within the broadcast range, MDs can offload computing tasks to UAVs within the accessible range [15]. We use N t u ∈ M to represent the set of MDs in the service range of UAV u in time slot t, and the UAVs set in its communication range are defined as V t u ∈ U. And because only the digital description of the distance between UAVs and MDs and UAVs can guide the task migration process. Next, we define the distance set d t u between UAV u and the MDs included in the set N t u in time slot t and the distance set d t u between UAV u and the UAVs included in the set V t u . Among 2 represent the distances between UAV u and MD m and UAV u and UAV 1 in time slot t, respectively. And and satisfy and respectively. Furthermore, we can get the relative position of UAV u in time slot t, that is, where H 0 indicates the channel gain in the initial state.
In [16], the uplink transmission power of MDs is mainly determined by the channel gain and channel bandwidth. As UAVs are used in this paper to provide edge service functions, the uplink transmission power of MDs is also greatly affected by the dynamic change of the distance between MDs and UAVs. When the distance between MDs and UAVs increases, in order to ensure that the task offload is not affected, the uplink transmission power of MDs will increase accordingly. Otherwise, the uplink transmission power of MDs will decrease accordingly. Specifically, the uplink transmission power of MD m to offload tasks to UAV u in time slot t is defined as where σ 2 and B actually represent the noise power and the actual network bandwidth in the uplink transmission process, respectively. And p t m,u satisfies the following equality, i.e., where p max MD is the maximum transmission power of MDs.

Complexity
At the same time, because this paper uses UAVs to perform edge computing functions, the information transmission between UAVs and MDs and between UAVs is wireless communication [17]. In the process of wireless communication, the theoretical bandwidth and actual bandwidth will be different, because network loss and line attenuation will occur in real scenarios. Table 2 is a set of actual measured data, which shows the relationship between the channel bandwidth and the theoretical download speed as well as the actual download speed.
According to the data in Table 2, we can get the relationship between the actual bandwidth and the theoretical bandwidth of the network, that is,    In this paper, we do not consider downlink transmission delay and packager loss, because the data size of the result after the task is processed is usually smaller than the data size before the task processed [18], and the downlink transmission rate from UAVs to MDs will be higher than the uplink transmission rate from MDs to UAVs.

Task Computation Model.
In this section, we introduce the computational model of the system. e main research direction of this paper is the task migration strategy in mobile edge computing systems.
In this paper, we define f t m as the CPU cycle frequency of MD m in time slot t, and f t u,m is defined as the computing resource that UAV u allocates to MD m in time slot t for processing the computing tasks offloaded by MD m. And f t m and f t u,m satisfy the following equality, respectively, that is, where f max MD and f max UAV represent the maximum cycle frequencies of MDs and UAVs, respectively.
Whether it is an UAV or a MD, the tasks in the task queue are processed according to the "first come, first served" rule. In particular, the unit of the task amount is unified as bits, and the CPU cycle required to process one bit of any type of computing task is c. We assume that task arrival MDs are a random model and that task arrival is independent. e total number of tasks processed by MD m in time slot t is c t m , that is, While the total number of tasks that MD m offloads to UAVs is r t m . When MDs offload some tasks to UAVs, UAVs will process these tasks. Although the computing power of UAVs is much stronger than that of MDs, the computing power of UAVs is extremely limited compared to cloud servers. UAV u handles the number of tasks from MD m offload at time slot t is b t u,m . erefore, we can get the dynamic task backlog queue of UAV u, i.e., In a real application scenario, some MDs will offload tasks to UAVs, while some MDs may not [19]. So, m∈M r t m ≥ 0. In addition, because our optimization goal is to ensure that each UAV achieves load balancing in each time slot as much as possible, that is, the number of tasks that each UAV needs to process in each time slot is approximately equal. erefore, we define the limiting conditions as shown in equality (9), so that the number of tasks of each UAV in each time slot cannot exceed 10\% of the average number of tasks in the queue of all UAVs. Furthermore, MDs can make full use of the computing resources of UAVs without causing a waste of resources.
Next, we introduce the system energy consumption model in detail.

Energy Consumption Model
First, the task processing energy consumption includes the energy consumption of MDs and UAVs when processing tasks. According to the capacitance theory, whether it is a MD or an UAV, the processing energy consumption is mainly determined by the CPU performance of the electronic device, that is, chip architecture [20]. In the paper [21], we can know that the CPU cycle frequency varies with the CPU voltage and is linearly related. erefore, the task processing energy consumption of MD m and the energy consumption of UAV u processing offloaded tasks are respectively expressed as (9) and (10), that is, Among them, κ represents the effective capacitance switch of the CPU, and the value of κ is determined by the performance of the CPU.
Secondly, the communication energy consumption consists of the energy consumption of the MDs offload task and the energy consumption of task migration between UAVs. As mentioned earlier, if MD m chooses to offload computing tasks to UAV u through the uplink, then the transmission energy consumption of MD m offloads tasks to UAV u in time slot t can finally get and show as follows: In addition, the dynamic task migration from UAV u to UAV 1 is shown in Figure 2. In Figure 2, MD 3 is initially in the service range of UAV u, so MD 3 offloads tasks to UAV u. However, with the movement of MD 3, MD 3 eventually moves away from the service range of UAV u. In order to ensure the normal service of MD 3, UAV u needs to reselect  Figure 2, the new UAV is UAV 1. At this time, we can get the task migration energy consumption of UAV u migrates the tasks to UAV 1, that is, where p t u,1 is the transmission power between UAV 1 and UAV u, and its specific computation method is similar to (2) in Section 3.2. And p t u,1 cannot exceed the maximum transmission power of UAV, that is, Finally, in addition to the energy consumption of task computation and task migration for UAVs, the energy consumed by UAVs for a flight cannot be ignored. Most of the papers only consider the flying speed of UAVs as the independent variable when studying the flight energy consumption of UAVs. However, it shows that the flight energy consumption of UAVs depends not only on the speed of UAVs but also on the acceleration of UAVs [21][22][23]. Next, we define the velocity and acceleration of UAV u in time slot t, which are expressed as follows: erefore, we can get the flight energy consumption of UAV u in time slot t, that is, Among them, k u,1 � 0.5 · ρ · G u · τ, k u,2 � (2 · G 2 u · τ/ (πρA R S r )). G u represents the weight of UAV u, and g represents the acceleration of gravity. ρ stands for air density (kg/m 3 ). A t u and S t u represent the number of revolutions per second of the propeller of UAV u and the speed of the wind around the UAV u (m/s) in time slot t, respectively.
Regarding the flight of UAVs, there are three special restrictions that need to be specified. First, the flying speed of every UAV at each moment should be less than the maximum flying speed v max , that is, Equality (18) restrict the position of UAVs. e meaning of equality (18) means that each UAV's own trajectory history cannot be changed. e meaning of equality (18) means that during the total time T, each UAV has an initial position and a final position. e specific restrictions are as follows: where η is a small nonnegative value. l u,start and l u,end represent the initial and final positions of UAV u, respectively.
In summary, the total energy consumption of all UAVs in the system in time slot t is defined as follows: 6 Complexity where ε is a nonnegative penalty coefficient, which represents the ratio of the flying energy consumption E t fly,u to the total energy consumption E t UAV of UAVs. e larger the value of ε, the greater the proportion of E t fly,u in E t UAV . Otherwise, the smaller the proportion of E t fly,u in E t UAV . In the MEC system, we adjust the ε value to achieve a balance between UAVs flight energy consumption and UAVs computation migration energy consumption. Similarly, we can get the total energy consumption of the entire system in time slot t, that is, where ϖ 1 and ϖ 2 represent energy consumption weighting factors of MDs and UAVs, respectively, and satisfy 0 ≤ ϖ 1 ≤ 1, 0 ≤ ϖ 2 ≤ 1, and ϖ 1 + ϖ 2 � 1. When ϖ 1 increases, ϖ 2 will decrease accordingly. At this time, the energy consumption ratio of MDs becomes larger and the energy consumption ratio of UAVs becomes smaller. Conversely, the energy consumption ratio of MDs becomes smaller, and the energy consumption ratio of UAVs becomes larger. In this model, we can dynamically adjust ϖ 1 and ϖ 2 according to the actual situation to meet the priority energy demand, and finally, achieve the energy balance between MDs and UAVs.

Problem Formulation.
Next, we mainly optimize from two aspects of energy consumption, UAVs load balancing (that is, to ensure that the task queue of UAVs in each time slot in the system has a minimum backlog), and comprehensively consider performance indicators such as task offloading, CPU cycle frequency allocated by UAVs to MDs offloaded tasks and flight energy consumption of UAVs. Finally, we worked out the problem of minimizing the energy consumption of the system under the premise of UAVs load balancing, that is, s.t.
where X represents a migration decision, which is a set of nodes on a migration path. For example, X � 1, 3, 4 { } means that tasks are migrated from UAV 1 to UAV 3 first, and then they are migrated from UAV 3 to UAV 4. e research focus of this paper is to find the optimal edge servers (i.e., UAVs) migration path that is most suitable for tasks to complete the migration while ensuring that each edge server is load balanced, so that edge servers are not overloaded. Especially, the optimal migration path with the lowest energy consumption.

Description of the Dynamic Migration Algorithm.
In this section, we propose a new and improved iterative algorithm, called Energy-efficient Dynamic Task Migration (EDTM). e proposed EDTM algorithm is modified on the basis of the ant colony algorithm. e traditional ant colony algorithm is a heuristic optimization algorithm. Although the initial optimization results of the problem can be obtained by the traditional ant colony algorithm, it has the disadvantages of being easily trapped into a local optimum and slower convergence speed [24]. In this paper, we combine the specific research content of this paper to improve the traditional ant colony algorithm. According to the inspiration of [25], the proposed EDTM algorithm has adaptive consistency and is more suitable for MEC. e main improvements are as below.
First, we modified the pheromone update strategy in the ant colony algorithm. e idea of the ant colony algorithm originally originated from the process of ants finding the best path. An ant leaves an odor when walking through a certain path. is odor is called a pheromone. e ants behind it would be based on the pheromone concentration to choose a path, the greater the pheromone concentration, the higher the probability that an ant will choose this path, and vice versa. In this model, the proposed EDTM algorithm will also select the next UAV node according to the number of different UAV nodes and the location of each UAV node in each time slot. It can prevent the proposed EDTM algorithm from falling into a local optimum too quickly, and at the same time increase the global search capability of the algorithm.
Secondly, based on the goal of this paper is to jointly optimize UAV load balancing and reduce the total energy consumption of the system, so we add the task queue of UAVs as a variable to the formula transition probability. e meaning of transition probability is the probability that the ant chooses the next UAV node. is helps us find a reasonable migration path.
irdly, in the initial iterative process of the ant colony algorithm, the ant has to try all possible paths in order to find the optimal path, which will cause the algorithm to be redundant and increase the complexity. In the proposed EDTM algorithm, we propose a method of path elimination. By setting the "number of pathfinding nodes" to control the number of iterations of the algorithm. On the basis of ensuring the accuracy of the algorithm results, the complexity of the algorithm is further reduced, and the algorithm execution efficiency is improved. e proposed EDTM algorithm comprehensively considers the migration distance, the UAVs load situation, and the migration cost to finally plan a reasonable task migration path. e algorithm has a very strong ability to find solutions to combined optimization problems. In addition, it has the advantages of distributed computing and the advantages of easy integration with other algorithms. In particular, it can show a high degree of flexibility and robustness in dynamic environments [26,27]. Because the scenario in this paper uses UAVs as edge servers to provide services to users, we attach great importance to the advantages of mutual cooperation between UAVs.Finally, these UAVs process the sub-tasks and return corresponding results to MDs.

Solution to Problem P.
In this section, we specifically explain how the proposed EDTM algorithm solves problem P. In the previous model, we have defined the UAVs set U � 1, 2, . . . , t, . . . , U { }, ∀u ∈ U, and d t u represents the distance between UAVs nodes in time slot t. Specifically, our description of the proposed EDTM algorithm is divided into the following seven steps.
Step 1. Initialize. In this paper, UAVs nodes can communicate with each other, so we initialize the pheromone on each edge to a small constant value, and then randomly assign A ants to U UAVs nodes. At the same time, we set the starting UAV node to the tabu list. One thing that needs to be explained here is that the reason why we did not initialize the pheromone directly to zero is that the ants choose the next hop UAV node will receive the influence of the pheromone concentration.
Step 2. Each ant will select the next UAV node according to formulas (22) and (23), and update the tabu list.
where i ∈ U, j ∈ U, and Y a is a set, that is, tabu table. Y a is used to record the UAV nodes passed by ant a. e tabu table Y a will be updated as the algorithm iterates. ϕ ij (t) indicates the value of the pheromone transferred from UAV node i to UAV node j in time slot t. e greater the value of the pheromone, the greater the probability that the ant chooses the UAV node as the migration node, and the two show a proportional relationship. ϕ ij (t) is the heuristic information of the ant transferred from UAV node i to UAV node j in time slot t, and the heuristic information will affect the probability that the ant chooses the next node. In this paper, we take the distance between UAV node i and UAV node j as the independent variable of the heuristic information, so we define ϕ ij (t) � 1/d t i,j . e longer the distance between UAV node i and UAV node j, the smaller the value of heuristic information; otherwise, the larger the value of heuristic information. Next, we named the χ ij (t) in formula (22) as a statin, which represents the value of the statin of the ants from UAV node i to UAV node j in time slot t. e effect of statin is opposite to that of pheromone. e greater the value of statin, the lower the probability that the ant will choose the UAV node as the migration node, and the two show an inverse relationship. e optimization goals of this paper are two aspects, namely, to ensure the load balance of UAV groups and reduce the total energy consumption of the system. erefore, we specifically represent the statin χ ij (t) in formula (22) as χ ij (t) � k 3 · Q UAV j (t). It can be seen that the larger the load of the UAV node (that is, the longer the task backlog queue length of the UAV node in time slot t), the larger the statin of this path. Similarly, the smaller the load of the UAV nodes in this path is, the smaller the statin of this path is. erefore, χ ij (t) and Q UAV j (t) have a function proportional relationship, where k 3 is used as the coefficient of the function expression. It should be noted that q 0 ∈ [0, 1] is a parameter initially set by the system, and q is a random number and satisfies q ∈ [0, 1]; finally, p a ij represents the probability that the ant a moves from UAV node i to UAV node j. e specific expression is as follows, In particular, formula (22) and formula (23) contain the weighting factors of pheromone, heuristic information, and statin, which represent the importance of pheromone on paths i and j, represent the importance of heuristic information and represent the importance of statin on paths i and j.
Step 3. Local update of pheromone. According to the idea of bionics in biology, if an ant passes a certain path, then the pheromone concentration on this path will increase again. e specific formula for the pheromone update is as follows, where μ(t) is called the pheromone volatility factor, which indicates the volatility coefficient of the pheromone in time slot t. e setting of μ(t) in the proposed EDTM algorithm is very important, it directly affects the execution efficiency of the algorithm. μ min is the minimum value of the pheromone volatilization rate set by the system in advance, and its role is to prevent the convergence speed of the proposed EDTM algorithm from being too low due to μ(t) too small. At the beginning of the algorithm, μ(t) should take a larger value. e advantage of this is that it can speed up the convergence speed of the algorithm.
With the increase of the number of iterations, in order to prevent the convergence from falling too quickly into a local optimum, the value of μ(t) should be gradually reduced to improve the global search capability of the proposed EDTM algorithm. erefore, this model uses the method shown in (25) to adaptively adjust μ(t).
In addition, Δϕ a ij in (24) represents the amount of pheromone left on the path when ant a passes through UAV node i and UAV node j. e specific expression of Δϕ a ij is shown: where Q represents the total amount of information released by ant a for one week, and it is a constant; D ij is the length of the path that ant a has traveled from the starting UAV node to the current UAV node.
Step 4. Compute the best path. After A ants have walked through all UAV nodes, we need to choose a path suitable for migration among these paths. In the task migration, in addition to the load of the nodes, we also need to consider the energy consumption caused by the migration [28,29]. In the model part of the paper, equation (13) defines the migration cost, so we use migration cost as a measure of optimal path quality. e specific formula is as follows: where E a is the migration cost caused by the path taken by ant a.
Step 5. Path elimination rules. In this paper, we set the "number of pathfinding nodes" B to control the number of iterations of the algorithm, and we define B � ⌈20% · U⌉. It can be seen that the number of pathfinding nodes is related to the total number of nodes in the entire system. When the proposed EDTM algorithm starts to run, A ants do not have to iterate over all UAV nodes, but only needs to filter out the B nodes closest to the initial UAV node in the system for access. After each iteration is completed, the algorithm automatically executes Step 4 to find the optimal migration path from path set, and the remaining paths no longer participate in the operation of subsequent algorithms.
Step 6. Global update of pheromone. After the ants have walked through all UAV nodes, we need to distinguish the best path from the normal path. erefore, we process the pheromone on the best path according to formula (28) to convert the old pheromone ϕ old where σ is the global pheromone volatility coefficient, Δϕ ij represents the sum of the pheromone amount of all ants passing through the path between i and j, and Δϕ ij is defined as follows: , if the global optimal solution across the path of UAV node i and j, 0, otherwise, where D good represents the length of the optimal path.
Step 7. In this paper, as the number of iterations increases, the change of the migration node-set X will stabilize. erefore, we set a search number in the proposed EDTM algorithm. If the specified search number is not reached, the tabu list is cleared and the above process is repeated.

Path Elimination Rules.
e path elimination rule is a process of determining the number of valid UAV nodes. If the subset of UAV nodes that can be the most likely to become valid nodes can be filtered first, this will greatly reduce the running time and complexity of the proposed EDTM algorithm. Before the proposed EDTM algorithm starts to execute, we can determine the valid nodes from the source nodes. is is a pre-processing process.
In Step 5 of Section 5.2 of this paper, we mentioned "Number of Pathfinding Nodes" B. ese UAV nodes are the possible UAV nodes closest to the initial UAV node. At the same time, these UAV nodes are also the most likely to become valid UAV nodes. erefore, we have reason to believe that the probability that the optimal path passes through these nodes will be relatively large. In addition, B meets B ≤ U − 1, and U is the total number of UAV nodes in the system. e value of B can only be a constant between 1 and U-1. e value of B will directly affect the convergence speed and accuracy of the proposed EDTM algorithm.
To facilitate understanding, we use Figures 3-5 to illustrate the process of obtaining the optimal migration path after MD m offloads tasks to UAV 1. In detail, Figure 3 shows that it is currently in the initial state and no task migration has occurred. ere are 6 UAV nodes distributed from UAV node 1 to UAV node 6, respectively. Furthermore, node 1 is the initial node and node 6 is the destination node. All we need to do is plan an optimal path from node 1 to node 6. Before we start using the path elimination method, we first introduce the situation of the traditional ant colony algorithm in the early iteration, as shown in Figure 4. When the algorithm started running, UAV node 1 had to calculate the transition probability with the remaining 5 UAV nodes and then make a judgment, which means that the time complexity of the first iteration is O(n). As the number of iterations increases, the running time of the algorithm will increase at an exponential rate, that is, O(n n 2 − 2n+1 ).
To sum up, the traditional ant colony algorithm does have certain defects in the initial iteration. We start with the path elimination method, and the (a-e) graph contained in Figure 5 corresponds to the five processes of optimal path acquisition.
ere are 6 nodes in Figure 5(a), so it can be computed by the formula B � ⌈20% · 6⌉ � ⌈1.2⌉ � 2. As shown in Figure 5(a), the two nodes closest to node 1 are node 2 and node 3. e next-hop UAV node can be obtained by computing the transition probability. We assume that the   computation result is node 3. Figure 5(b) shows two computation possibilities for the next node. For node 3, we only need to compare its transition probability with node 4 and node 6. We assume that the computation result is that node 4 as the next hop UAV node. Since the ant has searched for the destination node in the process of finding a valid node, we first update the migration node-set to X t u � 1, 3, 6 { }. Next, it is node 4 to start searching for new valid nodes. At this time, the two nodes closest to node 4 are node 1 and node 2. But since node 1 is the initial node, node 1 is excluded from the valid nodes. At this time, we need to compute the transition probability of node 2 and 5. We assume that the computation result is that node 2 as the next-hop node, as shown in Figure 5(c). As shown in Figure 5(d), the two nodes closest to node 2 and not yet visited are node 5 and node 6. en we need to continuously compare the total migration cost with the migration cost of the previous migrated nodes set X t u � 1, 3, 6 { } and select the optimal migration path. Finally, the migration node-set X t is updated. Now, only the last UAV node is left, it is shown in Figure 5(e).

5.4.
e Proposed EDTM Algorithm. In this section, we mainly introduce the specific process of the proposed EDTM algorithm to solve the joint optimization problem of load balancing and total energy consumption in the system. e number of target UAV nodes that we screen is r � ⌈15% · U⌉. We select r UAV nodes with the shortest task backlog queue length (that is, the lowest load) as the target UAV nodes. After clarifying the target UAV node, we begin to use the proposed EDTM algorithm to compute the optimal migration path. Because the target UAV node is not unique, the final migration path must also be unique. We can divide the task and then migrate to these UAV nodes.
ese UAV nodes will perform the distributed processing on the task, and finally, return the results to MDs. e detailed process of the proposed EDTM algorithm is shown in Algorithm 1. In Algorithm 1, e represents the number of iterations, Q UAV (t) represents the task backlog queue set of all UAVs nodes in the system at time slot t.
Besides, the special nature of the proposed EDTM algorithm, the task migration efficiency of multiple users will be higher. Because the ants look for UAV nodes and paths are based on the pheromone left by the previous ants, when there are multiple MDs that need task migration, it is no longer necessary to run the proposed EDTM algorithm to replan the migration path.

Experimental Results.
In this experiment, we simulated a 600 m × 600 m rectangular area in which a UAV group flies and provides services to MDs. e horizontal movement range of each UAV is 240 square meters. ere is no limit to the flight trajectory of each UAV, but one thing we need to emphasize is that the initial position and end position of each UAV is always the same. We assume that the number of UAVs and MDs is 15 and 100, respectively. Besides, the service radius of each UAV is 150 m. e main parameters are defined in Table 3.

Setting of Experimental Parameters.
In this experiment, we simulated a 600 m × 600 m rectangular area in which a UAV group flies and provides services to MDs. e horizontal movement range of each UAV is 240 square meters. e flight trajectory of each UAV can be the same or different, but one thing we need to emphasize is that the initial position and end position of each UAV is always the same. We assume that the number of UAVs and MDs is 15 and 100, respectively. Besides, the service radius of each UAV is 150 m. In summary, each UAV is flying within a fixed range as an edge server and each MD offloads tasks that it cannot process or has a large amount of computation to the UAVs. e main parameters are defined in Table 3.
For some parameters in the proposed EDTM algorithm, And we set the number of iterations of the entire algorithm during the run to 4500. Besides, we need to explain that if the values of (α/β) and (α/λ) are too large, the ant has a strong dependence on the pheromone when choosing the path, which will easily fall into a local optimum; otherwise, the ant will not rely on the pheromone left by other ants to make judgments.

e Effect of B and r on the Proposed EDTM Algorithm.
In this paper, to accelerate the early convergence speed of the proposed EDTM algorithm, we introduce the variable B. e value of B will directly affect the convergence speed and the accuracy of the results. e B value selected in Figure 6 and Figure 7 are 10% · u, 15% · u, 20% · u, 25% · u. Since we have a small number of UAVs, our percentage difference during the experiment is 5%. In Figure 6, the time points at which 25% · u, 20% · u, 15% · u, and 10% · u converge are 3560 ns, 4516 ns, 5231 ns, and 6010 ns, respectively. Especially, 25% · u has the fastest convergence speed and requires the fewest actual iterations. 10% · u has the slowest convergence speed, and it has the most iterations. In Figure 7, the ordinate represents the length of the optimal path. Also, we can know that 10% · u has the slowest convergence speed but it has the shortest optimal path length. And 25% · u has the fastest convergence speed, but its optimal distance is proportional to the other three best paths. In this paper, we need to consider both the convergence speed of the proposed EDTM algorithm and the accuracy of the results, so we choose B � ⌈20% · U⌉. Next, we continue to analyze the effect of r value on the proposed EDTM algorithm. To guarantee the users Qos, we split the tasks and then migrate them to multiple UAVs. ese UAVs jointly perform the task and then return the final computation result to the MDs. One of our research priorities is how many UAVs we migrate to during this process. As shown in Figures 8 and 9, we consider the impact of r value on the proposed EDTM algorithm from two aspects: migration cost and load balancing. In Figure 8, the migration costs corresponding to 5% · u, 10% · u, 15% · u and 21% · u increase with time. Among them, the migration cost of 5% · u is the lowest, and the migration cost of 21% · u is the highest. is is because the larger the number of target UAVs, the higher the final migration cost. Also, we can find from Figure 8, the migration cost of the system rises rapidly between 2263 ns and 3700 ns, which is because the requirements of the migration task conform to Poisson distribution.
In Figure 9, the ordinate indicates the extreme difference of the UAV task queue length as a percentage of its maximum task queue length at the current moment. We use the computation method of extreme difference to judge the load balancing of UAVs in the MEC system. As shown in Figure 9, 0.9 represents 90%, 0.8 represents 80%, and the following values are deduced by analogy. In the previous paper, we explained that our optimization goal is to ensure that the task queue length of each UAV does not exceed 10% of the average number of tasks in the queues, so we set a baseline in the experiment. Also, we can learn that 5% · u, 10% · u, 15% · u, 21% · u will all converge to 10%, which proves that the proposed EDTM algorithm can make the load of the UAV group reach equilibrium, but their convergence speed will be different. Among them, 21% · u has the fastest convergence speed, and 5% · u has the slowest convergence speed.
In summary, we choose r � ⌈15% · U⌉, which ensures the convergence speed of the proposed EDTM algorithm, and the system migration cost is low.

e Analysis of Weight Factor.
In formula (20), we use two weighting factors, i.e., ϖ 1 and ϖ 2 . Due to 0 ≤ ϖ 1 ≤ 1, 0 ≤ ϖ 2 ≤ 1 and ϖ 1 + ϖ 2 � 1, we just need to choose the value of ϖ 2 . As shown in Figure 10, we selected ϖ 2 � 0, ϖ 2 � 0.1, ϖ 2 � 0.2 and ϖ 2 � 0.5. As ϖ 2 decreases, ϖ 1 will increase accordingly. At this time, the MEC system will tend to minimize the energy consumption of MDs. And the average energy consumption (AEC) of the UAVs will also increase with the acceleration. When the acceleration changes from Input: Q UAV (t), q 0 , α, β, λ, Q, num, A, r Output: Q UAV (t + 1), X t (1) Initialize the target UAV node Set and initial UAV nodes (2)   40 m/s 2 to 47 m/s 2 , the AEC of the UAVSs has a growth jump, which mainly comes from two aspects. One is because we set the wind speed in the entire area as a random number in [3.5 m/s, 10 m/s], a sudden increase in wind speed will increase the flight energy consumption of the UAVs, which in turn will increase the AEC of the UAVs. In summary, we can find that the smaller the ϖ 2 , the larger the AEC of the UAVs. When ϖ 2 � 0, the AEC of the UAVs is the largest because the system goal is only to focus on minimizing the energy consumption of MDs.

5.9.
e Analysis of the Proposed EDTM Algorithm Performance. In this section, we analyze the performance of the proposed EDTM algorithm. As shown in Figure 11, the proposed E DTM algorithm converges after approximately 2650 iterations, while the ACO algorithm enters a convergence state after approximately 3460 iterations. Obviously, under the same conditions, the proposed EDTM algorithm converges faster than the ACO algorithm.
As shown in Figure 12, the abscissa represents time, and the ordinate represents the extreme difference of the UAV task queue length as a percentage of its maximum task queue length at the current moment in the UAV group. In this experiment, we assume that the process of task arrival conforms to the Poisson distribution, so we can know from Figure 12 that the task queue extreme value of the UAV group between 1500 ns and 2700 ns becomes large and rises very quickly. Between 2700 ns and 5000 ns, the proposed EDTM algorithm makes the extreme difference smaller and stays around 0.1 in the end.
According to the above experiment, the proposed EDTM algorithm is superior to the ACO algorithm in terms of

Complexity 13
convergence speed and optimization of load balancing efficiency of the UAV group. At the same time, we have also proven that the proposed EDTM algorithm can help the UAV group achieve load balancing. Besides, part of the current research work solves the task migration problem in MEC by setting up Markov Decision Process (MDP). For example, researchers proposed an MDP algorithm based on static distance (MDP-SD). Next, we compare the performance of the proposed EDTM algorithm and the MDP-SD algorithm in terms of migration cost and average load percentage of the UAV groups. As shown in Figure 13, the reason why the curve changes as shown is because we assume that the computation task request conforms to the Poisson distribution. When t � 0, there is no computation task in the system, so the migration cost of UAVs is 0. When 0 < t < 1650 ns, the computation task request amount over time slowly rising, and the migration cost of the MDP-SD algorithm is slightly higher than that of the proposed EDTM algorithm. is is because the MDP-SD algorithm consumes more computing resources than the proposed EDTM algorithm when it uses the value iterative method to solve the migration strategy in the early stage. When 1650 < t < 3800 ns, the amount of computation task requests rises rapidly, and the migration cost of the two algorithms also increases rapidly. When t > 3800 ns, the amount of computation task request decrease and the rate of increase in migration costs begin to decrease.   14 Complexity After comparing the migration costs of the proposed EDTM algorithm and the MDP-SD algorithm, next, we compare the performance of the two algorithms from the average load percentage of the UAV groups. As shown in Figure 14, 0.9 means that the task queue of the UAV groups at this time accounts for 90% of the total length of the task queue. Besides, the percentage of the task queue length under the MDP-SD algorithm is higher than the proposed EDTM algorithm. is is because we considered the small storage space and computing power of the UAVs when designing the proposed EDTM algorithm. So that the proposed EDTM algorithm does not occupy too much UAV resources. Also, because the amount of computation task request conforms to the Poisson distribution, when 0 < t < 2800 ns, the average task queue percentage of the UAV groups will increase. And when t � 2800 ns, whether it is the proposed EDTM algorithm or the MDP-SD algorithm, the average task queue percentage of the UAV groups will reach the highest point. Until t > 2800 ns, the average task queue percentage of the UAV groups slowly decrease. Obviously, from the perspective of the entire process, the average task queue percentage of the UAV groups under the proposed EDTM algorithm is always lower than the MDP-SD algorithm. erefore, the proposed EDTM algorithm is more suitable for UAV-enabled MEC systems.
To sum up, we compare the performance of the algorithm from the following three aspects, including convergence time, energy consumption and maximum system load status. e experimental results are shown in Table 4.

Conclusion
In this paper, we formulated the joint optimization problem in UAV-enabled MEC system, which considers migration costs, total system energy consumption, and load balance. To address this problem, we then propose the EDTM algorithm and path elimination rules, the weight factors and the pheromone update strategy in the algorithm show the stability and robustness of the system. Finally, simulation experiments demonstrate the efficacy of the proposed EDTM algorithm. For future works, we plan to apply the algorithm in a real environment and test its performance.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.