# User-Edge Collaborative Resource Allocation and Offloading Strategy in Edge Computing

Authors: Zhenquan Qin; Xueyan Qiu; Jin Ye; Lei Wang
Journal: Wireless Communications and Mobile Computing
 (2020)

---

## Abstract

The foundation of urban computing and smart technology is edge computing. Edge computing provides a new solution for large-scale computing and saves more energy while bringing a small amount of latency compared to local computing on mobile devices. To investigate the relationship between the cost of computing tasks and the consumption of time and energy, we propose a computation offloading scheme that achieves lower execution costs by cooperatively allocating computing resources by mobile devices and the edge server. For the mixed-integer nonlinear optimization problem of computing resource allocation and offloading strategy, we segment the problem and propose an iterative optimization algorithm to find the approximate optimal solution. The numerical results of the simulation experiment show that the algorithm can obtain a lower total cost than the baseline algorithm in most cases.


---

## Body

## 1. Introduction

The rapid development of the Internet of Things (IoT) and mobile devices has facilitated the development of emerging applications such as machine learning [1] and face recognition [2]. Relying on these rapidly developing new IoT technologies and the Internet of Everything scenarios, the process of urban informatization is greatly accelerated, and smart cities have become a vision for development [3–5]. Smart cities can perform real-time analysis based on urban big data, provide new models of efficient and sustainable urban governance, and establish effective communication between people and cities. In recent years, the topic of smart cities has attracted widespread attention. With the introduction of various learning technologies, people hope to make cities smarter by collecting, storing, and processing big data.One problem is that most of the emerging IoT technologies, including various learning technologies, are computationally intensive. However, due to volume and heat considerations, sensor nodes or other mobile devices that collect big data for smart cities usually have limited processing power, battery power, and storage space, making it difficult to meet the needs of all computing tasks. Cloud computing provides a solution [6, 7]. Migrating computing tasks from the device to the cloud server eliminates the limitations of the device itself. However, the cloud server is remotely isolated from the device in terms of topology and geographical location, and multiple storage and forwarding, as well as long-distance communications, cause huge transmission and propagation delays [8]. Smart cities need to establish efficient communication with people, and high latency will reduce the user experience. And for applications with high real-time requirements, this high latency is intolerable, and even in extreme cases, high latency can endanger user safety, such as autonomous driving [9], automatic navigation boats [10], and health care [11].As an emerging distributed cloud architecture, edge computing provides a new solution for smart cities [12, 13]. Deploy servers near the demanders of the service, avoiding the high latency of a centralized cloud. At the same time, offloading all tasks to the edge server saves more energy compared to placing all tasks locally on the device. Moreover, edge computing can effectively reduce the pressure on the core network. For example, smart transportation is an important part of smart cities. The intelligent transportation system analyzes the videos and videos acquired by a large number of traffic cameras to generate highly efficient traffic strategies. Traditional video surveillance systems must upload all surveillance videos to the cloud before analyzed, which will increase the traffic load on the core network. If edge computing is used, you can analyze at the edge server and reduce network pressure and the energy consumption of the entire monitoring system [14], which gives new vitality to smart transportation.However, edge servers often have limited computing resources [15], considering the economic benefits and scalability of deployment. One reason is that edge servers are deployed in large numbers and close to users, and the economic benefits of deployment need to be considered. So a single edge server does not need and cannot have as many resources as a cloud center. Then, the edge server cannot fully process all tasks. If all tasks are transmitted to the edge server without any difference, it will result in low processing efficiency and long processing time for the task. So how to offload tasks based on demand is a question worth studying.The process of migrating computing tasks from a mobile device to an edge server or a cloud center is called offloading [16–18]. The development of an offloading strategy is a classic and important issue in the field of edge computing. Offloading tasks to the edge server will inevitably lead to higher latency than local execution while reducing power consumption. Therefore, mobile devices need to choose the appropriate offloading strategy to meet their needs, such as minimizing task execution time [19–21], minimizing power consumption [22, 23], balancing delays, and power consumption [24, 25].In many of the past work, resource allocation problems have been discussed. Most of them focus on solving the allocation of computing resources or the allocation of communication resources for edge servers [15, 22–24]. Some discussed the computational resource allocation and transmission power control of mobile devices [19, 25]. In fact, the resource allocation of mobile devices and edge servers will affect each other and work together to generate an offloading policy. Therefore, it is necessary to study the relationship between computing resource allocation and offloading decision generation.Based on the above, we summarize the motivation of the work as follows: (1) The offloading decision should be reasonable. The constraints of computing resources and energy need to be considered to achieve a better task assignment. (2) Delay and energy consumption are two important parameters of the task. The allocation of computing resources has an impact on latency and energy consumption. (3) A parameter should be developed based on the deadline to express the real-time requirements of the task. (4) In heterogeneous edge servers, the execution time of tasks is different from local execution. The task execution costs need to explicitly consider the heterogeneity of edge servers.In this paper, we proposed a collaborative computing resource allocation scheme and an offloading strategy for mobile devices and the edge server. Our contributions are as follows:(1)
We propose an integrated framework for computing resource allocation and computational task offloading in a mobile edge computing network(2)
We propose a computation offloading scheme that achieves lower execution costs by cooperatively allocating computing resources by mobile devices and the edge server(3)
Compared to the weighting factors of execution delay and energy consumption based on user preferences, we add the deadline to the definition of the weighting factor to reflect the real-time requirements of the task(4)
We segment the complex problem and propose Genetic-Algorithm-Based-Iterative (GABI) algorithm to obtain an approximate optimal solution(5)
The paper is organized as follows. In Section2, we review the related works. Section 3 introduces the system modeling and problem formulation. Section 4 gives the solution. The simulation results are given and discussed in Section 5. Section 6 concludes this paper


## 2. Related Works

For mobile edge computing, computing offloading is the key technology. A lot of work has been done on the computation offloading technology to achieve the purpose of reducing calculation delay [8, 19–21] or saving equipment energy [22, 23, 26]. In [8], Xiao and Krunz studied the trade-off between users’ QoE and fog node power efficiency in fog computing networks, focusing on users’ QoE measured by average service response time. The author proposed a novel cooperative strategy called offload forwarding, and further proposed a distributed optimization algorithm based on distributed alternating direction method of multipliers (ADMM) to maximize the user’s QoE. Rodrigues et al. in [19] considered computing and communication at the same time. To minimize service latency, the author controlled processing delay through virtual machine migration and improved transmission delay through transmission power control. In [20], Kao et al. proposed a complete polynomial-time approximation scheme (FPTAS) Hermes to solve the formulated NP-hard problem, thereby, minimizing application delay while meeting the specified resource utilization constraints. Jia et al. in [21] present an online task offloading algorithm that minimizes the completion time of the application on the mobile device. In addition to the line topology task graphs, the authors further considered the general topology task graphs. For concurrent tasks, the author used a load-balancing heuristic to increase the parallelism between mobile devices and the cloud. Some literature focuses on the energy consumption of mobile devices. In [22], You and Huang minimized the weighted sum of mobile energy consumption by solving the convex optimization problem under the constraint of calculating the waiting time. The author discussed both the infinite and limited edge cloud computing capabilities. For the latter, the author proposed a suboptimal resource allocation algorithm to reduce complexity. You et al. in [23] studied the resource allocation of multiuser mobile edge computing systems based on time division multiple access (TDMA) and orthogonal frequency division multiple access (OFDMA), and by solving the convex optimization problem and the mixed-integer problem, the weighted total mobile energy consumption under the constraint of computing the waiting time is minimized. In [26], Zhang et al. proposed an offloading scheme that optimizes energy with guaranteed delay. This scheme considers the link to the status of the fronthaul network and the backhaul network at the same time and uses an artificial fish swarm algorithm for global optimization.Time delay and energy are the main indicators to evaluate the performance of offloading calculation. It is meaningful to study the trade-off between them. The author in [15] designed the QoE maximization framework. QoE is a cost reduction achieved by offloading tasks to fog nodes or remote cloud servers, where the cost of performing tasks includes computing energy and computing latency. In [24], Zhang et al. proposed an online dynamic task allocation plan to study the trade-off between energy consumption and execution delay of the MEC system with energy harvesting function. An online dynamic Lyapunov-optimized offloading algorithm (ODLOO) is proposed, which could determine task allocation, reduce the execution delay by increasing the running frequency of the local CPU, and save energy by selecting a suitable data transmission channel. [25] proposed an energy-aware offloading scheme, which can jointly optimize the allocation of communication and computing resources with limited energy and sensitive delay. To calculate the mixed-integer nonlinear problem of shunting and resource allocation, Zhang et al. proposed an iterative search algorithm that combines internal penalty functions with DC programming to find the best solution. [27] studied the joint design of local execution and calculation offloading strategies in a multiuser MEC system. Mao et al. proposed an online algorithm based on Lyapunov optimization, which determines the CPU cycle frequency of local execution and the transmit power and bandwidth of the computation load distribution. The author used simulation experiments to verify that the proposed algorithm can balance the power consumption of mobile devices and the quality of computing experience. However, with the exception of [25], most of the work that studied the trade-off between energy consumption and delay has not clearly defined the weighting factors that weigh the two. Most of them described the weighting factors as a task attribute that changes according to user needs or verified the effectiveness of the proposed algorithm by adjusting the weighting factors. In [25], the author defined the weighting factor as the current residual energy ratio of mobile devices, which is an innovative idea and also gives some inspiration to this article.The deadline is an important attribute for computing tasks [23, 24, 27–30]. The deadline of the task represents the delay tolerance of the task. In the work focusing on task scheduling, the deadline is used as an evaluation index. As in [31], the author formulated a task scheduling and offloading strategy so that more tasks can meet the deadline requirements, and the number of tasks that have exceeded the deadline, that is, the error rate, is used as the evaluation index. In most of the tasks that focus on calculating the offload, the deadline of the task is only a constraint, which does not give full play to the attribute of deadline and cannot express the real-time requirements of the task. In this paper, inspired by the literature [25], the deadline is introduced into the definition of the weighting factor.Limited resources are a characteristic of edge computing systems, which prompted us to study the problem of resource allocation. Allocable resources include the communication power, channel bandwidth, and computing ability of user equipment and edge servers. Considering the allocation of multiple resources at the same time complicates the problem. The authors in [15] studied computing resource allocation, formulated a computational offloading game to model competition among IoT users, and effectively allocated the limited processing power of fog nodes. In [22], You and Huang formulated the optimal resource allocation problem as a convex optimization problem, considering the situation of unlimited and limited cloud computing capabilities. The authors in [23] further considered the OFDMA system, whose optimal resource allocation is formulated as a mixed-integer problem. Zhang et al. considered the allocation of communication and computing resources in [25], including channel selection, user equipment computing resource allocation, and communication power allocation. In [32], Yu et al. considered the allocation of radio and computing resources. They proposed a near-optimal algorithm for scheduling subcarriers and CPU time slots, respectively, and further proposed a joint scheduling algorithm to manage subcarriers and CPUs coordinately, thereby, achieving the goal of reducing energy consumption. In [33], Sun et al. studied the joint problem of network economics and resource allocation in MEC and considered the incentive framework that can maximize system efficiency in the Industrial Internet of Things (IIoT). They proposed two types of dual auction schemes with dynamic pricing, namely, a breakeven-based double auction (BDA) and a more efficient dynamic pricing based double auction (DPDA) to determine the matching pair between the IIoT MD and the edge server, and Pricing mechanism to achieve high system efficiency under local constraints.


## 3. System Model and Problem Formulation

### 3.1. System Model

We consider a network system withN mobile devices and an edge server as shown in Figure 1. The channel bandwidth between the mobile device uii∈1,2,⋯,N and the edge server is w. The propagation delay of edge server and mobile device communication is negligible because the distance between the two is often only a single hop or a limited number of hops.Figure 1
Network system model.In this network, the mobile deviceui with limited energy Eimax will generate M tasks that need to be completed in each time slot. The jth (j∈1,2,⋯,M) task generated by device ui in time slot t (t∈1,2,⋯,T) is represented as τi,j,t=di,j,t,ci,j,tU,ci,j,tE,ti,j,tdeadline,si,j,t, where di,j,t represents the amount of data for the task, ci,j,tU denotes the number of CPU cycles required for the task if it is executed locally, ci,j,tE means the number of CPU cycles required for the task to execute on the heterogeneous edge server, and ti,j,tdeadline is the tolerable execution time. si,j,t is the offloading strategies of task τi,j,t. si,j,t=1 when the task is performed locally, if not, si,j,t=0.In each time slot, after the mobile device generates the tasks and allocates the local computing resources, the information of the task and the local computing resource allocation scheme are transmitted to the edge server. The edge server calculates the offloading policy and returns it to the mobile device. The task is executed locally or offloaded according to the offloading policy.


### 3.2. Local Computing

We definefi,j,tU as the CPU frequency of the mobile device ui, which represents the local computation ability of the device. Note that this value could be changed to get a better offloading strategy. Then, the computation execution time ti,j,texecute¯U for the locally performed task τi,j,t is
(1)ti,j,texecute¯U=ci,j,tUfi,j,tU.We ignore the queue delay of local execution. Then, the time consumptionti,j,tU of task τi,j,t local execution is
(2)ti,j,tU=ti,j,texecute¯U.The energy consumption can be expressed as(3)ei,j,tU=κfi,j,tU2ci,j,tU,where κ is the energy efficiency coefficient. It is related to the chip architecture, and we assume that this value is constant.


### 3.3. Edge Computing

When the mobile deviceui decides to offload the task τi,j,t to the edge server, it needs to obtain the data uplink transmission rate
(4)ri,j,t=wlog21+pihi,j,tσ+∑k∈N,k≠i1−sk,j,tpkhk,j,t,where w is the channel bindwidth and pi is the transmission power of the mobile device ui. hi and σ are channel gain and noise power. The summation term in the denominator represents interference between channels. Therefore, the transmission time of the uplink is
(5)ti,j,ttrans=di,j,tri,j,t.The time taskτi,j,t consumes to execute on a heterogeneous edge server is
(6)ti,j,texecute¯E=ci,j,tEfi,tE,where fi,tE is the computing resource allocated by the edge server to the task from ui in the time slot t. As with communication resources, computing resources are also allocated periodically.So, we get the total time consumption of edge computing(7)ti,j,tE=ti,j,ttrans+ti,j,texecute¯E.We ignore the return time because many computationally intensive applications have a much smaller amount of data than the input data.Energy consumption is(8)ei,j,tE=piti,j,ttrans.In general, the time consumption and energy consumption constitute the execution cost of the task. The cost of locally executed taskGi,j,tU and offloaded task Gi,j,tE are expressed as the weighted sum of time and energy consumption
(9)Gi,j,tU=αi,j,tti,j,tU+1−αi,j,tβei,j,tU,(10)Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE.β is a normalization factor used to eliminate the unit difference between time and energy consumption, which can be equal to the ratio of average time to average energy consumption.The weight factorαi,j,t (αi,j,t∈0,1) is the task’s trade-off between time and energy consumption. By changing the weighting factor, the user can achieve faster execution or more energy-efficient execution. In this paper, we define the weighting factor by the time consumption of the task
(11)αi,j,t=ti,j,texecute¯Uti,j,tdeadline.The task is generated on the mobile device, and the deadline is established with the execution time on the mobile device, so it is reasonable to perform the weighting factor with the local execution time.After adding the offloading decisionsi,j,t, the generalization of the cost of task τi,j,t is expressed as:
(12)Gi,j,t=si,j,tGi,j,tU+1−si,j,tGi,j,tE.


### 3.4. Problem Formulation

From what has been discussed above, we formulate problems as follows:(13)mins,fU,fE∑i=1N∑t=1T∑j=1Msi,j,tGi,j,tU+1−si,j,tGi,j,tE,(14)s.t.fimin≤fi,j,tU≤fimax,∀i,j,t,(15)0≤∑i=1Nfi,tE≤FE,∀t,(16)si,j,tti,j,tU+1−si,j,tti,j,tE≤ti,j,tdeadline,∀i,j,t,(17)∑t=1T∑j=1Msi,j,tei,j,tU+1−si,j,tei,j,tE≤Eimax,∀i,j,t,(18)si,j,t∈0,1,∀i,j,t.Constraint (14) indicates that the computing resource allocated to a local task cannot exceed the maximum CPU frequency, and constraint (15) indicates that the computing resources allocated by an edge server in each time slot cannot exceed its maximum capacity. Constraint (17) ensures that the mobile device is able to complete computing tasks before all energy is consumed. Constraint (18) indicates that the offloading decision is a 0-1 variable.The objective function is nonlinear and contains the multiplication of variables, so this is a complex mixed-integer nonlinear optimization problem with binary variables. This kind of problem is difficult to solve, so we will divide the problem in the following paper, and iteratively use genetic algorithm method to find the approximate solution and carry out simulation experiments to prove the validity of the solution.


## 3.1. System Model

We consider a network system withN mobile devices and an edge server as shown in Figure 1. The channel bandwidth between the mobile device uii∈1,2,⋯,N and the edge server is w. The propagation delay of edge server and mobile device communication is negligible because the distance between the two is often only a single hop or a limited number of hops.Figure 1
Network system model.In this network, the mobile deviceui with limited energy Eimax will generate M tasks that need to be completed in each time slot. The jth (j∈1,2,⋯,M) task generated by device ui in time slot t (t∈1,2,⋯,T) is represented as τi,j,t=di,j,t,ci,j,tU,ci,j,tE,ti,j,tdeadline,si,j,t, where di,j,t represents the amount of data for the task, ci,j,tU denotes the number of CPU cycles required for the task if it is executed locally, ci,j,tE means the number of CPU cycles required for the task to execute on the heterogeneous edge server, and ti,j,tdeadline is the tolerable execution time. si,j,t is the offloading strategies of task τi,j,t. si,j,t=1 when the task is performed locally, if not, si,j,t=0.In each time slot, after the mobile device generates the tasks and allocates the local computing resources, the information of the task and the local computing resource allocation scheme are transmitted to the edge server. The edge server calculates the offloading policy and returns it to the mobile device. The task is executed locally or offloaded according to the offloading policy.


## 3.2. Local Computing

We definefi,j,tU as the CPU frequency of the mobile device ui, which represents the local computation ability of the device. Note that this value could be changed to get a better offloading strategy. Then, the computation execution time ti,j,texecute¯U for the locally performed task τi,j,t is
(1)ti,j,texecute¯U=ci,j,tUfi,j,tU.We ignore the queue delay of local execution. Then, the time consumptionti,j,tU of task τi,j,t local execution is
(2)ti,j,tU=ti,j,texecute¯U.The energy consumption can be expressed as(3)ei,j,tU=κfi,j,tU2ci,j,tU,where κ is the energy efficiency coefficient. It is related to the chip architecture, and we assume that this value is constant.


## 3.3. Edge Computing

When the mobile deviceui decides to offload the task τi,j,t to the edge server, it needs to obtain the data uplink transmission rate
(4)ri,j,t=wlog21+pihi,j,tσ+∑k∈N,k≠i1−sk,j,tpkhk,j,t,where w is the channel bindwidth and pi is the transmission power of the mobile device ui. hi and σ are channel gain and noise power. The summation term in the denominator represents interference between channels. Therefore, the transmission time of the uplink is
(5)ti,j,ttrans=di,j,tri,j,t.The time taskτi,j,t consumes to execute on a heterogeneous edge server is
(6)ti,j,texecute¯E=ci,j,tEfi,tE,where fi,tE is the computing resource allocated by the edge server to the task from ui in the time slot t. As with communication resources, computing resources are also allocated periodically.So, we get the total time consumption of edge computing(7)ti,j,tE=ti,j,ttrans+ti,j,texecute¯E.We ignore the return time because many computationally intensive applications have a much smaller amount of data than the input data.Energy consumption is(8)ei,j,tE=piti,j,ttrans.In general, the time consumption and energy consumption constitute the execution cost of the task. The cost of locally executed taskGi,j,tU and offloaded task Gi,j,tE are expressed as the weighted sum of time and energy consumption
(9)Gi,j,tU=αi,j,tti,j,tU+1−αi,j,tβei,j,tU,(10)Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE.β is a normalization factor used to eliminate the unit difference between time and energy consumption, which can be equal to the ratio of average time to average energy consumption.The weight factorαi,j,t (αi,j,t∈0,1) is the task’s trade-off between time and energy consumption. By changing the weighting factor, the user can achieve faster execution or more energy-efficient execution. In this paper, we define the weighting factor by the time consumption of the task
(11)αi,j,t=ti,j,texecute¯Uti,j,tdeadline.The task is generated on the mobile device, and the deadline is established with the execution time on the mobile device, so it is reasonable to perform the weighting factor with the local execution time.After adding the offloading decisionsi,j,t, the generalization of the cost of task τi,j,t is expressed as:
(12)Gi,j,t=si,j,tGi,j,tU+1−si,j,tGi,j,tE.


## 3.4. Problem Formulation

From what has been discussed above, we formulate problems as follows:(13)mins,fU,fE∑i=1N∑t=1T∑j=1Msi,j,tGi,j,tU+1−si,j,tGi,j,tE,(14)s.t.fimin≤fi,j,tU≤fimax,∀i,j,t,(15)0≤∑i=1Nfi,tE≤FE,∀t,(16)si,j,tti,j,tU+1−si,j,tti,j,tE≤ti,j,tdeadline,∀i,j,t,(17)∑t=1T∑j=1Msi,j,tei,j,tU+1−si,j,tei,j,tE≤Eimax,∀i,j,t,(18)si,j,t∈0,1,∀i,j,t.Constraint (14) indicates that the computing resource allocated to a local task cannot exceed the maximum CPU frequency, and constraint (15) indicates that the computing resources allocated by an edge server in each time slot cannot exceed its maximum capacity. Constraint (17) ensures that the mobile device is able to complete computing tasks before all energy is consumed. Constraint (18) indicates that the offloading decision is a 0-1 variable.The objective function is nonlinear and contains the multiplication of variables, so this is a complex mixed-integer nonlinear optimization problem with binary variables. This kind of problem is difficult to solve, so we will divide the problem in the following paper, and iteratively use genetic algorithm method to find the approximate solution and carry out simulation experiments to prove the validity of the solution.


## 4. Solution

### 4.1. Local Execution Cost

The costGi,j,tU of the local execution calculation task is split, and the specific expressions of the parameter weight factor, time consumption, and energy consumption are brought in.
(19)Gi,j,tU=αi,j,tti,j,tU+1−αi,j,tβei,j,tU=ci,j,tU2fi,j,tU2ti,j,tdeadline+1−ci,j,tUfi,j,tUti,j,tdeadlineβκci,j,tUfi,j,tU2.After observation, we found that the value ofGi,j,tU depends only on fi,j,tU, so Gi,j,tU is a function of fi,j,tU.Lemma 1.
The functionGi,j,tUfi,j,tU is unimodal.Lemma1 can be easily proved by the derivative and monotonicity of the function. Simplify the formula (19) and it looks like y=ax2+bx+c1/x2, where a>0, b<0, and c>0. The second derivative is d2y/dx2=6c1/x4+2a. In the positive interval, the second derivative is always positive, then, the first derivative is monotonically increasing. The first derivative dy/dx=2ax−2c1/x3+b is continuous when x>0, and as x tends to zero and positive infinity, the derivative tends to be negative infinity and positive infinity. From the interval value theorem, there is a point that the first derivative is zero, and the point is a minimum point.From Lemma1, we get the CPU frequency fi,j,t∗ that minimizes the local execution cost, which is the ideal best, but we still need to consider the constraints (14), (16), and (17).In constraint (14), we have to consider the upper and lower bounds of fi,j,tU. And in constraint (16),
(20)ti,j,tU=ci,j,tUfi,j,tU≤ti,j,tdeadline,fi,j,tU≥ci,j,tUti,j,tdeadline.For a single task, we can override the constraint (17) to make it look simpler
(21)κfi,j,tU2ci,j,tU≤Ei,j,tmax,fi,j,tU≤Ei,j,tmaxκci,j,tU,where Ei,j,tmax is a real-time value indicating the remaining battery power of the device while performing the task.The CPU frequency of the mobile devicefi,j,tU fluctuates within fimin,fimax. Then, we get the new bound of fi,j,tU(22)fi,j,tub=minfimax,Ei,j,tmaxκci,j,tU,fi,j,tlb=maxfimin,ci,j,tUti,j,tdeadline,and the best value to get the lowest Gi,j,tU(23)fi,j,tU=fi,j,t∗,fi,j,tlb≤fi,j,t∗≤fi,j,t,ubfi,j,tlb,fi,j,t∗<fi,j,tlb,fi,j,tub,fi,j,tub<fi,j,t∗.


### 4.2. Edge Execution Cost

We found that the problem of task execution cost on edge servers could not be considered separately like that on mobile devices.(24)Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE,=αi,j,tti,j,ttrans+ci,j,tEfi,tE+1−αi,j,tβei,j,tE.For locally executed computing tasks, different tasks are independent in terms of computing resource allocation. But it is different at the edge, where all tasks share the computing resources of one edge server. The task execution cost and the computing resources allocated by the edge server are inversely related. Therefore, it is meaningless to study the minimum cost of a computing task separately, and the resource allocation for all tasks needs to be considered.We can consider the minimum cost of all tasks in a time slot. The edge server allocates computing resources for newly arrived tasks in each time slot, and tasks in different time slots are independent of each other.(25)minfE∑i=1N∑j=1Mαi,j,tti,j,ttrans+ci,j,tEfi,tE+1−αi,j,tβei,j,t,E(26)s.t.0≤fi,tE≤FE,∀i,(27)0≤∑i=1Nfi,tE≤FE.Note that we have not defined time constraints and energy constraints here. We will mention them in the next section and use them as conditions for developing an offload strategy.Problem (25) is a nonlinear optimization problem. Our goal is to obtain a global optimal solution. Here, we use the genetic algorithm to get an approximate optimal solution. Then, we can get the minimum edge computing cost Gi,j,tE according to fi,tE, the calculation result of question (25).


### 4.3. Offloading Decision and Resource Allocation

The initial allocation of computing resources is for all tasks in this time slot. That is, before the initial offload policy, the default offload policy is to offload all tasks,s=0. An obvious problem is that due to deadline constraints and energy constraints, offloading all tasks cannot be taken as the final offloading decision, and the allocation of computing resources with the default offloading condition is not reasonable. Therefore, in this section, we propose a Genetic-Algorithms-Based-Iterative (GABI) algorithm to obtain reasonable offloading decisions and resource allocation methods through iterative calculations.The first step is to filter based on constraints. We denote the new offloading strategys′ and assign initial values to it s′=s. In the previous section, we mentioned that time constraint is one of the conditions for filtering. After obtaining the calculation resource allocation result fi,tE, we can get the total time of edge execution ti,j,tE. If ti,j,tE>ti,j,tdeadline, then s′i,j,t=1.For energy constraints, the energy consumption of the edge calculation is independent of the calculation resource allocation, so the energy constraint is not added in the problem (25). Moreover, we have obtained local computational resource allocations that satisfy energy constraints in the previous section, while the energy consumption of edge computations is generally less than local computation. So s′i,j,t=1 if ei,j,tE>ei,j,tU. We use the matrix sT to record the current value of s′, sT=s′. Then, the process of filtering can be expressed as Algorithm 1.Algorithm 1: Filtering Based on Constraints
Input: task set τ , offloading strategy sOutput: new decision s′1:s′⟵s2:for every task τi,j,tdo3: Getti,j,tE using fi,tE from (25). ti,j,tE=ti,j,ttrans+ti,j,texecute¯E=di,j,t/ri,j,t+ci,j,tE/fi,tE.4: Getei,j,tE. ei,j,tE=piti,j,ttrans=pidi,j,t/ri,j,t.5:ifti,j,tE>ti,j,tdeadlineorei,j,tE>ei,j,tUthen6:s′i,j,t=1.7:end if8:end forsT will be used later as one of the conditions for stopping the iteration. The other condition is G1, which is the total task execution cost calculated by bringing sT and fE into (12).The second step is to filter tasks based on the execution costs. After the computing resource allocation of the edge server is obtained, the execution cost of the task on the edge server can be calculated and further compared with the task’s local execution cost. If a task is found to cost more to execute on the edge server, we think it is better to perform it locally on the user device. The second filtering is based on the first filtering, so we define a new offloading decision matrixs′′ and initialize it, s′′=s′. This step is shown in Algorithm 2.Algorithm 2: Filtering Based on Cost
Input: task set τ , offloading strategy s′Output: new decision s′′1:s′′⟵s′2:for every task τi,j,tdo3: GetGi,j,tE. Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE=ci,j,tU/fi,j,tUti,j,tdeadlineti,j,tE+1−ci,j,tU/fi,j,tUti,j,tdeadlineβei,j,tE.4: GetGi,j,tU. Gi,j,tU=ci,j,tU2/fi,j,tU2ti,j,tdeadline+1−ci,j,tU/fi,j,tUti,j,tdeadlineβκci,j,tUfi,j,tU2.5:ifGi,j,tE⩾Gi,j,tUthen6:s′′i,j,t=1.7:end if8:end forAfter filtering, we get a new offloading strategys′′. If s′′=s, then, we think that a stable offloading strategy has been obtained, and the GABI algorithm can return directly. So we get the final offloading strategy s and the computing resource allocation method fE.But if the offloading strategys′′ is different from the default offloading strategy s, the obtained computing resource allocation strategy cannot minimize the edge execution cost because some allocated resources are not used. Therefore, computing resources need to be reallocated.Assign the value ofs′′ to s. Once again, the optimization problem of minimizing the edge execution cost is solved. This time, s is added to remove the locally executed task:
(28)minfE∑i=1N∑j=1M1−si,j,tGi,j,tE,(29)s.t.0≤fi,tE≤FE,∀i,(30)0≤∑i=1Nfi,tE≤FE.After the new resource allocation schemefE is obtained, we get s′ using Algorithm 1, and get G2 using s′ and fE′ by (12). At this time, compare G2 and G1. If G2>G1, then stop iteration, and the final offloading strategy is determined to be sT. Assign sT to s, then get the final computing resource allocation method fE through (28), and the GABI algorithm returns.IfG2⩽G1, the iteration continues: recording s′ with sT, filtering based on cost, judging the iteration termination conditions, iterating again, and so on.The computing resource allocation and the offloading decision is given in Algorithm3. Algorithm 3 shows the whole process of the GABI algorithm.Algorithm 3: Genetic-Algorithms-Based-Iterative(GABI) algorithm
Input: task set τOutput: offloading decision s, computing resource allocation scheme fE1:for allt∈Tdo2: Initialization:s⟵0, s′⟵s, sT⟵s, s′′⟵s.3: GetG1 according to (24)(12).4:repeat5:s⟵s′′.6:  CalculatefE using genetic algorithms through (28).7:  Gets′ by calling Algorithm 1.8:  GetG2 using s′ through (24)(9)(10)(12).9:ifG2>G1then10:s⟵sT.11:   CalculatefE using genetic algorithms through (28).12:returns, fE.13:end if14:sT⟵s.15: CalculateG1 using sT through (24)(9)(10)(12).16: Gets′′ by calling Algorithm 2.17:untils′′=s18:returns, fE.19:end for


## 4.1. Local Execution Cost

The costGi,j,tU of the local execution calculation task is split, and the specific expressions of the parameter weight factor, time consumption, and energy consumption are brought in.
(19)Gi,j,tU=αi,j,tti,j,tU+1−αi,j,tβei,j,tU=ci,j,tU2fi,j,tU2ti,j,tdeadline+1−ci,j,tUfi,j,tUti,j,tdeadlineβκci,j,tUfi,j,tU2.After observation, we found that the value ofGi,j,tU depends only on fi,j,tU, so Gi,j,tU is a function of fi,j,tU.Lemma 1.
The functionGi,j,tUfi,j,tU is unimodal.Lemma1 can be easily proved by the derivative and monotonicity of the function. Simplify the formula (19) and it looks like y=ax2+bx+c1/x2, where a>0, b<0, and c>0. The second derivative is d2y/dx2=6c1/x4+2a. In the positive interval, the second derivative is always positive, then, the first derivative is monotonically increasing. The first derivative dy/dx=2ax−2c1/x3+b is continuous when x>0, and as x tends to zero and positive infinity, the derivative tends to be negative infinity and positive infinity. From the interval value theorem, there is a point that the first derivative is zero, and the point is a minimum point.From Lemma1, we get the CPU frequency fi,j,t∗ that minimizes the local execution cost, which is the ideal best, but we still need to consider the constraints (14), (16), and (17).In constraint (14), we have to consider the upper and lower bounds of fi,j,tU. And in constraint (16),
(20)ti,j,tU=ci,j,tUfi,j,tU≤ti,j,tdeadline,fi,j,tU≥ci,j,tUti,j,tdeadline.For a single task, we can override the constraint (17) to make it look simpler
(21)κfi,j,tU2ci,j,tU≤Ei,j,tmax,fi,j,tU≤Ei,j,tmaxκci,j,tU,where Ei,j,tmax is a real-time value indicating the remaining battery power of the device while performing the task.The CPU frequency of the mobile devicefi,j,tU fluctuates within fimin,fimax. Then, we get the new bound of fi,j,tU(22)fi,j,tub=minfimax,Ei,j,tmaxκci,j,tU,fi,j,tlb=maxfimin,ci,j,tUti,j,tdeadline,and the best value to get the lowest Gi,j,tU(23)fi,j,tU=fi,j,t∗,fi,j,tlb≤fi,j,t∗≤fi,j,t,ubfi,j,tlb,fi,j,t∗<fi,j,tlb,fi,j,tub,fi,j,tub<fi,j,t∗.


## 4.2. Edge Execution Cost

We found that the problem of task execution cost on edge servers could not be considered separately like that on mobile devices.(24)Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE,=αi,j,tti,j,ttrans+ci,j,tEfi,tE+1−αi,j,tβei,j,tE.For locally executed computing tasks, different tasks are independent in terms of computing resource allocation. But it is different at the edge, where all tasks share the computing resources of one edge server. The task execution cost and the computing resources allocated by the edge server are inversely related. Therefore, it is meaningless to study the minimum cost of a computing task separately, and the resource allocation for all tasks needs to be considered.We can consider the minimum cost of all tasks in a time slot. The edge server allocates computing resources for newly arrived tasks in each time slot, and tasks in different time slots are independent of each other.(25)minfE∑i=1N∑j=1Mαi,j,tti,j,ttrans+ci,j,tEfi,tE+1−αi,j,tβei,j,t,E(26)s.t.0≤fi,tE≤FE,∀i,(27)0≤∑i=1Nfi,tE≤FE.Note that we have not defined time constraints and energy constraints here. We will mention them in the next section and use them as conditions for developing an offload strategy.Problem (25) is a nonlinear optimization problem. Our goal is to obtain a global optimal solution. Here, we use the genetic algorithm to get an approximate optimal solution. Then, we can get the minimum edge computing cost Gi,j,tE according to fi,tE, the calculation result of question (25).


## 4.3. Offloading Decision and Resource Allocation

The initial allocation of computing resources is for all tasks in this time slot. That is, before the initial offload policy, the default offload policy is to offload all tasks,s=0. An obvious problem is that due to deadline constraints and energy constraints, offloading all tasks cannot be taken as the final offloading decision, and the allocation of computing resources with the default offloading condition is not reasonable. Therefore, in this section, we propose a Genetic-Algorithms-Based-Iterative (GABI) algorithm to obtain reasonable offloading decisions and resource allocation methods through iterative calculations.The first step is to filter based on constraints. We denote the new offloading strategys′ and assign initial values to it s′=s. In the previous section, we mentioned that time constraint is one of the conditions for filtering. After obtaining the calculation resource allocation result fi,tE, we can get the total time of edge execution ti,j,tE. If ti,j,tE>ti,j,tdeadline, then s′i,j,t=1.For energy constraints, the energy consumption of the edge calculation is independent of the calculation resource allocation, so the energy constraint is not added in the problem (25). Moreover, we have obtained local computational resource allocations that satisfy energy constraints in the previous section, while the energy consumption of edge computations is generally less than local computation. So s′i,j,t=1 if ei,j,tE>ei,j,tU. We use the matrix sT to record the current value of s′, sT=s′. Then, the process of filtering can be expressed as Algorithm 1.Algorithm 1: Filtering Based on Constraints
Input: task set τ , offloading strategy sOutput: new decision s′1:s′⟵s2:for every task τi,j,tdo3: Getti,j,tE using fi,tE from (25). ti,j,tE=ti,j,ttrans+ti,j,texecute¯E=di,j,t/ri,j,t+ci,j,tE/fi,tE.4: Getei,j,tE. ei,j,tE=piti,j,ttrans=pidi,j,t/ri,j,t.5:ifti,j,tE>ti,j,tdeadlineorei,j,tE>ei,j,tUthen6:s′i,j,t=1.7:end if8:end forsT will be used later as one of the conditions for stopping the iteration. The other condition is G1, which is the total task execution cost calculated by bringing sT and fE into (12).The second step is to filter tasks based on the execution costs. After the computing resource allocation of the edge server is obtained, the execution cost of the task on the edge server can be calculated and further compared with the task’s local execution cost. If a task is found to cost more to execute on the edge server, we think it is better to perform it locally on the user device. The second filtering is based on the first filtering, so we define a new offloading decision matrixs′′ and initialize it, s′′=s′. This step is shown in Algorithm 2.Algorithm 2: Filtering Based on Cost
Input: task set τ , offloading strategy s′Output: new decision s′′1:s′′⟵s′2:for every task τi,j,tdo3: GetGi,j,tE. Gi,j,tE=αi,j,tti,j,tE+1−αi,j,tβei,j,tE=ci,j,tU/fi,j,tUti,j,tdeadlineti,j,tE+1−ci,j,tU/fi,j,tUti,j,tdeadlineβei,j,tE.4: GetGi,j,tU. Gi,j,tU=ci,j,tU2/fi,j,tU2ti,j,tdeadline+1−ci,j,tU/fi,j,tUti,j,tdeadlineβκci,j,tUfi,j,tU2.5:ifGi,j,tE⩾Gi,j,tUthen6:s′′i,j,t=1.7:end if8:end forAfter filtering, we get a new offloading strategys′′. If s′′=s, then, we think that a stable offloading strategy has been obtained, and the GABI algorithm can return directly. So we get the final offloading strategy s and the computing resource allocation method fE.But if the offloading strategys′′ is different from the default offloading strategy s, the obtained computing resource allocation strategy cannot minimize the edge execution cost because some allocated resources are not used. Therefore, computing resources need to be reallocated.Assign the value ofs′′ to s. Once again, the optimization problem of minimizing the edge execution cost is solved. This time, s is added to remove the locally executed task:
(28)minfE∑i=1N∑j=1M1−si,j,tGi,j,tE,(29)s.t.0≤fi,tE≤FE,∀i,(30)0≤∑i=1Nfi,tE≤FE.After the new resource allocation schemefE is obtained, we get s′ using Algorithm 1, and get G2 using s′ and fE′ by (12). At this time, compare G2 and G1. If G2>G1, then stop iteration, and the final offloading strategy is determined to be sT. Assign sT to s, then get the final computing resource allocation method fE through (28), and the GABI algorithm returns.IfG2⩽G1, the iteration continues: recording s′ with sT, filtering based on cost, judging the iteration termination conditions, iterating again, and so on.The computing resource allocation and the offloading decision is given in Algorithm3. Algorithm 3 shows the whole process of the GABI algorithm.Algorithm 3: Genetic-Algorithms-Based-Iterative(GABI) algorithm
Input: task set τOutput: offloading decision s, computing resource allocation scheme fE1:for allt∈Tdo2: Initialization:s⟵0, s′⟵s, sT⟵s, s′′⟵s.3: GetG1 according to (24)(12).4:repeat5:s⟵s′′.6:  CalculatefE using genetic algorithms through (28).7:  Gets′ by calling Algorithm 1.8:  GetG2 using s′ through (24)(9)(10)(12).9:ifG2>G1then10:s⟵sT.11:   CalculatefE using genetic algorithms through (28).12:returns, fE.13:end if14:sT⟵s.15: CalculateG1 using sT through (24)(9)(10)(12).16: Gets′′ by calling Algorithm 2.17:untils′′=s18:returns, fE.19:end for


## 5. Simulation Result

In this section, we design simulation experiments to verify the effectiveness of our proposed algorithm. We compare the performance of our proposed method with the baseline scheme, the probabilistic offloading scheme, and the energy-aware offloading scheme. We consider an edge computing network with one edge server andN mobile devices, where N ranges from 3 to 9. We set the maximum computing power of the edge server to 4 GHz, and the computing power of mobile devices ranges from 0.2 GHz to 1 GHz. The initial CPU frequency of the mobile device is randomly generated between 0.5 and 1 GHz, which is used to calculate the normalization factor β and the deadline of tasks. Mobile device transmission power is 20 dBm.The simulation process consists of 10 time slots in which the mobile device generates 5 computational tasks. The amount of task data is randomly generated between [300, 1200] KB. The local computing resources required to complete the task are randomly generated between [0.1, 1] GHz. Considering the heterogeneity of devices, the required computing resources performed on the edge server is [0.2, 1.2] times than that of local execution. The task deadline is randomly generated in [0.5, 5] s, and the value is guaranteed to be greater than the local task execution time calculated by the initial CPU frequency of the mobile device.The total bandwidth of the network is 2 MHz, which is evenly distributed by all mobile devices. The path loss model between the mobile device and the edge server is considered as the lognormal distribution.In Figure2, we consider the impact of offloading strategy on total cost, time, and energy consumption under different mobile device quantities. “All local” and “All MEC” in Figure 2 represent all tasks executed locally and all offloading schemes. As shown, compared with two baselines, our solution maintains lower cost, medium execution time, and power consumption in most cases. When there are fewer mobile devices, the edge server allocates more resources to each user, so the task execution time can be even lower than the local execution, and the total task cost is lower. As the number of users increases, the edge execution time becomes longer, so the total cost of edge execution approaches or even exceeds local execution, even though the energy consumed by edge execution is still much lower than local execution. The energy consumption of local execution tasks is several times or even ten times that of edge execution, so even if the time consumption is slightly lower, there is still a higher total cost.Figure 2
The impact of offloading strategy on total cost, time, and energy consumption under different mobile device quantities.In Figure3, we compare the performance of our scheme and the probabilistic offloading scheme. The idea of the probabilistic offloading scheme is that the computing server has a certain probability of being offloaded by the edge server. Whether to offload is determined by probability, without comparing the cost of tasks performed locally and edge. We compared the cases with unloading probabilities of 0.2, 0.5, and 0.8. The experimental results show that our proposed scheme can always achieve the lowest task execution cost. When the number of users is small, the computing resources of the edge server are less competitive, and the total cost of the solution with a high probability of offloading is lower. This is consistent with the “ALL MEC” baseline solution in Figure2 when the number of users is low. As the number of users increases, the low-probability offloading solution gradually achieves lower costs. In terms of time and energy consumption, our solution is also at a relatively low level.Figure 3
The impact of offloading strategy on total cost, time, and energy consumption under different mobile device quantities.In Figure4, we compare the impact of the definition and treatment of weighting factors in this article and in the literature [25]. The document [25] defines the weighting factor α=α∗rE, where rE is the ratio of the remaining energy of the current user equipment to the maximum battery capacity. In order to reflect the effect of the method in [25], we have selected a special piece of data. In this simulation, the remaining power of the user equipment is small. As a result, at the beginning of the third time slot, the weighting factor of the task calculated by the [25] method decreases rapidly, as shown by the polyline on the way with the legend “Rest Energy Defines α”. In order to save energy, most tasks choose to offload, even if the cost of edge execution is much higher than local execution. The method in this paper does not focus on energy perception, so in most cases, the strategy of keeping the lowest cost is selected. When the local execution cost of sending some tasks is low, choose not to offload.Figure 4
In multiple consecutive time slots, compare the impact of the proposed scheme and the energy-aware offloading scheme on the total cost, delay, and energy consumption.In Figure5, we consider the impact of local computing resource allocation on total cost, time, and energy consumption under different user quantities. “fUmax”, “fUmin”, and “fUmid”, respectively, represent local computing resource allocation with fimax, fimin, and fimax+fimin/2. “fUoriginal” stands for the CPU frequency preset by the user equipment. Our approach to finding the best local resource allocation scheme is feasible and effective. Compared to the for baselines, our proposed method always finds the lowest cost. Higher CPU frequencies result in faster execution speeds, but at the same time result in higher energy consumption, as evidenced by the figure. Our algorithm achieves less energy consumption than “fUmax” and gets lower execution time than “fUmin”, fully weighing the impact of time and energy on mission cost. It is noted that the average allocation “fUmid” can approach the optimal solution in many cases. The reason is that in most cases, the value range of the user CPU is not extreme. The calculated local optimal resource allocation plan is a value that can be obtained in most cases and is very close to fimax+fimin/2. Although the preset CPU frequency of the user equipment can also achieve better results, it is unstable.Figure 5
The impact of local computing resource allocation on total cost, time, and energy consumption under different mobile device quantities.In Figure6, we compare the impact of edge server computing resource allocation schemes on time consumption and total cost under different user numbers. “Equal” and “Random”, respectively, indicate that the edge server evenly allocates and randomly allocates computing resources to users. The edge server resource allocation scheme does not affect the energy consumption of edge execution, but it indirectly affects the offload decision and total cost. As shown in the figure, it is obvious that the random allocation scheme is costly and unstable, and the method of the average allocation is close to the optimal solution in many cases, but the proposed method can achieve the lowest cost and time consumption.Figure 6
The impact of edge computing resource allocation on total cost and time consumption under different mobile device quantities.


## 6. Conclusions

In this paper, we investigate the resource allocation and offloading decisions of mobile devices and edge servers in edge computing. To minimize the total cost of task execution, we define weighting factors based on deadlines to consider the impact of time and energy consumption on costs. We considered an edge computing network consisting of edge servers and users and built mathematical models. For difficult MINLP problems, we split the problem and iteratively optimize it. The result is that an approximate optimal solution is not a globally optimal solution. In future work, we will consider designing heuristic algorithms to reduce complexity and improve performance.



---

*Source: 8867157-2020-06-12.xml*