Optimization of cooperative offloading model with cost consideration in mobile edge computing

The combination of idle computing resources in mobile devices and the computing capacity of mobile edge servers enables all available devices in an edge network to complete all computing tasks in coordination to effectively improve the computing capacity of the edge network. This is a research hotspot for 5G technology applications and integrating collaborative computing techniques into edge computing. Previous research has focused on the minimum energy consumption and/or delay to determine the formulation of the computational offloading strategy but neglected the cost required for the computation of collaborative devices (mobile devices, mobile edge servers, etc.); therefore, we propose a cost-based collaborative computation offloading model. In this model, when a task requests these devices’ assistance in computing, it needs to pay the corresponding calculation cost; and on this basis, the task is offloaded and computed. In addition, for the model, we propose an adaptive neighborhood search based on simulated annealing algorithm (ANSSA) to jointly optimize the offloading decision and resource allocation with the goal of minimizing the sum of both the energy consumption and calculation cost. The adaptive mechanism enables different operators to update the probability of selection according to historical experience and environmental perception, which makes the individual evolution have certain autonomy. A large number of experiments conducted on different scales of mobile user instances show that the ANSSA can obtain satisfactory time performance with guaranteed solution quality. The experimental results demonstrate the superiority of the mobile edge computing (MEC) offloading system. It is of great significance to strike a balance between maintaining the life cycle of smart mobile devices and breaking the performance bottleneck of MEC servers.


Introduction
Exponentially increasing data volumes and diverse service scenarios are increasing the demands on mobile device performance. Although the central processing unit (CPU) of a mobile device has undergone great development, sometimes B Bin Xu xubin2013@njupt.edu.cn Jin Qi qijin@njupt.edu.cn 1 it still cannot meet the demand for processing a large number of computing tasks in a short time. In addition, the limited battery energy and storage space have also become important factors that restrict mobile devices from processing largescale data computing applications in a timely manner and affect the quality of the user experience (Abbas et al. 2017).
By offloading the massive amount of data required on a mobile device to the cloud, mobile users can use more complex and computation-intensive programs while extending the battery life of the device itself. However, this method transmits a large amount of data to a cloud server, which causes a large delay. In addition, mobile terminals need to consume more energy, which increases the network load and affects the service quality (Wei et al. 2021). In order to get rid of this limitation, the Mobile Edge Computing (MEC) mode comes into being. To improve the user experience, the engineers provide users with good IT environments and pow-erful computing power by erecting edge computing servers closer to users (Chen and Hao 2018). Due to the powerful computing power of edge devices, we can embed some artificial intelligence algorithms into edge devices to meet the requirements of different scenes (Gumaei et al. 2020;Liu et al. 2020). However, there are some disadvantages to a MEC server. When increasingly more tasks are relocated to a MEC server, serious interference will occur between the devices, which increases the delay. And too many tasks may overload a MEC server. In addition, we need to consider the security of edge computing, which is the difficulty in the research (Qian et al. 2020).
Some scholars have proposed to integrate collaborative computing technology into a mobile edge computing offloading system to solve the above problems. Collaborative computing means that machines in different regions can work together for a task in a coordinated manner. Integrate collaborative computing technology into mobile edge computing unloading system, that is, the equipment with computing capacity in the network used to unload tasks as much as possible, so as to exert the maximum computing capacity of the whole network (Yuvraj Sahni and Cao 2021). There are numerous idle mobile devices which play the role of virtual MEC servers that share computing resources with other devices in the network. In the existing multiuser collaboration model (Pu et al. 2016;Ti and Le 2017;Cao et al. 2018), the offloading decision is mainly determined using the delay or energy consumption as the optimization goal. However, in fact, after adding synergy technology, it is not reasonable to only use these indicators as optimization targets. Since users have no commitments for cooperation, one important aspect of co-computing research is to design schemes for incentivizing them for sharing computation resources. The multiuser collaborative MEC offloading model proposed in this paper considers multiuser interference and delaysensitive task acceptance and proposes an index based on the collaborative technology's calculation cost to optimize the target selection, not only energy consumption. Various types of collaborative devices will require different calculation costs due to factors such as status and environment. When a task requests devices' assistance in computing, it needs to pay the corresponding calculation cost. The index of collaborative calculation cost can indirectly quantify the cost required to motivate users to share resources for improving the performance of co-computing. This makes the model more reasonable and more practical.
The solution of the mobile edge computing offloading decision scheme is a complex non-deterministic polynomial (NP) hard problem (Guo et al. 2017). The self-adaptive mechanism plays an important role in solving practical problems (Qasim and Kazmi 2019). By using it appropriately, the solution has good global and local search ability when dealing with NP hard problems (Xue et al. 2020). We propose an adaptive neighborhood search based on simulated annealing algorithm (ANSSA). The ANSSA adopts an adaptive mechanism to update the probability of different operators being selected according to the historical evolution experience to realize the adaptive evolution of the algorithm and effectively improve the solution performance.
The main contributions of this paper are as follows: • Based on the collaborative computing, the calculation cost is incorporated for the first time, and it is used as the optimization goal to further improve the rationality of the model. It also indirectly quantifies the cost of motivating users to share resources and further improves the performance of collaborative computing. • We propose a novel algorithm based on the simulated annealing adaptive neighborhood search algorithm to quickly solve the multiuser unloading problem. It adopts an adaptive mechanism to update the probability that different operators are selected based on historical experience and context perception, which allows individual evolution to have certain autonomy. It strives for individuals to choose the optimal strategy in each iteration. • A large number of experiments on different numbers of mobile users show that the ANSSA can achieve satisfactory performance in all instances compared to the two other algorithms. The superiority of the MEC offloading system has been verified.

Solving the offloading decision and resource allocation problem
In recent years, as 5G technology develops, MEC has become a focus of research effort. Mao et al. (2016) proposed a mobile edge computing model for a single-user-single MEC server with the shortest task execution time as the optimization goal.
Another study (Wei et al. 2018) studied the problem of the joint allocation of computing and communication resources, aiming at achieving energy savings in the multiuser-single MEC server scenario. Other authors  considered the interference between multiuser equipment in a multiuser mobile edge computing offloading system and minimized the system energy consumption under the delay constraint by optimizing the offloading decision. However, none of the above studies consider that the offloading decision and the allocation of computing resources are interdependent. The allocation of computing and communication resources depends on the formulation of the offloading decision, and the quality of the offloading decision changes with the distribution of resources. Therefore, it is necessary to jointly optimize both of them.
Some scholars have considered this issue. Huang et al. (2019) considered the multitask interference situation, and the offloading decision and resource allocation were jointly optimized to achieve the minimum system energy consumption. Tran and Pompili (2018) designed a multiunit, multiservice offloading system by jointly optimizing the offloading decision and resource allocation. Stackelberg game theory was used to find the optimal decisions and optimal resource allocation for multiuser-single MEC server scenarios . However, although the methods in the above studies are able to obtain better solutions in the solution process, the solution times are too long, and a user may be outside the effective range by the time a good solution is available. Furthermore, the above algorithms easily fall into local optima.
The characteristic of the simulated annealing (SA) is that the inferior solution can be accepted with a certain probability in order to escape the local optimum to a certain extent. Wang and Sj (2011) researched a blind detection algorithm based on simulated annealing chaos particle swarm optimization and found that the improved algorithm achieved a good improvement in the global convergence. Zheng et al. (2013) combined Particle Swarm Optimization with Gaussian kernel function (GPSO) and the SA algorithm to form a new hybrid algorithm. GPSO was used in the early stage, and the SA algorithm was used to escape the local optimum to find the global optimum when GPSO is stagnant. The above work shows that the combination of the SA algorithm and other algorithms can effectively prevent the premature convergence of the algorithm. We combine the simulated annealing algorithm with the adaptive neighborhood search algorithm and add many different evolution operators, effectively improving the search and exploration capabilities of the algorithm. In addition, we adopt a two-layer optimization method (Huang et al. 2019) to jointly optimize the offloading decision and resource allocation to greatly improve the quality of the results.

Combination of collaborative computing and mobile edge computing
In recent years, some scholars have proposed combining collaborative computing technology with MEC to enhance its abilities. A device-to-device (D2D) atomization framework was proposed to achieve joint computing and network resource sharing among mobile users (Pu et al. 2016). Ti and Le (2017) proposed a general framework for transferring device computing tasks to edge clouds and/or moving peers. Cao et al. (2018) studied a three-node MEC offload system consisting of a user node, a secondary node and an access point node connected to a MEC server, which divided the user's computing tasks into three parts: local computing, assistant offload and AP offload. Based on these, we consider the delay-sensitive task and the channel interference between multiple users, making the model more complicated. In addition, we propose a new indicator-the calculation cost. When a device offloads its task to other devices for execution, it needs to pay a certain price to the corresponding device as compensation for using the device's resources. The index indirectly quantifies the cost of motivating users to share resources and further improves the performance of collaborative computing. This paper jointly optimizes the energy consumption and calculation cost and minimizes the sum of their values to construct a more reasonable and practical model.

System model
As shown in Fig. 1, we consider a multiuser collaboration model consisting of a base station with a MEC server denoted as S and a set of n mobile device users denoted as N = {1, 2, 3 · · · n}. We assume that each mobile user will only post one computing task, and denote the task of mobile user i as A i (i ∈ N ), which can be defined by a 5-tuple: Herein, C i denotes the number of CPU cycles required to complete task A i ; D i and B i denote the sizes of the input data and results, respectively; T max i represents the maximum delay that task A i can tolerate; and Co i represents the calculation cost of task A i when running on the device.
We model the entire network as a random directed graph denoted as {V , E}. V = N ∪ S represents the collection of mobile devices and MEC servers in the entire network. E = (i, j) | e i j = 1, ∀i, j ∈ V indicates the connection status in all nodes. Herein, e i j = 1 represents node i initiating a connection to node j and represents an unloading decision. We assume that the entire scenario is static, that is, it does not change regardless of the impact of the mobile device during the move. In addition, r i j indicates that after the task A i is offloaded to node j, node j allocates computing resources to the task A i for the task A i to compute, which belongs to resources.

Energy consumption calculation
When given that task A i selects node j to execute the required computing resource r i j , the calculation time T c i j that task A i needs to consume is represented by Eq. (1). In addition, r i j ≤ f j and f j is the maximum computing power of node j itself. We only consider the computational power consumption on mobile devices because mobile devices usually rely on batteries to keep working and cannot last for a long time. Computation-intensive tasks quickly consume power for mobile devices. So the computational task energy consumption ε c i j can be expressed as Eq. (2).
The computing task energy consumption is related to the hardware circuit structure of the mobile device itself, which is represented by a constant coefficient k.
In the proposed model, the MEC server can accept multiple tasks. Considering that multiple tasks in the same mode will share a channel and cause interference, according to Shannon's formula, the maximum transmission rate R i j can be obtained when task A i selects node j. However, it is worth noting that when selecting the local device mode, there is no need to transfer data. This is shown in Eq. (3).
where B is the bandwidth, H i j is the channel gain when node i communicates with node j, p tr i is the power when node i sends the task data, and δ 2 is the noise power. Similarly, after the task data are transmitted and calculated, the result data need to be returned to device i. We assume that the transmission rate of the outgoing data is consistent with the transmission rate of the returned result data, that is, that R i j = R ji .
Then, we can obtain the transmission time T tr i j of the task data, as shown in Eq. (4).
Obviously, when j = i, that is, when the mode is local mode, there is no need to transmit data. Hence, T tr i j = 0. For the energy consumption ε tr i j generated during the transmission process, if the calculation task A i is performed in the cooperation mode, not only does node i need to send the task data to receive the data result, but node j must also perform the calculation task when receiving the task data and returning the data result. To determine the energy consumption, this energy consumption is also included in this task. p re i is the power when node i receives the task data. However, when the collaborative device is a MEC server, this part of the energy consumption is borne by the MEC server, and the transmission energy consumption is not included. Therefore, the formula for calculating ε tr i j is as shown in Eq. (5).

Task cost calculation
When computing task A i is assigned to a different device for calculation, there must be a corresponding calculation cost.
We consider this computational cost as the cost of performing the execution on node j and denote it as Co i . Various types of collaborative equipment require different calculation costs due to factors such as status and environment, and so the calculation costs of performing tasks on different nodes are different as well. Therefore, the formula for calculating Co i is as shown in Eq. (6).
where p j is the calculation cost of running the unit computing resource when task A i is executed on node j. It is worth noting that the task does not need to be computationally expensive when executed on a local device. However, the calculation cost caused by a single task does not represent the pros and cons of the entire unloading decision-making scheme, and the same proportion of the computational cost of the task is obviously unreasonable. Hence, we use Co to describe the calculation cost of the entire offloading decision scheme. The calculation formula is as shown in Eq. (7).
where f (D i ) is the weight of the calculation cost of each task in the Co calculation process. We assume that the larger the amount of data to complete a task, the greater the calculation cost of the task. Based on this kind of thinking, we propose the formula for calculating f (D i ) in Eq. (8).

Problem formulation
Given that offloading decisions and computational resource allocation are interdependent, and that they both affect quality of service, we jointly optimize them to minimize the sum of calculation costs and energy consumption. The problem is expressed as follows: P : min e,r Σ i∈N Σ j∈V e i j ε c i j + e i j ε tr i j + nCo (9) subject to C1 : Σ j∈V e i j = 1, ∀i ∈ N (9-1) where the variables to be optimized in Eq. (9) are e and r , which represent the offloading decision and computing resource allocation, respectively. The optimization object is the sum of the calculation energy consumption, transmission energy consumption and calculation cost of the entire offloading decision scheme. C1 guarantees that each task must be executed. C2 ensures that each mobile device can perform at most one task. C3 ensures that each device performs its tasks without exceeding its own computing power. C4 and C5 ensure that each task does not exceed the maximum delay when it is executed. In order to avoid the result of meaningless optimization due to the large difference between the two target orders of magnitude, we plan to select the current maximum and minimum values of the two targets in each iteration. Then, we do dynamic min-max normalization for each of these goals.

Proposed approach
In order to solve the above optimization problem model, we propose the ANSSA. The ANSSA is an adaptive neighborhood search algorithm using SA's Monte Carlo strategy. In the neighborhood search, it has two kinds of destruction operators and three kinds of repair operators to randomly combine to produce a new solution. At the beginning, the probability of selecting each operator is equal, and as the population iteration goes on, the weight of excellent operator selection will increase. In addition, when new solutions are generated, SA's Monte Carlo solution strategy is used to decide whether to accept the new solution or not, so as to avoid falling into local optimality.

SA
The SA algorithm is a random optimization algorithm based on the Monte Carlo iterative solution strategy. The algorithm uses the Metropolis sampling strategy with probabilistic jump characteristics to perform a random neighborhood search in the solution space, with the temperature decreasing. The sampling process is repeated to finally obtain the global optimal solution or a satisfactory solution to the problem. Since we solve the problem of minimizing the objective function, according to the Metropolis criterion, the probability p that particles tend to balance at temperature T should be calculated as shown in Eq. (10).
where f is the fitness function of the individual, and Δf can be calculated using Eq. (11).
The value of T changes with the number of iterations so that the entire system reaches a stable state. The formula for changing the value of T is as shown in Eq. (12).
where T init is the initial temperature, α is the temperature decay rate, and Gen is the number of iterations.

ANS
The neighboring search (NS) algorithm is a common algorithm for improving the quality of the solution by searching the neighborhood of the current solution at each iteration. The neighborhood is implicitly defined using the destroy and repair methods. The destroy method destroys part of the current solution, and the repair method reconstructs the corrupted solution.
On the basis of the NS, the adaptive neighborhood search algorithm (ANS) uses multiple destroy and repair methods in the same search to obtain the neighborhood of the current solution. During the search process, the ANS dynamically adjusts the weights of the various destroy and repair methods to obtain a better neighborhood and solution. The specific process is as follows.
Ω − and Ω + represent a collection of destroy and repair methods, respectively. ρ − and ρ + , respectively, represent Fig. 2 The framework of the ANSSA the weight of each destroy and repair method. In the beginning, all methods use the same weight. φ − i represents the selected probability of destroy method i and φ + j represents the selected probability of repair method j. They can be calculated by Eq. (13).
In general, the greater the weight is, the greater the probability that the method will be selected. The weight size is dynamically adjusted according to the performance of the new solution in the search process of the destroy and repair methods. The update method is calculated as shown in Eq. (14).
where λ ∈ (0, 1), and i, j, respectively, represent the destroy and repair methods selected. ψ represents the evaluation criteria for the new solution and is evaluated by Eq. (15).

ANSSA
The main frame of the ANSSA is shown in Fig. 2. The main steps of the ANSSA are as follows: Step 1 Initialize the parameters, and obtain a feasible mode matrix for each dimension of the initial individual according to equations C1-C5. Then, evaluate each mode's fitness value and generate an initial individual for each dimension according to the roulette strategy, which is the initial global optimal solution X _Gbest. This is shown in Fig. 3.
Step 2 According to Eq. (13), adopt the roulette strategy and select a random combination of the destruction operator and the repair operator in the strategy pool to perform a neighborhood search on X _Gbest. This is shown in Fig. 4. Then, obtain a new solution according to Eq.(11). In addition, according to Eq. (14), the update strategy operator selects the weights until a sufficient number of individuals are generated to form the population.
Step 3 Allocate resources according to Eq. (3) and evaluate the fitness value of each individual. Return to Step 2 until the number of individuals matches the size of the population.
Step 4 Select the individual with the smallest fitness value as the local optimal solution X_Lbest. Then, compare X _Gbest with X_Lbest to select the individuals with smaller fitness values and update X _Gbest.
Step 5 Return to Step 2 and update the value of T according to Eq. (12) until the number of loops reaches the number of iterations.
Step 6 Output the current optimal solution X _Gbest and its fitness value.
The core mechanism of the ANSSA is illustrated in Figs. 3 and 4. Figure 3 shows the initial unloading strategy development process for five tasks. In Fig. 3, U indicates the tasks to be offloaded published by the mobile device, and N indicates the index of the mobile device. For example, U1 is the task published by the mobile device 1. The dotted box of Feasible Candidate Mode Sets in Fig. 3 represents the feasible unloading Mode of each task. For example, in Fig. 3, the devices available for unloading in task 4 include device 2, device 3, and MEC Server. After obtaining the feasible candidate pattern sets for each of the five tasks according to C1-C5, we determine the task priority according to the size of the feasible candidate pattern set, and the execution mode is selected first for tasks with a small set. It is worth noting that each mobile device can only be used once. In Fig. 3, the feasible set of U4 is the smallest, and so this execution mode is preferred. There are two ways to select the execution mode, namely, the roulette strategy or the sum of both the total energy consumption and calculation cost minimum mode. The execution mode of the above five tasks is selected according to the above two selection modes. According to this rule, the initial solution is generated until all task assignment patterns are calculated. Figure 4 describes the neighborhood search process using an example. First, the destruction operator that destroys two tasks according to their priority is selected from the destruction strategy set. U4 and U5 have higher priorities and are chosen to destroy the values corresponding to U4 and U5. Then, select the repair operator that conducts random repairing from the repair strategy set and assign U4 and U5 in an unordered manner. In this example, U5 is first extended to the base station, and then, U4 is extended to mobile device 3. It is worth noting that there are many destruction operators in destruction strategy set. The repair operator in the repair strategy set is based on the number of tasks destroyed, which are randomly repaired, repaired by priority or regenerated, as shown in Fig. 3.

Experimental studies
The purpose of the experiments in this section is to verify the effectiveness of the ANSSA. The data set in (Huang et al. 2019) is used in the experiment and includes the channel gain, computing power, task data size and other related information of one MEC server and two instance suites. Based on the data set, the calculation cost for the collaborative device to complete the task running unit computing resource is randomly generated. In this paper, two indicators are used to measure the quality of the experimental results, which are the run time (RT) and total consumption (TC). Note that all algorithms are implemented in MATLAB R2018b using a personal computer with an i7-8750 CPU running at 2.20 GHz (processor) and 8 GB RAM. The details are shown in Table 1. The run time is the time it takes for the algorithm to iterate 300 times and finally get the optimal solution. The total consumption is the sum of the energy consumption and the calculation cost. The experimental results are the average of the results obtained after 20 independent operations.
As shown in Figs. 5 and 6, in order to verify the validity of the ANSSA algorithm, the ANSSA is compared with the BIJOR and IANSSA using two example suites. The Bilevel Optimization Approach for Joint Offloading Decision and Resource Allocation (BIJOR) is a two-layer optimization method that is combined with ant colony algorithm in (Huang et al. 2019). Compared with the ANSSA, the Init_ANSSA (IANSSA) eliminates BIJOR's individual generation algorithm from the pool of the repair operators. Therefore, the ANNSA has a richer strategy selection pool and is more diversified than the IANSSA in solving problems.
In Figs. 5 and 6, the IANSSA has the lowest average RT for the two example suites. In other words, the solution speed is the fastest, but the average TC of the IANSSA is higher than those of the BIJOR and ANSSA. In addition, the average TC of the ANSSA is the smallest in all cases. In other words, the solution is the best, and the average RT is not very high, which means that it is an excellent algorithm. When the number of users is 200, the average TC of the IANSSA is 1.07 times that of the BIJOR and 1.10 times that of the ANSSA, but the average run time is 0.22 times that of the BIJOR and 0.38 times that of the ANSSA. When the number of users is 300, the average total cost using the IANSSA algorithm is 1.01 times that of the BIJOR and 1.04 times that of the ANSSA, but the average run time is 0.22 times that of the BIJOR and 0.33 times that of the ANSSA. However, as the number of users increases to 400, the performance of the IANSSA solution declines rapidly, although its time is still the lowest. Obviously, the IANSSA has limitations. The performance of the BIJOR is slightly worse than that of the ANNSA, but in all cases, the average RT is the largest, and it is impossible for the method to quickly obtain a better solution, which may lead to   the adverse consequence of the user having left the effective range when getting a good solution. The ANSSA combines the evolutionary strategies of the two algorithms and adopts an adaptive mechanism to improve the performance of the solution while maintaining a short running time and better adaptability to multiple scenarios.
In Fig. 7, the initial solution quality of the ANSSA is not high, but because of the diversity of the evolutionary operators and the adaptive mechanism, the ANSSA can quickly converge to the global optimal solution. However, the IANSSA can only converge to the local optimal solution. The quality of the initial solution of the BIJOR is high, but its population diversity has limitations, and it is difficult to converge to the global optimal solution. With the expansion of the number of users, this shortcoming is even more obvious. The above phenomenon can be explained as follows: the ANSSA uses a variety of neighborhood search operations to obtain a richer population based on the initial solution, but the quality of the initial solution has a greater impact on the ANSSA; therefore, the BIJOR is used as an evolutionary operator of the ANSSA. The ANSSA can not only obtain a higher quality initial solution but also fully search the solution space, escape the local optimal solution, and make the selection of multiple evolutionary operators more rational in the continuous search through its own adaptive mechanism. Therefore, it obtains the best solution performance. In this paper, we have prioritized each task for the construction of the unloading decision. To investigate the performance impact of the sorting strategy on the offloading decision build, we derive an adaptive neighborhood search based on simulated annealing algorithm-loss priority(ANSSA-LP) variant from the A-NSSA using a random sorting strategy when assigning patterns to each task. As shown in Table 2, the SRs are both 100% when n = 50 and 80. However, the ANSSA with the priority sorting strategy is always superior to the ANSSA-LP with respect to the Average TC. When the number of tasks is greater than 80, there is a significant performance difference between the ANSSA and ANSSA-LP. It can be seen that priority sorting can better generate feasible solutions, which is conducive to finding the optimal solution of the problem.

Conclusion
Aiming at the bottleneck problem of a MEC server in the field of mobile edge computing, we combine collaborative computing with mobile edge computing to propose a multiuser collaborative mobile edge computing model. Based on collaborative computing, a new indicator-the calculation cost-is first proposed to compensate for using other mobile devices, thereby further improving the rationality of the model. To solve this model, we propose the ANSSA, which adopts an adaptive mechanism to update the probability of selection according to historical experience and environmental perception. Finally, the ANSSA is compared with two other algorithms using two example suites. The experimental results show that the ANSSA can obtain satisfactory results in complex scenarios.