{'fraction_non_alphanumeric': 0.0313933832407631, 'fraction_numerical': 0.01057715527650326, 'mean_word_length': 4.719889502762431, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Time and resource constrained offloading with multi-task in a mobile edge computing node

Received Aug 4, 2019 Revised Dec 21, 2019 Accepted Jan 11, 2020 In recent years, the importance of the mobile edge computing (MEC) paradigm along with the 5G, the Internet of Things (IoT) and virtualization of network functions is well noticed. Besides, the implementation of computation-intensive applications at the mobile device level is limited by battery capacity, processing capabalities and execution time. To increase the batteries life and improve the quality of experience for computationally intensive and latency-sensitive applications, offloading some parts of these applications to the MEC is proposed. This paper presents a solution for a hard decision problem that jointly optimizes the processing time and computing resources in a mobile edge-computing node. Hence, we consider a mobile device with an offloadable list of heavy tasks and we jointly optimize the offloading decisions and the allocation of IT resources to reduce the latency of tasks’ processing. Thus, we developped a heuristic solution based on the simulated annealing algorithm, which can improve the offloading rate and reduce the total task latency while meeting short decision time. We performed a series of experiments to show its efficiency. Finally, the obtained results in terms of full-time treatrement are very encouraging. In addition, our solution makes offloading decisions within acceptable and achievable deadlines.


INTRODUCTION
Smart Mobile devices are changing day by day in the marketplace. These devices are compact and small, thing that makes convenient to use. There are currently billions of connected objects in the world (IoT) [1]. Mobile devices typically have limited resources, such as limited battery power and local CPU capacity, and may therefore suffer from an unsatisfactory computing experience. Mobile edge computing is emerging as a promising remedy. By offloading computing tasks to physically close MEC servers, the quality of the computing experience, such as device power consumption and turnaround time, could be greatly improved [2,3]. As a result, the execution time of these tasks can be effectively reduced by offloading heavy tasks to an MEC node.
Computationally demanding mobile applications, such as face recognition, language processing and online gaming, have been developing fast and increasingly outgrowing the limited capabilities of devices [4]. Typical characteristics of MEC include low latency, proximity, high bandwidth, mobility support and location awareness [5]. There is only a number of works that have jointly optimized the offloading decisions and resource allocation of multiple devices, typically for delay-tolerant services [6,7]. In [7], both offline and online approaches were proposed for the joint optimization, where a single task was offloaded to the MEC server while the others were executed locally. In [7], the allocations of computational resources and transmission bandwidths were optimized by exploiting semi-definite programming, and the offloading decisions were generated through randomized rounding. In [6], a heuristic scheme based on a submodular optimization method was proposed to jointly optimize offloading decisions and resource allocations for delay-tolerant tasks. More recent studies have been focused on either offloading decisions or resource allocation among multiple devices [8][9][10][11][12], with no allocation of transmission or computational resources. In [12], under limited cloud resources, both online and offline algorithms were developed to partition tasks for multiple devices. In [9], using queueing theory, offloading decisions were formulated as a noncooperative game in a three-tier MEC architecture consisting of mobile devices, cloudlets and distant cloud. Mobile edge Computing is a form of computer architecture [13][14][15]. It is about processing the data at the periphery of the network directly where they are generated. Rather than transfering the data generated by devices connected to the IoT to the cloud or the data center. It can offer nearby customized services that require good transmission bandwidth, additional data storage and processing. As illustrated in Figure 1, MEC can augment mobile devices' capabilities by offloading [3,16,17] some parts of their heavy applications via wireless access to a resource-rich edge node, and then effectively reduces their power consumptions [18]. The first works which dealt with the offloading within MEC environments were interested in studying the multi-user single-task case. In these scenarios, a user only targets to offload only a unique task. They studied resource allocation while they optimize the average task duration [19]. Actually, an application is generally partitioned into multiple tasks, and the offloading decisions must concern each of them. Consequently, even a single user has to handle simultaneously multiple tasks. Therefore, the offloading decision parameters should be selected according to a multi-task scenario. Recently, the authors of [20] studied a single-user multi-task offloading senario by optimizing radio resources and local frequency. They did not consider the local energy availability nor the remote server's frequency. Besides, they consider tasks with the same deadline T d . In this work, we study the general multi-task offloading senario where we introduce the control of the available local energy, and consider the edge server's frequency as a decision parameter in our optimization problem. Moreover, we consider a general setting where each offloadable task has to be executed within its specific deadline t i max . According to our vision, we can prolong the battery life of the mobile device by considering the amount of its available power, and reduce the tasks' processing time by adjusting the edge server's frequency. Subsequently, we have formulated an optimization problem that minimizes the processing time by jointly deciding the local and edge computing frequencies, as well as the offloading decisions. Due to its combinatorial nature and after its decomposition, we propose a heuristic solution based on a simulated annealing algorithm to jointly decide the tasks' offloading and the allocation of computing resources. The objective is to minimize the processing time via the offloading by considering the tasks' latency constraints and a threshold of available processing time. The remainder of this paper is organized as follows : the system's model and the optimization problem formulation are presented in Section 2. In Section 3, we present our method to solve the optimization problem. In section 4 we present the simulation results and their discussion. Finally, Section 5 concludes the paper.  Figure 2 Shows a single smart mobile device (SMD) containing an offloadable multi-task list. In this work, we plan to study the behavior of the offloading process for a multi-task SMD in an edge environment, while we optimize computation resources available at the edge server as well as at the mobile device. Particularly, the available energy at the SMD for tasks execution is limited. Besides, in the context of offloading, some pieces of a computationally intensive application are divided into multiple mutually independent offloadable tasks [21][22][23][24]. Therefore, according to the available computational and radio resources, some tasks are pick-up from the resulting tasks list to be offloaded to the edge servers for computing. The others are performed locally on the SMD itself. The execution of the whole list must happen within the time limit of the application. Additionally, it is assumed that the SMD concurrently performs computation and wireless transmission. For all these considerations, we derive a mathematical processing time model that considers three main decisions: the offloading decision for each task, the local execution frequency of the SMD, and the server execution frequency at the edge. Then, we formulate an processing time problem.

Figure 2. System model illustration
Practically, the SMD is connected to an edge node (EN), and is intended to offload a set of independent tasks by the mean of an edge access point (EAP). Additionally, the wireless channel conditions between the SMD and the wireless access point are not considered in this work. Moreover, at the time of the offloading decision and the transmission of the offloadable tasks, the uplink rate r is assumed almost unchanged.
As shown in Figure 2., the considered smart mobile device contains N independent tasks denoted as τ ≜ {τ 1 , τ 2 , … , τ N }. In addition, these tasks are assumed to be computationally intensive and delay sensitive and have to be completed. Each task τ i can be processed either locally or at the edge. It represents an atomic input data task that cannot be divided into sub-tasks. Moreover, it is characterized by the following three parameters τ i ≜ 〈d i , λ i , t i max 〉. The first one denoted d i [bits] identifies the amount of the input parameters and program codes to transfer from the user's local device to the edge server. The second one denoted λ i [cycles] specifies the workload referring to the computation amount needed to accomplish the processing of this task. The third parameter t i max refers to the required maximum latency for this task. The execution nature decision for a task τ i either locally or by offloading to the edge server is denoted x i where x i ∈ {0; 1}. x i = 1 indicates that the SMD has to offload τ i to the edge server, and x i = 0 indicates that τ i is locally processed. From this point, all time expressions are given in Seconds, and energy consumptions are given in Joule. Then, if the SMD locally executes task τ i , the completion time of its local execution is So, for all tasks, we have: additionally, the corresponding energy consumption is given by: e i L = k L . f L 2 . λ i [11]. Hence, the total energy consumption while executing all tasks that were decided to be locally executed in the SMD is given by: from the edge node. Because the data size of the result is usually ignored compared to the input data size, we ignore this relay time and its energy consumption as adopted by [25]. Hence, for the task and for all tasks, we have: So, the energy consumption of the communication process can be obtained by multiplying the resulting transmission period by the transmission undertaken power , and the rest of the execution period by the idle mode power . Thus, this energy is: Finally, given the offloading decision vector for all tasks, the local execution frequency of the SMD, and the server execution frequency at the edge, the total execution time for the SMD is composed of its local execution time, the communication time as well as the execution time at the EN, and it is given by: Then, according to (1) and (3) and if we note Λ = ∑ =1 , the total execution time can be formulated as:

Problem formulation
In this section, we present our optimization problem formulation that aims to minimize the overall execution time in the offloading process. Initially, to prepare the problem's data we start with an initial sorting of the tasks list τ ≜ {τ 1 , τ 2 , … , τ N } according to their deadlines t i max . Hence, the tasks execution order within the SMD or the edge server in the final solution must fulfill the initial order for both cases. Accordingly, the obtained problem is formulated as: In this work, each one of the available tasks can be either executed locally or offloaded to the edge node. Thus, every feasible offloading decision solution has to satisfy the above constraints. The constraint (C 1.1 ) refers to the offloading decision variable x i for task τ i which equals 0 or 1. The second constraint (C 1.2 )indicates that the allocated variable local frequency f L belongs to a priori fix interval given by  4 ) shows that the execution time of each decided local task must satisfy its deadline t i max . Similarly, in constraint (C 1.5 ), the offloading time of each decided offloadable task must satisfy the same deadline t i max . The final constraint (C 1.6 ) imposes that the total local execution energy must not exceed the tolerated given amount E max . This constraint is important especially for SMDs with critical battery.

PROBLEM RESOLUTION
In this section, we will introduce how we derive our solution from the obtained optimization problem.

Problem decomposition
In our proposed model, the offloading decision vector for all the tasks is denoted . Let define the vector that contains the offloadable tasks' identifiers: Additionally, we define: . Also, given the decision vector 1 , constraint (C 1.4 ) for a local task can be reformulated as . For ease of use, let note: ; (10) Thus, for a given offloading decision vector , we get the following optimization sub-problem: Considering the continuous variables fL and fS, problem P2 is a continuous multi-variable

Problems resolution
For the 3.1 problem, the objective function T 1 (f L ) is a strictly increasing continuous function according to its variable f L . Hence, by taking into consideration the obtained constraints (C 3.1.1 ) and (C 3.1.2 ), we can derive the following function's optimum f L * given by: for the 3.2 problem, the objective function T 2 (f S ) is strictly decreasing w.r.t. the variable . So, by taking into consideration the ( 3.2.1 ) constraint, we can derive the following function's optimum * given by:

The processing time determination
Similarly, given an offloading decision vector the following algorithm uses the first algorithm to determine the minimal processing time:

Proposed solutions
Next, the problem relies on determining the optimal offloading decision vector that gives the optimal processing time. However, to iterate over all possible combinations of a list of N binary variables, the time complexity is exponential (the exhaustive search over all possible solutions requires 2 N iterations). Subsequently, the total time complexity of the whole solution (including Algorithm 1) is O(2 N )*O(1)=O(2 N ) that is not practical for large values of N. In the following, we propose a low complexity approximate algorithm to solve this question.

Brute force search solution
For comparison purpose, we introduce the Brute Force Search method for feasible small values of N. This method explores all cases of offloading decisions and saves the one with the minimum processing time as well as its completion time. Now, the next algorithm summarizes the brute force search solution.

Simulated annealing offloading decision solution
We propose a method based on simulated annealing (SA) as the second solution. In the field of optimization, the SA technique has been adopted as a heuristic solution and in particular for difficult problems. To improve a solution, it uses an iterative random solution variation. Interested readers may consult the following works [26] and [27] for more details about this issue. Some references dealing with the offloading in cloud environments [7, 28,29] use tasks' workload density defined as ω i = λ i d i [cycle / bit] as a priority factor to decide the tasks' offloading. Additionally, the generated tasks are generally with different workload densities. Moreover, if two tasks are given with a slightly different data sizes, the one that consumes less processing time is the one given by the smallest cycles' count. Besides, with almost the same cycles' count, the one that consumes less offloading processing time is the one given by the smallest data size. In both cases, the task with the highest workload density is favorable for offloading (provided to have an offloading energy gain compared to the local execution and not to exceed its execution deadline). On the other hand, a task with a high workload density often has a large number of cycles. Its local execution is generally very expensive and thus makes its offloading often very favorable. In this context, we introduce a workload density threshold ω T such that: tasks with ω i > ω T are more favorable to be offloaded. The others are executed locally or offloaded with a proportional probability to their computational densities. Those with small densities are favorable for local execution, and those with high densities are favorable to be offloaded. Accordingly, if we note ω min = min [ω max , ω min ] as ω T = (ω max + ω min )/2 then ω T can be chosen such that ω T ≤ ω T < ω max .
In our proposed second solution, which we denote simulated annealing offloading decision (SAOD), we adopted the following general threshold probability: where T 0 is the initial temperature constant. ∆T i is the solutions' processing time variation while changing the task i state. Then, in each stage of our solution and with the intention to avoid local optimums, random solutions with poor processing time performance are accepted in line with a certain probability threshold. Accordingly, the next algorithm summarizes our heuristic solution.

Simulation setup
The presented results in this work are averaged for 100 time executions. We implement all the algorithms on the C++ language. The transmission bandwidth between the mobile device node and remote edge server is set tor = 100Kb/s. The local CPU frequency f L of the mobile device will be optimized between F L min = 1MHz and F L max = 60MHz. The CPU frequency of the remote edge server node will be optimized under the value F S = 6GHz. The deadlines t i max are uniformly defined from 0.5s to 2s. The threshold energy E max is uniformly chosen in [0.6 , 0.8] * Λ. k L . (F L max ) 2 .Additionally, the data size of each one of the N tasks is assumed to be in [30,300] Kb. For the cycle amount of each task, it is assumed to belong to [60,600]MCycles. The idle power and transmission power are set to be p I = 0.01 Watt and p T = 0.1 Watt respectively. For the energy efficiency coefficients, we set k L = 10 −26 and k S = 10 −29 . For the simulated annealing method, the following parameter values are adopted: factor = 0.5, ε= 0.3, ε min = 0.1 and ε max = 0.4, T0 = 200, Δt = 0.02, CF=0.5.

Performance analysis
We present our results in terms of average decision time and average tasks' processing time. We start by studying the average tasks' processing time for each method. Thus, we carried an experiment where we vary the number of tasks parameter between 2 and 26 tasks.

The processing time
For each method, we start by studying the average tasks' processing time. Thus, we carried an experiment where we vary the number of tasks parameter between 2 and 26. The experiment's results are depicted in the following two figures. Figure 3 represents the obtained results for both based solution (BFS) and Simulated Annealing based solution (SAOD). It shows a small distance between the curves representing the realized averaged tasks' processing time. Accordingly, the differences between the optimal BFS method and the SAOD method vary from 0.00% to 2.15%.

The average execution time
Now Figure 4 depicts the average of the execution time in ms to get the offloading decisions for both schemes. While the tasks count N is between 2 and 26, it clearly shows the exponential variation of the BFS execution time w.r.t. N. Additionally, the SAOD curve illustrates a slightly stable running time that starts from 0.2ms for N=2 and reaches 0.62ms for N=21.

Discusion
In view of the results presented before, our heuristic solutions SAOD give satisfactory results in terms of execution time. In addition, our solution gives an average tasks' processing time that is comparable and very close to the optimal solution with an almost linear execution time.

CONCLUSION
In this paper, we propose a simulated annealing based heuristic solution to solve a hard decision problem that jointly optimizes the processing time and computing resources for a smart mobile device within a mobile edge-computing node. The mobile device intends to optimally offload the content of a list of heavy tasks. Each task in its list is time-constrained with a proper deadline. The obtained results show the performance of the proposed simulated annealing based algorithm. By optimally adjusting the local and the remote computing frequencies, the proposed implementation shows the effectiveness of our solution. It brought a real processing time efficiency with almost a linear execution time that satisfies the decision time constraints in such edge systems. As a future work, we plan to generalize our study to the multi-user case while we introduce more relevant parameters, such as network state and wireless communication interference.