Efficient Computation Offloading in Edge Computing Enabled Smart Home

Mobile edge computing which provides computing capabilities at the edge of the radio access network can help smart home reduce response time. However, the limited computing capacity of edge servers is the bottlenecks for the development of edge computing. We integrate cloud computing and edge computing in the Internet of Things to expand the capabilities. Nevertheless, the cost of leasing computing resources has been seldom considered. In this paper, we study the joint transmission power and resource allocation to minimize the users’ overhead which is measured by the sum of energy consumption and cost leasing servers. We formulate the problem as a Mixed Integer Linear Programming which is NP-hard and present the Branch-and-Bound to solve it. Due to high complexity, a learning method is proposed to accelerate the algorithm. The branching policy can be learned to reduce the time-cost of the Branch-and-Bound algorithm. Simulation results show our approach can improve the Branch-and-Bound efficiency and performs closely to the traditional branching scheme.


I. INTRODUCTION
With the rapid development of the Internet of things (IoT) [1], the increasing number of smart devices are emerging, such as eldercare and childcare application [2], [3], for the intelligent living environment to bring more convenience to people's lives. However, IoT terminals are usually limited by battery lifetime, computing capabilities, and network connections [4]. At the same time, the IoT devices with limited computation resources have difficulties to deal with the large amount of data generated by smart homes. Therefore, computation offloading is one of the feasible schemes to tackle the above challenges.
Mobile cloud computing (MCC) used to be regarded as a potential approach to solve these challenges [5]. However, mobile and IoT devices may suffer long latency by offloading the computing task. Instead of depending on a remote cloud, a new paradigm called mobile edge computing (MEC) is proposed. The core idea of mobile edge The associate editor coordinating the review of this manuscript and approving it for publication was Sherali Zeadally . computing is to place computing, storage resources at Internet's edge near the mobile and IoT devices to release the burden on backhaul networks, reduce response latency and promote resource-intensive IoT applications [6]. In particular, idle computing resources, such as laptops, tablets, and smartphones, are deployed at the network edge to process offload tasks from resource-starved devices, e.g., IoT devices. Therefore, edge computing can reduce network bandwidth, response time and the risk of network data leakage [7], [8], which can help improve people's home life in a smart home.
In this paper, we propose a hierarchical network architecture consisting of edge computing and cloud computing to improve the efficiency of cloud resource utilization in a smart home. Our basic idea is to flexibly allocate tasks position to minimize the overhead. For instance, edge computing is a hopeful technology that brings smart home to a new level. A range of smart devices generates a great amount of data stream. It is hard to react promptly to emergencies by transferring data to cloud servers for processing. By offloading critical tasks to the edge server, the latency-sensitive application can get real-time analysis and response. And, non-critical VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ data is collected and sent to a cloud server for further process.
In reality, users also need to consider the lease computing resources (from edge server or cloud server) to meet the offload demand and the energy consumption of a smart home. Hence, we study the joint optimization of user cost and energy of the smart device. It may be the first research on user cost in edge computing so far.
To minimize the overhead and meet the tasks latency requirement, radio resources allocation and server assignment for the offloading task is formulated as a mixed integer linear programming problem (MILP), which is generally considered as NP-hard problem. Although the NP-hard problem can theoretically be solved by exhaustive search, for even small size instances, when the instance size increases, the computational time will be significantly raised, therefore it is hard to find the global optimal solutions [9]. Branch and Bound is seemed as one of the most effective approach to solve MILP problem [10], [11]. The Branch-and-Bound (B&B) algorithm is an iterative algorithm. In each iteration, we solve linear programming (LP) relaxation of each sub-problem and to find an integer feasible solution. However, in each step of the search, the branch of the variable will double the size of the tree resulting in a very large search tree and high computational complexity. An essential challenge of B&B is to appropriately choose variable to branch. Many studies have shown the branching strategy affects the size of the search tree [12], [13]. An effective variable selection scheme may have a huge impact on the search scope of the tree and reduce the time to find the optimal solution. We adopt deep learning to imitate branching policy based on the Strong Branching (SB) approach. Strong branching, can reduce 65% node search compared with hybrid branching, thoroughly test the variables on each node, and select the suitable one based on the gap with the current best feasible solution [14]. Specifically, we study the computation offloading among multiple mobile devices in an integrative network of MEC and MCC, in which we minimize the mobile devices' overhead of cost and energy. We then propose a novel approach to learn branching policy to accelerate the B&B algorithm. To our knowledge, it is the first to joint optimization for devices' cost and energy in multi-layer networks, and attempt to adopt deep learning to mimic variables selection. The main contributions of our paper are as follows, 1) Our work integrates cloud computing and edge computing for computation offloading. We model the overhead of each mobile user as the weighted-sum of the computation cost and energy consumption; We formulate the problem of joint transmission power and resource allocation for minimizing the overhead while complying with the Signal-to-Interference-plus-Noise Ratio (SINR) and task deadline. 2) Because the formulated problem is MILP, the branch and bound is the most effective solution to solve it, while the approach high a time overhead. We present learning branching to improve the performance of B&B. We collected the decisions made by strong branching strategy about variable selection as a training dataset. Next, we train a deep learning model for imitation branching policy. The approach transfers the calculation burden in the training phase to reduce the calculation time.
3) The evaluation shows that our optimization can help mobile users save their costs and decrease energy consumption. Meanwhile, our method improves significantly the B&B algorithm and reduces calculation time over traditional branching policy.
The rest of this paper is structured as follows. In Section 2, related works are surveyed; in Section3, the system model is presented and the performance metric is considered; then in Section 4, we formulate the system as an Integer Linear optimization problem; Section 5 details the proposed solution; simulation results are shown in Section 6. Finally, Section 7 concludes the paper.

II. RELATED WORK
Smart home technology combines sensors, monitors, interfaces, applications, and devices, and realize the automation, localization, and remote control through the network [15]. In recent years, with the development of Internet technology, a large number of novel intelligent applications are emerging. For example, in healthcare, people are monitored by various sensors and actuators, and doctors can make a proper diagnosis and decisions based on the data generated by these devices [16]. At the same time, it also brings further demands for much more computational capabilities and low-latency [17].
Mobile cloud computing, providing computation and storage performance, can help to solve the above problems [18], [19]. In [20], a new application is developed as an integration of a smart home, IoT, and cloud computing. The new benefits of the composite systems are compared to individual components. In [21], a scheme is proposed to manage power consumption monitoring through IoT and cloud computing. In [22], A novel multi-layer cloud architecture is developed to realize the efficient interaction of heterogeneous devices in smart homes based on the Internet of Things, and ontology is adopted as an effective method to alleviate the heterogeneity issues.
However, offloading tasks from large-scale IoT devices will cause backhaul congestion for a cloud server. Furthermore, due to the long transmission latency, cloud computing cannot meet the latency-critical applications [23]. Edge computing as a promising technology can overcome the weakness of traditional cloud computing [24]. Recently, several works have been carried out to study the applying of edge computing to a smart home. Reference [25] designed a method named edgeIoT to solve the scalability problem. The method can effectively distribute packets to reduce the data stream and delay via SDN technology. Aim to the resource limitation of smart home in computing resources, a technology based on containerization is proposed. With the help of technology, a deep learning model depends on fewer hardware resources [26]. Due to data processed localized, edge computing is also considered a secure paradigm to protect privacy. An intrusion detection system based on a convolutional neural network is presented to categorize traffic and generate intrusion detection dataset [27]. Due to limited computational capability and complex topology, the edge computing network needs to be optimized to maximize its effectiveness. Reference [28] considered a computation offloading problem that aims to minimize the delay and energy consumption. Specifically, the authors formulated the problem as the curseof-dimensionality and solved it via dynamic programming techniques. In [29], authors designed an energy management strategy of edge computing. The scheme enabled edge computing while reducing the energy consumption up to 86% in a smart home. Reference [30] proposed an offloading algorithm COM to optimize the execution time and energy consumption. However, few studies have considered the cost of using edge servers. This article will consider the joint optimization of energy consumption and cost in edge computing, and the problem is formulated as MILP problems, which are generally considered as NP-hard.
To solve the integer programming, most effective approach is B&B algorithm [31]. B&B alogirthm set up an optimization tree, and each node of the tree denotes an initial problem with integer constraints which is from the relaxed fractional variables. Which fractional variable is selected for branching determines the size of the optimized tree. Meanwhile, it is necessary to find a tradeoff between time spend of decision made by branching strategy and the overall optimization time. Therefore, the branching strategy is one of the important components that determine the efficiency of the B&B algorithm. To reduce the time cost and guarantee the accuracy, machine learning has been introduced to imitate branching strategy. Reference [32] learned the node searching stategy to improve B&B. The approach achieve better performance compared with open-source solvers. In [33], authors use machine learning for configuration of search tree. The experiments show the method can reduce the tree size. Reference [34] adopted machine learning to mimic the branching strategy, which can significantly reduce the size of search tree. However, they applied traditional machine learning algorithms, which need human intervention to decide features of data set. We adopt deep learning for automatic learning of branching strategies to reduce human intervention.

III. SYSTEM MODEL
We consider the integration of MCC and MEC to meet the computation-intensive and latency-sensitive applications in smart home. As depicted in Fig. 1, we denote the set of base station (BS) as S = {1, . . . , S} and the set of mobile users as N = {1, 2, . . . , N }, respectively. Each BS j ∈ S equipped with server of f e j (CPU frequency) which provide offloading services for mobile users. Every user has a task, which can be executed either at local or offloading on a server. The decision binary variable is  that the task is processed at local device, x ij = 1 implies that the mobile user i offload the task through the BS j. The task T n (n ∈ N ) cannot be divided into subtask, represented by tuple {d n , c n , l n }, where d n denotes input data size, c n is the workload of the task i.e., the number of CPU cycles to accomplish the task, and l n is the latency thresholds. The key notations used in the paper are summarized as follow,

A. LOCAL COMPUTING
If the task T n is executed locally, the decision variable x ij = 0. Let f l n (CPU cycles per second) represents the computing capability of local device u. The execution time of the task T n is: When the task is performed on the user device, we calculate the energy consumption via the execution energy model E = kf 2 [35], where k is energy coefficient and f is frequency of the CPU. Therefore, the energy consumption for executing the task T n that requires CPU cycles c n to complete the task VOLUME 9, 2021 is: B. OFFLOAD COMPUTING Offloading task T n to servers consists of two main phases: data transmission and task processing. Since the size of the result is often small, we neglect to consider the download step [36]. Each stage of task offloading incurs an additional overhead such as energy consumption, delay, and cost.

1) TRANSMISSION MODEL
In this work, OFDMA is used for uplink between mobile devices and servers, in which the whole spectrum B Hertz is divided into N sub-carrier and each device is assigned to one sub-band. A fraction α n (α n ≥ 0, where n∈N α n = 1) of bandwidth is scheduled for mobile devices to transmit the task. Since the devices offload tasks to the same BS through their allocated sub-band, we assume that each device and BS has only one antenna like [37]. Let p n and h ns denote the transmission power of user n and channel gain between device n and server s, respectively. In this case, the users also suffer from the inter-cell interference. The Signal-tointerference-plus-noise ratio from mobile device n to server s is: where σ 2 is the noise variance. Since one task only offloading on one sub-band, the achievable transmission rate bits/seconds can be written as, User n can offload task to only one BS, the constraint of the relationship between user and BS is given as,

2) LATENCY MODEL
Both MEC servers at the Base Stations and remote cloud server can provide computing service to multi-devices. When a task T n is offloaded, computational resources f n [cycles/s] > 0, n ∈ N is allocated to execute the task and return the output result to the user. Hence, given the computation capability, the execution latency expressed as, where more allocated resource f n will decrease the execution time of task T n , but will increase the cost. The time of offloading task from the user n to the BS s depends on the transmit power and bandwidth. We also assume that BS transmit data to the remote cloud server via backhaul links with enough high bandwidth, and the transmission delay can be ignored [38]. Therefore, the transmission time can be calculated as (where d n is the data size of task), t up n = d n R n (p n , α n ) (7)

3) ENERGY MODEL
The consumed energy (millijoule) of offload task T n equals to product of transmission power and latency [39]- [41], which can be derived as, where ε n is the power amplifier efficiency of user n. Without loss of generality, we assume that ε n = 1. The transmission energy consumption of user T n is presented as, E up n (p n , α n ) = p n t up n = d n p n R n (p n , α n ) Therefore, according (2) and (9), we can compute the energy consumption of mobile user as,

4) COST MODEL
The offloading cost depends on the unit cost of computing resources δ s at edge server and δ at cloud server. The cost model can prevent the task from being offloaded too concentrated on the edge server with high computation capability and cloud server. For instance, more computing resources will be used in a cloud server, thus δ s < δ. Offloading the tasks to remote cloud servers will incur a high cost, which may go over budget. We define binary variable y i = {0, 1}, i ∈ N , where y i = 0 means the task i is offloaded to cloud server; y i = 1 means the task is executed at the edge server. The computational cost can be evaluated as,

IV. PROBLEM FORMULATION
Our goal is to minimize the sum of energy consumption and cost while meeting the task's deadline. We optimize the parameters of devices, like transmission power, sub-band, and assigned computational resources, to reduce the overhead. This can be formulated as follows, where λ e and λ c are the weights for energy consumption and cost, respectively. Constraint (10b) meets the latency of each task. Constraint (10c) means the whole bandwidth is allocated to the users. Constraint (10d) make sure the computational resources of each edge server is respect. It can be seen that the objective (12a) and (12e) indicate the problem as a mixed-integer program, which is hard to solve.

V. PROPOSED SOLUTION
We adopt the B&B algorithm to solve the problem (12). Since the Problem (12) is NP-hard, the B&B algorithm can obtain the global optimal solution through iteration search the binary tree. The lower bound can be found among the feasible solutions in the given region. And we linearize the integer problem by relaxing the constraints to find the upper bound. The basic idea of B&B is to constantly search and update the upper and lower bound of the problem. If the upper and lower value is equal, the algorithm terminates. That is, a feasible solution is optimal. If the upper and lower bound are not equal, the algorithm reselects the node to partition and repeats the search process.

A. OPTIMAL BRANCH-AND-BOUND ALGORITHM
We summarize the B&B algorithm for the formulated problem (12). B&B algorithm sets up a search tree in which the root node is a problem (12). In each iteration, B&B uses a node selection scheme (we adopt Best-bound-first search in this paper [42]) to select a leaf node and then adopt a branching policy to choose a variable x i to partition. Let Q + i (Q − i ) denote the reformulated problem with the constraint x i = 1 (x i = 0) as a linear programming problem. Then we solve the linear problem and get the solutions.
1) The optimal solution to Linear programming of Q + i (Q − i ) is also the feasible solution of original problem, then update the lower bound to the objective value of is infeasible, the node will be pruned.

3) The objective vale of Q
is smaller the current lower bound, the node will be pruned.

B. LEARN TO BRANCHING
In the B&B search process in Algorithm 1, there are three main parts: node selection, calculation of solution and variable branching [43]. Most of the time is spent in the branching process, and a good branching strategy can significantly improve the efficiency of the algorithm. The more accurate branching variable is found; the less computational time is spent. Our goal is to find branching variables as accurately as possible to speed up the algorithm's B&B search process. However, the current branching strategy is either spend much more time to calculate or not accurate. In the following, we propose a deep learning method to assist in branch scheme. Deep learning approach transfers the computational burden to the training phase, therefore it can significantly reduce the time cost of B&B algorithm.
The B&B search process can be expressed as a decision-making process. In each search node, we need to Algorithm 1 Optimal B&B Algorithm 1: initial a search tree T , the root of the tree consists of the problem (12); Let L * = −∞ be the objective value Set list of leaf nodes = N 2: while N = ∅ do 3: Select a leaf n in N through a node selection policy 4: if Q corresponding to n is infeasible then 5: Go to the step 2 6: else 7: Using learning method to choose a variable x i 8: 10: ifQ is feasible then 11:x is an optimal solution andL is the objective value 12: if L * <L then 13: Set L * =L 14: else if L * >L then 15:x is not the optimum solution. Prune the branch 16: end if 17: else 18: Prune the node 19: end if 20: end for 21: end if 22: end while determine which variable in the node to choose for branching. The set of all the fractional variables is V . We propose a learning-assisted branching framework to provide an effective and efficient approach. The idea is to apply learning-based methods to help optimize algorithms to solve the most difficult and time-consuming part of optimization. With the increasing of variables, it will spend a lot of time to find a proper variable to partition like Strong Branching policy. We are training a deep neural network (DNN) for Strong Branching. We fed the best solution to train the model. A well-trained DNN can be used to provide a prediction of the branching variable to limit the scope of the search. For instance, the set of the fractional variable V is regarded as input and the branching variable can be obtained as output. The algorithm is shown in Algorithm 2. Branch on the variable and solve the LP relaxation problem 7: if objective value < lower bound or no feasible solution then 8: Prune the branch, and choose another variable where is small constant (e.g. 10 −6 ). A product is adopted for sore(a, b) = a × b, SB try to find the variable with maximum score.

2) OUTPUT DATA
The learning model is aimed to forecast the probability of each candidate variable to get the best feasible solution. hence, the output layer can be viewed as vector with the same length as the number of fraction variable of the node. For the output layer, we just need only one variable, we use binary value to define the output vector, whis is, The binary value indicates that we focus more on whether a variable will be selected to partition. For our learning model, the length of output vector corresponds to the input data. If there are N input variables, the output vector will be a N dimensional vector, where only 1 element represents the suitable variable, and all other elements are 0. We assume a DNN network with a 3-layer network, and the number of neurons in each layer is N , N 1 , and N . Taking a sample N * 1 for training, two matrix multiplications require N * N 1 and N 1 * N calculations respectively. The time complexity of Forward propagation for a sample should be O(N 1 ). In the Back propagation stage, assuming there are a total of V training samples, and each sample is trained only once, the time complexity of training a neural network should be O(V * N 1 ).

3) TEST SAMPLES
We generated the test samples using SB policy. The value of output unit is between 0 and 1 in our model. The output value is represented to probability distribution via normalization or softmax function. The transformed values indicate the possibilities that the variable can be partitioned to obtain the best feasible solution. In our problem, the output can be used to express the probability of whether a variable will be branched and the sum of output values equals 1. We can choose the maximum value of the variable as the suitable one. We compare the selected variable with the test samples, and adjust the parameters based on the result.

VI. PERFORMANCE EVALUATION
In this section, simulation results are presented to evaluate the performance following different scenarios. We consider a hierarchical network architecture consisting of edge computing and cloud computing. There are 6 mobile devices which can offload the task to 4 edge servers or cloud server. The bandwidth is randomly divided into n sub-channels. The main simulation parameters are presented in Table 2. We adopt IBM ILOG CPLEX 12.6.1 to implement various strategies using control callbacks, in single-thread mode. In this paper, we compare the branching scheme based on deep learning with 3 strategies, which is shown in Table3. CPLEX is the default variable selection of the solver. SB refers to Strong Branching, and PC refers to pseudocost branching [46]. From Table 1, we can see that the computation time based on our optimal algorithm is considerably reduced than the computation time of the conventional optimization algorithm. And as the scale of the instance increases, the computation time of the conventional algorithm increases significantly, while the time increase of the algorithm based on our algorithm is not obvious. In Fig. 2, we compare the convergence performance between the B&B algorithm and the Deep learning assisted method. There are 6 mobile devices and 4 edge server in the instance. As expected, the deep learning-based algorithm takes about 100 iterations to keep steady. The traditional B&B with the default sets of CPLEX spends around 300 iterations to converge, which means B&B slowly obtain the optimal solution.
In Fig. 3, we study the objective value with different latency threshold and the computational capacity of the edge server. First, increasing the latency threshold results in a decrease in the objective value. The reason is that mobile devices will consume more computational resources to reduce its task execution time to keep up with the large threshold, which will incur higher costs. Additionally, increasing the latency threshold will allow users to use fewer resources at the server, thereby reducing overall costs. Secondly, the objective value decreases as the edge servers have a high computational capacity. The edge server with high computational capability will afford more resources and lower cost (Compared with cloud server) to mobile devices, which reduces the need to offload tasks to the cloud server. Meanwhile, edge servers with less computational resources are easy congestion, thereby mobile devices have to seek more computation service at a high cost. That is why the gap between curves gets smaller and overlap under the high latency.
In Fig. 4, we study the objective value under a different number of devices. First, the objective value is advanced with the growth of devices. This is caused by the increase in the number of resources: energy and computing. Additionally, it means more devices offload tasks to servers, which incurs higher costs. Secondly, adding more edge servers may be useful to address high device requests in dense areas, which will decrease cost by reducing the high utilization of the cloud server. As show in Fig. 5, we show the changes in the weight λ c affect the cost. Specifically, we compare the cost under different λ c . As the λ c increase, the cost on each device decrease. A higher weight is given to the cost goal, the function will give priority to allocating devices with small computational resources with lower unit costs, thereby reducing the overall cost. But on the other hand, this may lead to an increase in energy consumption in terms of wireless channels. The channel state is not the best to communicate with the edge server of low capability, so the devices will be forced to increase its transmission power to keep up with the required deadline of the task, resulting in higher energy consumption in the process.
The Fig. 6 shows the impact of weight λ e on energy consumption. We vary the weight λ e and study the change on energy consumption of device under different values of the latency. As we can see, with decrease in λ e , the energy consumption increase. These observations are due to the fact that when the weight λ e on sub-target energy of objective function is increased, the optimization solutions will make device to choose a base station with better channel conditions to reduce the transmission power, therefore the device's energy consumption is reduced.

VII. CONCLUSION
We study the cost and energy efficiency of task offloading in a hierarchical network architecture that consists of edge computing and cloud computing. To the best of our knowledge, it is the first time to study the problem of cost and energy efficiency in a multi-layer network for smart home. We expoit a learning approach to improve the B&B algorithm to solve the formulated MILP problem. The learning method addresses the variable selection issue to speed up the most time-consuming process of the B&B algorithm. Simulation experiment showed the results of our proposed algorithm closely to the B&B algorithm and significantly reduce the calculation time. Meanwhile, we evaluated the key factors in energy and cost of task offloading in different environments.