Joint Trajectory-Task-Cache Optimization in UAV-Enabled Mobile Edge Networks for Cyber-Physical System

This paper studies an unmanned aerial vehicle (UAV)-enabled mobile edge network for Cyber-Physical System (CPS), where UAV with fixed-wing or rotary-wing is dispatched to provide communication and mobile edge computing (MEC) services to ground terminals (GTs). To minimize the energy consumption so as to extend the endurance of the UAV, we intend to jointly optimize its 3D trajectory and the task-cache strategies among GTs to save the energies spent on flight propulsion and GT tasks. Such joint trajectory-task-cache problem is difficult to be optimally solved, as it is non-convex and involves multiple constraints. To tackle this problem, we reformulate the optimizing of task offloading and cache into two tractable linear program (LP) problems, and the optimizing of UAV trajectory into three convex Quadratically Constrained Quadratically Program (QCQP) problems on horizontal trajectory, vertical trajectory and flight time of the UAV respectively. Then a block coordinate descent algorithm is proposed to iteratively solve the formed sub-problems through a successive convex optimization (SCO) process. A high-quality sub-optimal solution to the joint problem then will be obtained, after the algorithm converging to a prescribed accuracy. The numerical results show the proposed solution significantly outperforms the baseline solution.


I. INTRODUCTION
Cyber-physical systems (CPS) are physical and engineered systems whose operations are monitored, coordinated, controlled and integrated by a computing and communication core. And it is expected that computing and communication capabilities will soon be embedded in all types of objects and structures in the physical environment [1]. However, it is challenging to implement computing and networking technologies to provide an adequate foundation for CPS [2]. In practice, CPS needs reliable wireless network coverage in areas without or with insufficient terrestrial The associate editor coordinating the review of this manuscript and approving it for publication was Wei Yu .
infrastructures to support the data transmissions. To effectively provide network coverage to CPS, it is beneficial to implement wireless communication using unmanned aerial vehicle (UAV) [3]. Compared to conventional wireless networks, such UAV-enabled wireless communication brings new advantages, such as on-demand and swift deployment, high flexibility with fully-controllable mobility in three dimensional (3D) airspace, and high probability of line-ofsight (LoS) radio frequency links with the Ground Terminals (GTs) [4], [5]. In addition, the UAV-enabled wireless communications deployed for CPS are also in need of efficient techniques to improve the computation capacity and prolong the lifetime of the terminals [6]. This is because CPS usually constitutes a large number of terminals that are typically constrained by their computation capacity and power. This thus motivates our current work to study UAV-enabled wireless communication working with mobile edge computing (MEC) technique.
MEC is a state-of-art technology that allows wireless terminals to offload the tasks to the edge server instead of locally executing the tasks by the terminals [7]- [10]. MEC thus can greatly improve the computation capacity and energyefficient performance of those terminals in CPSs that are covered by UAV-enabled wireless network [7] or 4G/5G mobile network [11], [12]. Compared to conventional MEC, the UAV-enabled MEC will better execute the tasks of the GTs by leveraging its high mobility [13]- [17]. Specifically, the UAV that works as the MEC server, can sequentially visit the GTs and receive offloaded tasks only when it moves sufficiently close to each GT. This can ensure high probability of LoS connectivity between UAV and GT and save the transmission energy of all GTs. Moreover, based on the fact that many GTs will request the same popular tasks at different times, UAV can have cache deployed to save tasks in its storage area to avoid redundant data transmissions between itself and the GT. Cache thus can help the UAV-enabled MEC save its energy spent on task offloading [18], [19].
In general, UAV-enabled MEC is particularly useful for the emergency situations, e.g. earthquake, typhoon, where the GTs in CPS having no reach of wireless connection nor power supply. UAV-enabled MEC is also suitable for CPS applications, e.g. intelligent farming, to provide communication and computation services to IoT devices [13]. There has been work studied UAV working with MEC already. In [20], it proposed a UAV-based IoT platform for a surveillance use case, where UAV-enabled MEC is discussed to help task offloading for IoT devices. In [7], the authors discussed the optimal bit allocation in UAV-enabled mobile edge network, considering energy cost. In [21], task offloading was considered in the scenario where UAV works as the cellular user to help execute and offload GT tasks to the base station. It is expected that, as the upcoming of 5G and smart city era, more and more CPS applications with UAV-enabled MEC will appear in short time.
However, one critical issue of UAV-enabled MEC lies in the limited on-board energy of UAVs [22], [23], which needs to be efficiently used to enhance the communication and computation performances and prolong the UAV's mission time. The difficulty is that the energy-efficient wireless communication and computation design with UAV is significantly different from that in conventional terrestrial MEC systems. Therefore, the works on dynamic task offloading [24], [25], resource allocation [26], [27] and cache [28]- [30] for conventional MEC system, can not be directly applied to UAV to support its energy-efficient performance. An initial attempt for designing energy-efficient UAV communication was made in [23], [31]- [35], where UAV trajectory was jointly optimized with the strategies, like resource allocation, user association, power control. In [31], [32], it clarified that the propulsion energy takes most part of the overall energy consumption of the UAV, and the authors modelled and optimized the propulsion energy of both the fixed-wing and rotary-wing UAVs. The authors in [33]- [35] revealed an interesting trade-off between UAV's energy consumption and that of the GTs it communicating with, base on which the energy-efficient UAV-GT communication was realized via optimized solutions. Furthermore, the work [36], [37] firstly studied cache technique to save the energy consumption and enforce the communication work of the UAV. But the cache deployed in [36], [37] is only for the data dissemination while leaving the more general scenario in CPS unaddressed. The power constraint of UAV also can be released in the more general cases with multiple cooperative UAVs and/or in the presence of ground BSs [21], [38]. However, the more general case is highly non-trivial, and involves additional issues such as UAV collision avoidance, spectrum sharing between UAVs and BSs, and inter-UAV communications.
For the UAV-enabled MEC, the energy issue will escalate due to the extra energy consumed by the UAV to support MEC computations. Recently, the authors of [14]- [17] have studied resource allocation, trajectory design, user association, and dynamic task offloading to improve the energy-efficient performance of UAV-enabled MEC. But those works haven't solved the energy issue optimally yet. In this paper, to better release the energy issue, we aim to minimize the energy consumptions of the UAV-enabled MEC by solving the joint trajectory-task-cache problem. The proposed solution also intends to satisfy the requirement of each GT on task latency. In specific, a solution to the problem has to: 1) determine whether a GT task should be offloaded to the UAV or not, considering the task requirement and status of the UAV; 2) make decision on whether a UAV has to cache a GT task or not, referring its limited storage capacity and the status of the requesting tasks; 3) design 3D UAV trajectory to control UAV fly energy-efficiently and establish effective UAV-GT links to support satisfying task offloading. According to the study, those three jobs are highly correlated and mutually infect each other. Therefore, the joint problem is complicated and with highly coupling non-convex constraints.
To deal with this multiple-constrained non-convex problem, we involve a set of equality constraints and auxiliary variables, and then transform the problem into a tractable formulation. We first reformulate the task offloading and cache as linear program (LP) problems given the 3D trajectory of the UAV pre-decided. Next, we transform the trajectory optimization into three convex Quadratically Constrained Quadratically Program (QCQP) problems on horizontal trajectory, vertical trajectory and flight time of the UAV respectively. Finally, we propose an iterative block coordinate descent algorithm to solve the formed sub-problems through a successive convex optimization (SCO) process [39], [40]. A high-quality sub-optimal solution to the joint problem then will be obtained after the proposed algorithm converging to a prescribed accuracy. The numerical results show the proposed solution significantly outperform the baseline solution. In summary, the primary contributions of this paper are: 1) It is innovative work to improve the energy-efficient performance of the UAV-enabled MEC by solving the joint trajectory-task-cache problem. We study how the performance of the UAV-enabled MEC being affected by the design of task offloading, cache and 3D UAV trajectory. Then we conclude that the joint problem is multiple constrained and non-convex, which has not been studied yet. 2) It is a pioneer work to optimize the 3D trajectory of the UAV that works as MEC server. Currently, most of the existing works only optimize the UAV trajectory in 2D spaces while leaving UAV latitude fixed in the vertical dimension, which is unrealistic. And some of the recent works optimize the 3D UAV trajectory to enlarge the network throughput. But those works didn't take the energy constraint of the UAV nor MEC into considerations. The remainder of this paper is organized as follows. In section II, we describe the system model and formulate the problem. In Section III, we present the solution to the optimization problem. In section IV, simulation results and analysis are presented. In Section V, we give conclusions and future work.

II. SYSTEM MODEL AND PROBLEM FORMULATION A. SYSTEM MODEL 1) ASSUMPTIONS ON UAV AND GTS
This paper considers a typic scenario of UAV-enabled MEC, which is shown in Fig.1. We discretize the UAV path into M line segments, which are represented by M + 1 waypoints in 3D coordinates: {h m , q m } M +1 m=1 . And for the m-th waypoint, h m is the height and q m = {x m , y m } is the horizontal coordinate of the UAV. UAV's height is constrained to h max ≥ h m ≥ h min , where h min and h max are the minimum and maximum height of the UAV respectively. Further, one has {h 1 , q 1 } = {h M +1 , q M +1 } to indicate the UAV would fly back to its initial location, which is the common situation in reality. To facilitate the analysis, assume the task offloading will not take place during the stages of UAV taking off and landing, and the UAV will only work as the MEC server when it is airborne. This assumption is based on the fact that the taking off and landing stages of the UAV only take small portion of the whole mission time. In addition, we impose the following constraints: where h max and v max are appropriately chosen values so that within each line segment, the UAV is assumed to fly with constant horizontal and vertical velocities and the distance between the UAV and each GT is approximately unchanged.
With such path discretization, the UAV trajectory can be  Assume there are K = {1, 2, . . . , K } GTs on the ground, and the horizontal coordinate of each GT is known in advance as w k = [x k , y k ] T ∈ R 2×1 , k ∈ K. In CPS, GTs are normally in low mobility, thus we assume the GTs in Fig.1 will stay in static during the UAV mission time. Assume the k-th GT has averagely expected amount of computing task U k = (F k , D k , T k ), where F k describes the total number of the CPU cycles to be computed; D k denotes the amount of input data to be transferred through the uplink; T k denotes the task's completion deadline [11], [13]. We ignore the data transmissions in the downlink from UAV to GT, as it will not cause any energy consumption of the GT. Also the data transmission in downlink is trivial and will not consume significant amount of energy of the UAV. We assume the expected amount of each GT task can be efficiently found numerically or predicted by e.g. Machine Learning [36], during the UAV's mission completion time.

2) COMMUNICATION MODEL
In UAV-enabled mobile edge network, we consider the effect of the environment on the occurrence of LoS, and an air-toground channel model in urban environments [32], [41]. The LoS connectivity probability between the UAV and the k-th GT in path line m is given as where a and b are constant values that depend on the environment. In this setting, the altitude and antenna heights of the GT are neglected. The LoS connectivity probability between the UAV and the k-th GT in path line m depends on the altitude of the UAV h m and the horizontal distance between the UAV and the GT denoted as d km = q m − w k 2 . In other words, the pathloss of the air-to-ground link depends on the altitude in the vertical dimension, and the distance in the horizontal dimension. Then the pathloss expression becomes where A and C are constants such that A = η LoS − η NLos and C = 20log 4πf c c + η NLos ; f c is the carrier frequency (Hz); c is the speed of light (m/s); η LoS and η NLoS (in dB) are respectively the losses corresponding to the LoS and non-LoS connections depending on the environment. Following the pathloss model between UAV and GT, the average achievable rate of k-th GT's uplink, denoted by r k in bits/second (bps), can be expressed as where p k is the uplink transmission power of GT k; B denotes the allocated bandwidth; N 0 denotes the power spectral density of the Additive White Gaussian Noise (AWGN).

3) UAV PROPULSION ENERGY MODEL
For a fixed-wing UAV, the propulsion energy is expressed as where c 1 and c 2 are the two constant parameters related to the UAV's weight, wing area, and air density [32]; c 3 is the constant parameter related to the UAV's descending/ascending. For a rotary-wing UAV, the propulsion energy is modelled as where P 0 and P 1 are two constants defined, representing the blade profile power and induced power in hovering status, respectively; P 2 is the constant on descending/ascending power. U tip denotes the tip speed of the rotor blade, v 0 is known as the mean rotor induced velocity in hover, d 0 and s are the fuselage drag ratio and rotor solidity, respectively, and ρ and G denote the air density and rotor disc area, respectively [31]. In general, the propulsion energy of UAV depends on the horizontal and vertical velocities of the UAV in each path segment. For the purpose of exposition and more tractable analysis, we ignore the additional/fewer energy consumption caused by UAV acceleration/deceleration, which is reasonable for scenarios when the UAV maneuvering only takes a small portion of the total operation time. In addition, the propulsion energy on UAV ascending/descending adopts a simple way to vertical velocity v v m . An advanced propulsion energy model on UAV ascending/descending will be exploited in future work.

4) COMPUTATION MODEL
According to task offloading, if task U k is offloaded to the UAV, it will allocate f o k CPU cycles to the task. And if task U k is executed locally, we assume f l k denotes the CPU cycles allocated to the task by the k-th GT. The latency of U k is then denoted as where 0 ≤ a k ≤ 1 is the offloading indicator from k-th GT to the UAV; a k = 1 denotes that GT k decides to offload all the task to the UAV, while a k = 0 indicates that GT k decides to conduct the task all by itself. If 0 < a k < 1, the k-th GT will offload portion of its task to the UAV. Assume the UAV has limited computation capacity C o , then one has K k=1 a k f o k ≤ C o . In (6), it shows that if task U k is offloaded to the UAV, the task latency is then composed by the time spent by the UAV on computing the task and the time spent on the data transmission in the uplink. In contrast, if the task is not offloaded but executed locally, the task latency only involves the time spent by the GT on executing the task locally. In addition, we assume that the GT can locally finish the task before the deadline, i.e. F k f l k < T k .
To execute task U k , the energy consumption of the UAV and GT are respectively formulated as where are the computation related energy consumption of the UAV and GT respectively; ϕ is the effective switched capacitance and ϑ ≥ 1 is the positive constant as mentioned in [11], [13]. In (8), it denotes that if task U k is offloaded, GT k only consumes its energy on transmitting the data through uplink. On the other hand, if task U k is not offloaded, GT k only consumes its energy on locally executing the task. And in (7), it demonstrates that the UAV will consumes its energy on executing the task U k , only if the task being offloaded. VOLUME 7, 2019

5) CACHE MODEL
The process of task caching is as follows. GT first requests the task that needs to be offloaded. If the task been cached in the UAV, GT then does not need to transfer data to the UAV. When the UAV finishes task processing, it only has to transmit the result to the GT [18], [19]. With cache deployed, the latency and the energy consumption of U k can be formulated as where 0 ≤ x k ≤ 1 is the caching decision variable; x k = 1 denotes that GT k is fully cached in the UAV, while x k = 0 denotes the task is not cached at all. If 0 ≤ x k ≤ 1, it means portion of the task being cached in the UAV. One has α > 0 as the tradeoff between the energy consumptions of GT and UAV on serving task U k . Assume the cache storage in UAV is limited, and set to be K k=1 x k D k ≤ C c . In (9), it denotes that if task U k is fully cached in the UAV, the task latency is then only composed by the time spent by the UAV on computing the task. And in (10), it shows that if task U k is cached, the energy consumption only involves the one spent by the UAV on executing the task. In contrast, if task is not cached, the latency and energy consumption of task U k will be the same as the ones formulated in (6) (7) and (8).
To this end, we can find that cache can effectively save the latency and energy caused by the data transmission during task offloading.

B. PROBLEM FORMULATION
, the optimization problem is formulated as h min ≤ h m ≤ h max , ∀m; (11.11) where E uav = E f-uav for fixed-wing, and E uav = E r-uav for rotary-wing UAV; β > 0 is the tradeoff between the energy consumptions on UAV propulsion and serving GT tasks; (11.1) denotes the constraints of the variables a k and x k on task offloading and cache, each of which is decimal between 0 and 1. In reality, if the GT tasks are atom and cannot be divided, the optimizations of the variables a k and x k in (11.1) become 0-1 dynamic program problems. In this case, we can further employ the method in [33] to convert a k and x k to be decimal between 0 and 1. (11.2) and (11.3) are the constraints on the limited computation and storage capacities of the UAV. (11.4) is the constraint on the service requirement of each task, i.e. task's latency being lower than its completion deadline; (11.5) is the constraint on UAV mission completion time; (11.6) ∼ (11.11) are the constraints on the trajectory of the rotary-wing or fixed-wing UAV in horizontal and vertical dimensions respectively.
In (11), it denotes that cache is highly co-related to the task offloading, which makes the design of these two strategies a complicated dynamic programming problem. The task-cache strategies are also effected by the design of UAV trajectory that determines the UAV-GT links. On the other hand, it is a non-convex problem to optimize UAV trajectory in terms of its locations in horizontal and vertical dimensions. This is because the locations of UAV in both of the two dimensions are jointly constrained with respect to the LoS probabilities as defined in (1). Also the velocities of the UAV in both dimensions should neither be too fast nor too slow to save the propulsion energies defined in (4) and (5). In addition, even in an implicit manner, the energy consumption on UAV propulsion E uav is in a complicated non-linear form that is closely related to different styles of UAVs. To this end, it is difficult to solve P in its current form.

III. PROPOSED SOLUTION
To solve problem P, we intend to optimize the task offloading and cache jointly with the design of UAV trajectory. The process is formulated as a block coordinate descent algorithm. In each iteration of the algorithm, we first optimize the task offloading and cache strategies with pre-defined UAV trajectory Q, H, T. Then we optimize the UAV trajectory given A, X. This is similar to the SCO solution proposed in [42], [43], which can decrease the complexity of the problem.
Based on this SCO method, in sub-section A, we optimize the task offloading and cache variables given the UAV trajectory pre-defined. In this sub-section, the task-cache problem is simplified as two LP problems and get directly solved. In sub-section B, we reform the UAV trajectory problem into three convex QCQP problems and get them solved. Next, based on the works in sub-sections A and B, we design an overall algorithm in sub-section C to find the sub-optimal solution to the whole trajectory-task-cache problem via a SCO procedure. In the end, we analyze the complexity and convergency of the overall algorithm in sub-section D.

A. OPTIMIZE TASK OFFLOADING AND CACHE GIVEN UAV TRAJECTORY
Given pre-defined UAV trajectory, the problem on optimizing task offloading and cache can be simplified as This problem however is not jointly convex with respect to A and X, and cannot be directly solved. The non-convexity is due to the existence of the second order term of a k x k in (11.4). To linearize the second order term, we give an theorem, Theorem 1: With the UAV trajectory determined, the data rate of the uplink from UAV to each GT k will be known as R k . Then, in order to ensure the GT task U k finished before its completion deadline, the task offloading variable a k and caching variable x k of task U k have to be jointly constrained to where Proof: see Appendix.
According to the theorem, if the UAV-GT link has a low data rate R k causing the UAV not able to finish the whole task before its completion deadline, i.e. D k Under this situation, if the task not cached, i.e. x k = 0, GT k only can offload portion of its task to the UAV to avoid intolerable task latency, which is denoted as a k ≤ H k < 1. On the contrary, if the UAV-GT link has data rate R k higher enough to have D k R k + F k f o k ≤ T k , it will lead to H k = 1. In this case, the GT can possibly offload all of its task to the UAV and get it executed in time even the task not cached in the UAV, which is denoted as a k ≤ H k = 1. This follows the real situation that high qualify UAV-GT links can better support the task offloading. Moreover, considering task cache, the theorem indicates that one should make (1 − x k ) as small as possible, i.e, x k as high as possible, to ensure a k (1 − x k ) ≤ H k . This reflects the real situation that the UAV should cache as much the offloaded GT tasks as possible in its storage area to short the task latency.
Based on the theorem, if we bring (13) into (12), the original problem can be simplified as whereÊ c k is converted from E c k in (10). Specifically, given R k being the known data rate of the uplink from the (10). Then, if we replace the term a k ( Due to the theorem, it is obvious thatÊ c k is the upper bound of E c k , i.e. E c k ≤Ê c k . Therefore, if we find the optimal A to ensureÊ c k minimized, such obtained A will be also the optimal solution to the problem in (12). We can find that the second order term of a k x k disappears inÊ c k , and (14) therefore is a LP problem. Then A can be directly obtained by solving the LP problem. To do so, we follow the monotonicity ofÊ c k and take its deviation, then the optimized A can be obtained as: a k = min{ After A obtained, to let the UAV cache as much GT task as possible, the cache deployment X can be obtained by solving the LP problem as, max X K k=1 x k a k D k s.t. (11.1); (11.2); (13); (15) where the LP problem can be solved by the CVX tool [44].

B. OPTIMIZE UAV TRAJECTORY GIVEN TASK OFFLOADING AND CACHE
With obtained A and X, the UAV's trajectory is to be optimized to minimize the propulsion energy, while guaranteeing the GT-UAV uplinks to have satisfied data rate. Then the problem on optimizing the 3D trajectory of the UAV can be simplified as min Q, H, T E uav s.t.(11.5) ∼ (11.11); r k ≥ R k , ∀k; (16) where , which is obtained following (9) and (11.4). The problem in (16) is nonconvex and cannot be solved directly. We intend to release the non-convexities and divide the problem into three subproblems on horizontal trajectory Q, vertical trajectory H and flight time T respectively. The obtained convex sub-problems then can be solved by convex optimization technique under through a successive convex optimization (SCO) procedure.

1) OPTIMIZE UAV HORIZONTAL TRAJECTORY
Given H and T, the problem on optimizing UAV horizontal trajectory Q can be formulated as s.t. (11.6), r k ≥ R k , ∀k; (17.1) where v * h is the horizontal velocity in optimal that leads to the minimum of the propulsion power in horizontal dimension.

VOLUME 7, 2019
For fixed-wing UAV, by solving the convex expression of E f-uav in (4), a closed-form expression of v * h can be obtained as: min max( 4 c 2 3c 1 , V h min ), V h max . For rotary-wing, v * h is difficult to obtain due to the complicated expression of E r-uav in (5), however it can be efficiently found numerically [31]. In (17), θ is the slack variable to allow the UAV to adopt a trajectory with horizontal velocity v h m between (1 − θ )v * h and (1 + θ)v * h . This enables the UAV to approach the optimized velocity v * h to have sub-minimized propulsion energy in horizontal dimension, while supporting the UAV having requested data rate linked to GTs. However, (17) is still a non-convex problem due to the non-convexities in (17.1) and (17.2).
To release the non-convexity in (17.1), we can reform the left side of (17.1) to where κ km = p k BN 0 10 − C 10 . Because p los km ≥ 0, and A < 0, i.e. η LoS < η NLos , (18) can be transformed to Then (19) can be simply denoted as  (20) is non-linear to ν km . It motivates us to replace this non-linearity by more tractable convex function derived from the Taylor expansion at a given local point [39]. Specifically, with given local point Further, we intend to release the non-convexity in (17.2). To do so, given local points {q l m+1 , q l m } as the horizontal trajectory to be updated, we define the following inequality by applying first-order Taylor expansion of the left side of (17.2) as Then constraint (17.2) can be converted as To this end, the problem in (17)  r bl k is obtained following the identical procedure as the one obtaining r bl k in (22), but taking h m , ∀k as the variables. (26) is to optimize the UAV to approach SLF, i.e. h m+1 − h m → 0, ∀m to minimize the propulsion energy in vertical dimension, while ensuring acceptable data rate of UAV-GT uplinks. Obviously (26) is a QCQP problem and can be solved directly by CVX tool.

3) OPTIMIZE UAV FLIGHT TIME
Given Q and H, the problem on optimzing UAV flight time T in each path line can be formulated as  (27.2). Obviously, (27) is to optimize the flight time t m of the UAV in each path line to let the UAV approach the optimal horizontal velocity v * h to minimize propulsion energy in horizontal dimension, while ensures each GT task finished before its completion deadline. Because (27.1) constrains the flight time to be short, thus (27) does guarantee the propulsion energy of the UAV to be minimized. In addition, it can be noticed in (4) and (5), that we simply assume the propulsion energy in vertical dimension only correlates to the distance on UAV descending/ascending, the flight time optimization in (27) thus does not need to take the vertical velocity of the UAV into consideration.

C. OVERALL ALGORITHM DESIGN
Using the results obtained in the previous two subsections, the overall block coordinate descend algorithm to solve P can be designed as Algorithm 1. At step 1, the UAV trajectory is firstly initialized to fly a circular trajectory through the method proposed in [33]. The UAV trajectory can also be initialized to travel to each places of interest with the shortest distance, which can be found by solving the traveling salesman problem (TSP) [45]. Based on the initialized trajectory, the UAV trajectory can either lead to coverage fairness (circular trajectory) or geographically close to the GTs (TSP trajectory). At step 1, it also assumes the UAV stays in each of the initialized path line segment in a fixed duration {t 0 } M m=1 and flies with height {h 0 m } M +1 m=1 . After initialization, the algorithm mainly runs a loop with finite iterations from step 2 to step 8. In each iteration, it sequentially solves the problems in (25), (26) and (27) to find sub-optimal UAV trajectory. At step 3, it optimizes the task offloading and cache by solving the problem in (14) and (15). Then, under through such block coordinate descend algorithm, it gradually allows the UAV serving GTs with lower energy consumption. After the algorithm converging to a prescribed accuracy within finite iterations, a desirable sub-optimal solution of problem P will eventually be found.

D. COMPLEXITY AND CONVERGENCE OF THE OVERALL ALGORITHM
Generally, in each iteration of Algorithm 1, the UAV horizontal trajectory, vertical trajectory, and flight time are sequentially optimized using the convex solver based on the interior-point method, and thus each of their individual complexities can be resented by O((KM ) 3.5 log(1/ )), given the solution accuracy of > 0 [46]. In addition, at step 3, the time complexity on optimizing task offloading and cache variables A, X can be denoted as O(K ) and O((K ) 3.5 log(1/ )) respectively. Then accounting for the block coordinate descendant iterations of Algorithm 1 with the complexity in the order of Algorithm 1 Solve the Trajectory-Task-Cache Problem 1 Initialize UAV trajectory as: A 0 ,X 0 ,Q 0 ,H 0 ,T 0 , i = 0; 2 repeat 3 Obtain A i+1 ,X i+1 by soving (14) Obtain Q i+1 by solving (25), given H i , Obtain H i+1 by solving (26), given Q i+1 , Obtain T i+1 by solving (27), given Q i+1 , log(1/ ), the total computation complexity of Algorithm 1 is O(KM ) 3.5 log 2 (1/ )).
Afterward, we concern the convergence of Algorithm 1. Let E(A i , X i , Q i , H i , T i ) denote the object value of P in the i-th iteration of Algorithm 1. Then, in the (i + 1)-th iteration of Algorithm 1, one has where (a), (c), (e) and (g) hold, if problems in (14), (15), (25), (26) and (27) are sequentially solved. We can find that (b) and (d) hold, because we obtain Q i+1 and H i+1 by taking Q i and H i as the local points of the first-order Taylor expansions in (25) and (26). Further, (f) holds because we obtain T i+1 by taking T i as the benchmark local point in (27). Thus, it is validated that the object value of P is non-increasing in Algorithm 1, and the Algorithm can converge to a locally optimal solution of problem P.

IV. SIMULATION
In this section, the proposed solution is validated through simulation using Matlab with CVX tool. The simulation considers GT distributions in densified, medium, and sparse scenarios, which is to validate the adaptation of the proposed solution. As discussed in previous sections, we assume the rotary-wing/fixed-wing UAV will be initialized to have circular trajectory and TSP trajectory, and the stages of UAV taking off and landing will not be considered during the trajectory design. We set the system parameters as listed in table 1.   We compare the proposed solution to a baseline solution with respect to the energy consumptions, task latency, and data transmission, to validate the benefit of our proposed solution. The baseline solution in practice employs a greedy approach to find the trajectory-task-cache result, which does not consider energy-efficiency of the UAV. Instead, the baseline solution aims to control GTs to maximally offload and cache tasks to the UAV, and has UAV trajectory closer to GTs to facilitate the task offloading. As a result, the baseline solution intends to benefit the GTs in a maximum extend while sacrifice the UAV endurance. Through this comparison, we thus can validate the benefit of our proposed solution on energy-efficiency.
In rest part of this section, we will demonstrate different UAV trajectories led by the two compared solutions in Fig.2 and Fig.3. and the task latencies, data transmissions, energy consumptions led by the solutions in Fig.4 and Fig.5. Afterwards, the task-cache strategies led by the two solutions will be denoted in Fig.6 and Fig.7, which are correlated to each designed UAV trajectories. Then we will give a conclusion according to the numerical results in the end.
In Fig.2 and Fig.3, the UAV trajectory in 3D and 2D spaces led by different solutions are demonstrated, where the UAV in fixed-wing or rotary-wing is initialized to fly a circular trajectory and a TSP trajectory respectively. As shown in Fig.2 and Fig.3, the baseline solution (BL) controls the rotary-wing UAV flying geographically close to GTs to get better links to GTs. In contrast, the proposed optimization solution (OP) controls the rotary-wing UAV to adopt trajectories flying neither too close to GTs nor too away from GTs. Therefore, with the proposed solution, the UAV can better balance its energy consumption and services to work with energy efficiency. In Fig.2 and Fig.3, the trajectories of the fixed-wing UAV led by the baseline solution are not demonstrated, due to the limited space of this paper. However, it will be the same result as the case of rotary-wing UAV. In addition, Fig.2 and Fig.3 show that the fixed-wing UAV adopts a trajectory with longer distance compared to the rotary-wing UAV. This is because the fixed-wing UAV cannot hover statically and requests a minimum velocity to stay aloft. Also this is because the upper bound of the horizontal velocity (34 m/s) of fixedwing UAV is higher than the rotary-wing UAV (20 m/s), leading to the fixed-wing UAV possibly adopting higher flying speed and longer distances compared to the rotary-wing UAV. On the other hand, in vertical dimension, Fig.2 and Fig.3 show that the UAV normally descends from its original height to approach to GTs for better links. Compared to the baseline solution, the optimization solution normally controls the UAV to descend less distance, thus helps save the energy consumption of the UAV in the vertical dimension. Also the proposed solution controls the UAV to descend/ascend in a smoother way than the baseline solution that causes UAV to descend/ascend dramatically.
To validate the effect of different solutions, the data transmissions and latencies of each GT task are compared in Fig.4. Also, the service and propulsion related energy consumptions of different solutions are shown in Fig.5. These numerical results correspond to the UAV trajectories in Fig.2 and Fig.3. According to the results shown in Cumulative Distribution Function (CDF) form in Fig.4 and Fig.5, the baseline solution causes significant energy consumption, and leads to higher amount of data transmissions via uplinks. However, the baseline solution leads to higher latencies of GT tasks in contrast to the proposed solution. This is because the baseline solution greedily offloads tasks to the UAV, which causes high latency during data transmissions and the heavy load of the UAV. The proposed solution instead consumes much less energy on service and UAV propulsion, and supports each task with lower latency. Therefore, we validate that the proposed solution works energy efficiently.
In addition, it can be found in Fig.4, the UAV flying a TSP based trajectory can support higher amount of data transmissions than the circle trajectory, as the UAV in TSP based trajectory will fly closer to the GTs compared to the circular trajectory. Therefore, the UAV in TSP based trajectory supports lower task latency as compared to the circular trajectory. Moreover, in Fig.5, the UAV almost consumes the same level of energy on services while in fixed-wing or rotary-wing style, and it is quite obvious that the TSP trajectory will cause less service related energy consumption in medium GT scenario, due to the TSP trajectory can better supports the UAV-GT links. Considering propulsion energy, the fixedwing UAV will consume more propulsion energy compared to the rotary-wing UAV. Also, the UAV in TSP based trajectory will consume more propulsion energy compared to the circular trajectory, as the TSP based trajectory involves longer flight distance.
To validate the task offloading and cache strategies, Fig.6 shows the results. As demonstrated, the baseline solution adopts a greedy way, which causes more task offloaded to the UAV in contrast to the proposed solution. Thus, because the baseline solution forces the UAV to take more responsibility for the GTs and involves more data transmissions, the task latencies and energy consumptions led by the baseline solution therefore will be both higher than the proposed solution. Also, it can be found that the GTs will offload very similar amount of tasks to the fixed-wing and rotary-wing UAVs by the proposed solution. This is because the offloading  strategies adopted by the proposed solution are not sensitive to the trajectories and styles of the UAV. Instead, the strategies are to minimize the computing and data transmission related energy, thus they are more sensitive to GTs' energy status. Moreover, it is shown that the proposed solution more efficiently caches GT tasks in the UAV to save redundant data transmission in contrast to the baseline solution. This is because the baseline solution controls more tasks offloaded to the UAV and causes congestion. Also the proposed solution controls the GT tasks cached to the UAV in similar level of amount with respect to different UAV trajectories and styles.
In conclusion, we validate that the proposed solution outperforms the baseline solution, and can support energy-efficient performance of the UAV-enabled mobile edge networks.

V. CONCLUSION
This paper tries to optimize UAV trajectory jointly with the task offloading and cache to realize energy-efficient performance of the UAV-enabled mobile edge network. The joint problem considers the energy model and flight constraints of the different fixed-wing and rotary-wing UAVs in 3D spaces. The problem is multiple constrained and nonconvex, and difficult to be solved optimally. In this paper, we obtain the sub-optimal solution of the joint problem through a block coordinate descend algorithm by leveraging successive convex optimization technique. We validate the proposed solution through simulation and compare it to the baseline solution, considering fixed-wing/rotary-wing UAV working in sparse, medium and densified GT scenarios. According to the numerical results, the proposed solution can intensively save the energy consumptions of the UAV on propulsion and services, which ensuring the GT tasks finished before the completion deadline. With such energy-efficient performance achieved, the UAV-enabled MEC thus can have its power constraint released, thus can better support CPS applications. In future, we intend to extend the energy model of fixed-wing/rotary-wing UAV to denote how the velocity affecting the propulsion energy of UAV in vertical dimension. Then we try to explore high quality solution to lead to energyefficient performance of the UAV-enabled MEC, based on the extended energy model. In addition, we intend to consider the system with multiple UAVs, and solve its energy consumption related problems using deep reinforcement learning technique.

APPENDIX PROVE THEOREM IN (13)
Given a UAV trajectory, assume the data rate of the uplink from k-th GT to the UAV is R k . Then according to (9) and (11.4), one has r k = as the requested data rate of the UAV-GT k link. Then r k is constrained to r k ≤ R k so as to guarantee GT task U k executed before its completion deadline. Then one has (29) where the inequality is due to the fact that the UAV will execute each offloaded task quicker than the task being conducted by GT locally, i.e.
can be converted as (29) can be converted as 1 ≥ Then the theorem is proofed.