An Optimization Method for Mobile Edge Service Migration in Cyberphysical Power System

To relieve the pressure of processing computation-intensive applications on mobile devices and avoid high latency during data transmission, edge computing is proposed to solve this problem. Mobile edge computing (MEC) allows the deployment of MEC servers at the edge of the network to interact with users on the premise of low transmission delay, thereby improving the quality of service (QoS) for users. However, due to the high mobility of users, with the continuous change of geographical location, when users exceed the signal range of the MEC server, the services they request on the MEC server will also be migrated to other MEC servers. The handoff process may involve high response delays caused by service forwarding, thereby greatly degrading QoS. For the above problems, in this paper, a service migration optimization method based on transmission power control is proposed. First, according to the transmission power of the MEC server, the user’s activity range is divided into multiple subregions based on a Voronoi diagram. Therefore, there is one MEC server in each subregion, and the size of each subregion is adjusted by controlling the transmission power of the MEC server to minimize the number of wireless handoffs and the energy consumption of the MEC server. Then, the particle swarm optimization (PSO) is adopted to solve the above multiobjective optimization problem. Finally, the effectiveness of the proposed method is verified through extensive experiments.


Introduction
Nowadays, with the rapid development of mobile devices, mobile applications are becoming more and more complex, and mobile devices with limited resources usually cannot meet the needs of most applications. Therefore, the industry began to consider offloading such computation-intensive applications to the cloud [1]. However, the remote offloading in traditional cloud computing may involve high latency and cannot meet the low-latency requirements [2] of some latency-sensitive applications, including augmented reality (AR) and remote game control [3]. Meanwhile, the exponential growth of information caused by a large number of devices and applications has brought tremendous pressure to remote information transmission. To solve the above problems, mobile edge computing (MEC) has been proposed, and a large number of servers are placed at the network edge [4,5]. MEC is regarded as a supplement to mobile devices with relatively limited computational and storage capacity, which can enable computation offloading and provide services to users. In MEC, a new computing device called an MEC server, which is deployed on the base station to provide services and computing resources for users, is deployed at the network edge to act as a small cloud data center, giving the network edge the ability to process data [6]. Clearly, MEC servers can provide users with cloud services closer to the end-users so that users can request services with low latency.
Service providers can deploy related services on the MEC server to improve user experience, expand the user market, and earn more benefits. The reason is that the use of the MEC server helps users' mobile devices meet the performance requirements of some applications, greatly reduces information transmission delays, improves users' QoS, and reduces the traffic between users and the core network, thereby reducing operating cost. However, in the mobile edge computing environment, mobile devices often have high mobility, and service migration operations may be involved due to the time-varying location of their users. As shown in Figure 1, the edge computing system structure includes two MEC servers, MEC A and MEC B , and the signal ranges corresponding to different powers are shown in the dotted arc in the figure. While the user moves from L 1 via L 2 to L 3 , when the user walks out of the signal range of theMEC A server and enters the signal range of the MEC B server, the service requested by the user will be migrated from MEC A to MEC B . Before the end of the handoff, the user can only use the services of the MEC A . When the service request is forwarded from MEC A to MEC B through a limited capacity backhaul, the response time of the service will be significantly increased [7], resulting in a significant decrease in the quality of user experience.
Due to the limited coverage of the MEC server and the high time-varying location of users, users may switch servers frequently in the process of using mobile devices. So, the forwarding time and downtime of the request involved in this process will degrade QoS. At present, some studies propose to reduce the number and probability of service migration by deploying service copies in advance. However, at the same time point, users can only request services from one MEC server. The MEC servers that are not accessed by users but have deployed service copies will be occupied with unnecessary storage resources, resulting in a waste of resources.
In this paper, we focus on the problem of how to improve user QoS and effectively reduce server energy consumption when edge users have high mobility. Since the number of wireless handoffs and the energy consumption of the MEC are related to the coverage of the MEC server, it is necessary to reasonably control the coverage of the MEC server. However, the coverage of the MEC server is closely related to the transmission power of the MEC server. Therefore, by using transmission power control for service migration optimization, we can minimize the number of wireless handoffs and the energy consumption of an MEC server through service migration optimization. That is our motivation.
Compared with the existing methods, our main contributions can be summarized as follows: (1) A service migration optimization method is proposed based on transmission power control. This method adjusts the size of each subarea according to the transmission power of the MEC server, so as to achieve the goal of minimizing the number of wireless handoffs and energy consumption of the MEC server (2) The experimental scene is modeled by using the Voronoi diagram, and the multiobjective optimization problem is transformed into a single-objective optimization problem by using the weight coefficient transformation method. Furthermore, the PSO algorithm is used to solve the optimization problem, so as to achieve the goal of minimizing the user wireless handoff times and minimizing the energy consumption of the MEC server (3) A large number of simulation experiments were carried out using a real base station data set, the Telecom Dataset [8][9][10], under the assumption that the user's mobile path is known, which verified the effectiveness and efficiency of the algorithm in this study The remainder of this paper is organized as follows. Section 2 discusses and summarizes related work. In Section 3, we introduce the system model. After that, we introduce the PSO optimization method for minimizing the number of wireless handoffs of user equipment and minimizing the energy consumption of the MEC server in Section 4. Then, we give the experimental results and analysis in Section 5. Finally, the paper is concluded in Section 6.

Related Work
With the rapid development of the mobile Internet and the Internet of Things, a large number of delay-sensitive and computation-intensive applications have emerged. To meet 2 Wireless Communications and Mobile Computing the low-latency and high-performance requirements, edge computing was proposed to provide solutions. Since the coverage of the MEC server is limited, as the user moves, the edge nodes that the user can connect to also change. If the user's service is always located on the MEC server where the user initially connected, the user's service request should be forwarded from the MEC server to the original MEC server through the backhaul link, which will increase the service delivery delay. Therefore, in order to maintain the user QoS, the edge service should be dynamically migrated between multiple MEC servers along with the user's movement. At present, many studies have contributed to reducing service migration time. Taleb and Ksentini [11] proposed a Follow-Me Cloud (FMC) analysis model. In this work, the Markovian mobility model was proposed to analyze the performance of MEC when users move, but they did not consider whether or not services are migrated and where to migrate. In the scenario of a one-dimensional mobile model, Ksentini et al. [12] used the Markov decision process (MDP) to decide whether or not to carry out service migration by weighing the cost of service migration and the improved experience quality of users. However, their solution can be very time-consuming when MDP has a large number of states. Wang et al. [13] modeled the service migration problem as MDP and proved that when users follow a onedimensional asymmetric random walk model, the best strategy for solving service migration is the threshold strategy, and they proposed an algorithm to find the best threshold. The algorithm proposed by Wang et al. is more effective than the standard solution of MDP. In addition, in [14], Chen et al. studied the service migration problem when users follow the two-dimensional mobile model. Afterwards, Wang et al. [15] proposed a layered migration architecture (base layer, application layer, and instance layer), which can effectively reduce transmission time. Machen et al. [16] proposed a service migration method based on container handoff, which uses a hierarchical storage system to reduce synchronization overhead of the file system, thereby reducing time cost for service migration. Furthermore, Ud Din et al. [17] studied the performance optimization of edge service under the constraint of long-term service migration overhead. To solve the problem of unpredictable user movement behavior, Ouyang et al. adopted the Lyapunov optimization to decompose the long-term optimization problem into a series of real-time optimization problems.
There are also some studies dedicated to reducing the probability and frequency of service migration to achieve the objective of optimizing user QoS. To reduce the delay caused by service migration, Ma et al. [18] proposed a Cloud-Spider architecture combining placement of a virtual machine (VM) replica and VM scheduling to reduce high migration delay caused by VM image transmission through low-bandwidth wide-area network (WAN) links. They used deduplication technology to compensate for the additional storage requirements caused by the placement of replicas, and studied the VM replica placement algorithm. Besides, Ouyang et al. [19] deployed service replicas on MEC servers near users in advance, aiming to minimize the probability of service migration and the number of service replicas. Yatao et al. [20] proposed an analysis model to compare the costs of service migration and service replica deployment. The model analyzes the impact of user movement mode and service duration on migration and replication costs, respectively. The above several studies deploy service replicas on MEC servers around users in advance to reduce the probability of service migration. However, the user can only request the resources of one MEC server at the same time, and the MEC server that is not accessed by the user but has service replicas will be occupied with storage resources. Since the resources on the MEC server are limited, the backup of useless resources will cause the resource waste of the MEC server.
In terms of reducing transmission delay, controlling transmission power is an effective method because transmission power is closely related to signal quality, interference, and channel capacity. Therefore, Bose et al. [21] proposed a cloud-aware power control method to maximize the result delivery rate under the condition of satisfying the delay requirement. Since the transmission power is also related to signal coverage, for the scenario of two MEC servers in [22], the coverage of MEC servers is controlled by transmission function, and VM migration is used to achieve load balancing, so the average service delay of MEC servers is reduced. Afterwards, Zhang et al. [23] extended the previous work in [24]. In the case of multiple MEC servers, they considered the mobility of users and studied how to maximize the cost-effectiveness, that is, to minimize the number of activated MEC servers, under the condition of meeting the service delay.
In summary, based on the transmission power control technology, this paper is aimed at solving the problem of user QoS degradation caused by user mobility in a mobile edge computing environment, and uses the weight coefficient transformation method and PSO algorithm to solve the multiobjective optimization problem, which can reduce the number of wireless handoffs and service migrations of user equipment and minimize the server energy consumption.

Problems and Models
3.1. Problem Description. Here, we consider n MEC servers and m users, which form two sets E = fe 1 , e 2 , ⋯, e n g and U = fu 1 , u 2,⋯, u m g, respectively. The MEC server creates an isolated virtual machine environment for users. In order to meet the service delay requirements, we assume that the virtual machine is always placed on the MEC server connected by the user wirelessly. With the movement of users, radio network resources are also changing dynamically. So, service migration is always accompanied by wireless handoff. As a result, frequent wireless handoff and service migration will have a great impact on user experience.
Suppose there are three users u 1 , u 2 , and u 3 , and their moving paths are shown in Figure 2. The coverage radius of the MEC server e 1 is configured as r 1 and r 3 , and the coverage radius of e 2 , it is configured as r 2 or r 4 . Then, according to Figure 1, there will be four cases as follows:

Wireless Communications and Mobile Computing
Case 1. If r e 1 = r 1 , r e 2 = r 2 , user u 1 leaves the coverage area of e 1 and wireless handoff and service migration need to be performed.

Case 2.
If r e 1 = r 1 , r e 2 = r 4 , user u 1 cannot connect to any MEC server at point B.
Case 3. If r e 1 = r 3 , r e 2 = r 2 , u 1 , u 2 , and u 3 do not require wireless handoff and service migration.

Case 4.
If r e 1 = r 3 , r e 2 = r 4 , as in case 3, all users do not need wireless handoff.
In summary, when the coverage radius is small, users will make frequent wireless handoffs, and even the connection will be interrupted (for case 2). When the coverage area is large, it will cause unnecessary high energy consumption and waste of resources (for cases 3 and 4, handoff can be avoided, and a smaller coverage area can meet the demand). The coverage of the MEC server is related to its transmission power [25]. Therefore, this section will study how to set the transmission power of the MEC server, so as to minimize the number of user wireless handoffs and the energy consumption of the MEC server. In this section, it is assumed that the user is always connected to the MEC server that provides the maximum received signal strength (RSS). Therefore, in this section, the user activity area is divided into an RSS Voronoi diagram. The RSS Voronoi diagram is defined as follows: Assuming that there is a group of MEC servers E = fe 1 , e 2 , ⋯, e n g in area A, the RSS Voronoi diagram divides area A into multiple V polygons, each V polygon has an MEC server, and the points in the V polygon are defined as follows: where RSS u k e i is the received signal strength, user u k is the receiver, and MEC server e i is the sender.
The basic features of the Voronoi diagram are as follows: (1) There is a generator in each subregion Edge server User Moving path  Wireless Communications and Mobile Computing (2) The distance from the point in the subregion to the generator is less than the distances to other generators Different from the traditional Voronoi diagram, the standard of dividing the subregions is the received signal strength rather than Euclidean distance. Figure 3 is an example of the RSS Voronoi diagram, in which (1) There is one MEC server in each subregion (2) The signal strength received by the points in the subregion from the MEC server in the subregion is greater than that received from other MEC servers (3) The points on the boundary of the subarea receive the same signal strength from the MEC server that generated the boundary When the user's moving path spans multiple subregions, the user needs to perform multiple wireless handoffs. The division of subregions is related to the user's received signal strength, and the user's received signal strength is related to the transmission power of the MEC server. Therefore, the number of user wireless handoffs and service migrations can be reduced by controlling the transmission power of the MEC server. The relationship between the received signal strength of the user and the transmission power of the MEC server [26,27] is as follows: where tp e j is the transmission power of the MEC server e j in decibels (dbm), G e j and G u i are the antenna gains of the sender and receiver, respectively, H is the Rayleigh power fading coefficient, and L u i e j is the path loss between the sender and the receiver, which is calculated as follows [28][29][30]: L u i e j = L 1 + 10n 1 log 10 d e j , u i where L 1 is the path loss when the distance between the receiver and the sender is 1 meter; n 1 and n 2 are the longdistance and short-distance path loss indexes, respectively; dðe j , u i Þ is the Euclidean distance between the MEC server e j and the user u i , d b is the boundary value dividing long distance and short distance. The symbols commonly used in this section are shown in Table 1. Through the mapping M : time ⟶ location, the location of the user at any point in time can be derived, and the MEC server that the user is connected to can be obtained. According to the user's movement trajectory, the final number of user's handoffs can be obtained. Here, the user's mobile information can be obtained from many channels; for example, the user may apply map services (such as navigation). In addition, since the user's daily itinerary will not change much, the user's movement path can also be inferred through the user's past behavior. There are many studies on predicting user mobile behavior [31][32][33], which is beyond the scope of this section. In this section, it is assumed that the user's moving path is known.
As users move, MEC servers that can provide services to users are constantly changing. When the transmission power of the MEC server is low, the coverage area of the MEC server is small, causing frequent user wireless handoffs, and even  signal interruption may occur. If the transmission power is too large, the energy consumption of the MEC server will also increase. Moreover, when the MEC server has a large overlapping coverage area, the interference received by the MEC server will be too large, which in turn increases the service delay. Based on such fact, in this section, the service migration optimization problem is modeled as a multiobjective optimization problem, which is aimed at minimizing the number of user wireless handoffs and minimize the energy consumption of the MEC server.
The energy consumption of the MEC server can be expressed as follows: In formula (4), EN j is the energy consumption of MEC server e j , which is proportional to the transmission power tp j of e j , and α is an adjustable parameter.
Let C i ðt k Þ represent the MEC server that user u i is connected to at time t k , and the user is always connected to the MEC server that provides the maximum received signal strength, so C i ðt k Þ can be expressed as follows: Next, the following variables are defined: Since users can only connect to the same MEC server at a time, we can have Let Ht i represent the number of device handoffs during the user's movement, then Ht i can be expressed as follows: Therefore, in this paper, the optimization objective can be expressed as follows:

The Optimization Method
In this section, two optimization objectives are considered: minimizing the number of wireless handoffs of user equipment and minimizing the energy consumption of the MEC server. This is a multiobjective optimization problem. There are many ways to solve the multiobjective optimization problem. As in reference [34], this paper uses the weight coefficient transformation method to solve the problems raised in this section. Therefore, problem P can be transformed into problem P1: where w 1 + w 2 = 1. In this study, the PSO algorithm [34] was used to solve problem P1. Because of its simplicity and ease of implementation and the small number of parameters, the particle swarm algorithm is widely used in function optimization, neural network training, etc. In the PSO algorithm, the particle is a bird in the search space, the position of the particle is the solution to the optimization problem, and the speed of the particle determines the direction and distance of its flight. During each iteration, each particle updates its position according to its velocity. After multiple iterations, the optimal solution is finally obtained. Using PSO algorithm to solve the problem P1 mainly includes the following steps: Step 1. Randomly initialize the particle swarm position and velocity matrix: xMatrix, vMatrix. The position and velocity of each particle are n-dimensional vectors, and the position is composed of the transmission power of n MEC servers. Assuming that the transmission power range of the MEC server is ½tp min , tp max , the position of particle i is initialized to n random numbers in ½tp min , tp max , that is, x i = ðtp i1 , tp i2 , ⋯, tp in Þ, and the velocity is initialized to n random numbers in ð0, 1Þ, that is, v i = ðv i1 , v i2 , ⋯, v in Þ.
Step 2. Calculate the fitness of the particles according to formulas (4)- (8), and get the fitness matrix fitMatrix Step 3. Update the historical optimal position of each particle. In the first iteration, the historical optimal position of each particle is its random initial position p i = x i Step 4. Update the global optimal position of the group. Initially, the global optimal position of the swarm is the particle position with the smallest fitness in the particle swarm position matrix xMatrix p g = min fit ðxMatrixÞ Step 5. Update the speed and position of each particle: where w is the inertia weight, c 1 is the local learning factor, c 2 is the global learning factor, r 1 , r 2 are random numbers in ½ 0, 1.

Wireless Communications and Mobile Computing
The position of the particle is updated to: Step 6. Repeat (Steps 2-5) until the end condition is met.
The algorithm is described as follows, where iterations represents the current number of iterations, IteratorNum represents the number of iterations, and N is the size of the particle swarm:

Experimental Results and Analysis
The experimental environment is PyCharm Community Edition, the programming language is Python 3.5, and the configuration of the experimental machine is 16 G memory, core i7-4790 3.60 GHz processor, Windows 7, 64-bit operating system. The Telecom Dataset is provided by Shanghai Telecom [8][9][10]. The data set has six parameters including month, day, start time, end time, base station location, and user ID. The data set contains a total of 7.2 million records, which are records of 9,481 mobile phones accessing the Internet through 3,233 base stations. In this experiment, 10 stations of three subways in Shanghai were selected as the user's moving routes, the latitude and longitude of these 30 sites were obtained on Baidu Maps, and 8 base stations were selected near the 30 sites to provide services to users. The experiment parameters are shown in Table 2: 5.1. Experiment for PSO Parameter Selection. First, the parameters in the PSO algorithm were verified, including the impact of inertia weight w, local learning factor c 1 , global learning factor c 2 on the number of handoffs, and energy consumption. The particle swarm size was set to 10, the number of iterations was set to 100, the particle swarm algorithm was executed 20 times, and the average value was taken as the experimental result. The experimental parameter settings are shown in Table 3.
The essence of PSO is to apply formula (11) to update the velocity of particles in each iteration. Formula (11) is Input: base station location, user moving path Output: number of wireless handoffs, energy consumption Begin 1: //initialization 2: for each particle i do 3: Randomly select n numbers from the interval ½tp min , tp max as the position x i of i 4: Randomly select n numbers from the interval ð0, 1Þ as the speed v i of i 5: Apply formulas (4)-(8) to evaluate particle i 6: The historical optimal position of particle ip i = x i 7: end for 8: Global optimal position p g = min fit fp i g 9: while iterations < IteratorNum do: 10: for i = 1 to N do 11: Apply formula (11) to update velocity of particle i 12: Apply formula (12) to update position of particle i 13: // Update p i and p g 14: if fitðx i Þ < fitðp i Þ do 15: if fitðp i Þ < fitðp g Þ do 17: p g = p i 18: end for 19: end while End Algorithm 1: PSO algorithm to solve problem P1.  7 Wireless Communications and Mobile Computing composed of three items: memory item, self-cognition item, and group recognition item. The inertia weight w determines the influence of the speed in the previous iteration on this iteration. To study the influence of the inertia weight w on the experiment, the values of other parameters are fixed: c 1 = c 2 = 2, w changes from 0.1 to 0.9, and the step size is 0.1. The experimental results are shown in Figure 4.
The figure above shows that, as the value of w increases, the trend of the number of handoffs is slowly increasing and then decreasing sharply. The minimum value is obtained when w = 0:8, and the minimum value is close to 8. The energy consumption drops first and then rises. When the energy consumption is small, the power of the MEC server is small and the coverage area is small, so the number of handoffs is relatively high. Therefore, when w = 0:5, the energy consumption achieved the minimum value, and the number of handoffs is 9.55, which is at a relatively high level.
In this study, 20 repeated experiments were performed and the average value was taken as the result, so the number of handoffs may be a decimal.
The local learning factor c 1 and the global learning factor c 2 are the weights of self-cognition items and group recognition items. The purpose of the self-cognition item is that the speed of particles is affected by one's own experience. The group cognition item reflects the influence of knowledge sharing between particles on finding the optimal solution. To study the influence of these two parameters on the experiment, w = 0:5 was set and c 1 , c 2 were set to range from 0.5 to 4, and the step length was 0.5. The experimental results are shown in Figures 5 and 6.
In Figure 5, the number of user handoffs decreases as the value of c 1 increases, while the energy consumption shows a fluctuating upward trend. The influence of the global learning factor on the number of user handoffs and the energy  Figure 5. The number of user handoffs and the MEC server energy consumption have a similar trend, and both decrease first and then increase. When c 2 = 3, the number of user handoffs achieves the extreme value, and when c 2 = 1:5, the energy consumption achieves the optimal value. In Figure 6, the experimental results show that the two evaluation indicators of number of handoffs and energy consumption cannot reach the optimal value at the same time. In order to balance these two evaluation indicators, the parameters of PSO were set as w = 0:8, c 1 = 3, and c 2 = 1.

Comparative Analysis of Experiment
Results. This experiment was compared with the following two algorithms: (1) Genetic algorithm (GA) [24]: the genetic algorithm searches for the optimal solution of the problem by simulating the natural evolution process. The main steps are as follows: (1) initialize the population, (2) assess the individual fitness value, (3) select, (4) crossover, (5) mutate, and (6) repeat (2)-(5) until the end conditions are met (2) Simulated annealing algorithm (SA) [25]: the principle of solid annealing is the theoretical basis of the simulated annealing algorithm. A solid is heated to a sufficiently high temperature, and then slowly cooled. During cooling, the particles are gradually ordered, and finally the internal energy is the smallest at room temperature. The basic steps of the simulated annealing algorithm are as follows: (1) initialize the solution T old ; (2) generate a new solution T new ; (3) apply the evaluation function to evaluate T old and T new ; (4) if T new is better than T old , replace T old with T new , otherwise, accept T new with a certain probability; (5) repeat (2)-(4) until the end condition is met. The parameters of the simulated annealing algorithm were set as number of iterations = 100, initial temperature = 100, attenuation factor = 0:85, and probability of accepting the difference = exp ð−Δt/tÞ, where Δt is the difference between T new and T old , and t is the current temperature Three subway routes in Shanghai were selected as the user's movement trajectory. For each subway line, 10 stations were selected, and 8 base stations were selected around these 30 stations to provide services to users. Then, the influence of the number of sites on the number of handoffs and energy consumption was studied. Figure 7 is the result of the comparison of the three algorithms. Figure 6(a) shows that, for the three algorithms, the difference in the number of handoffs is small and the results and trends of PSO and SA are very similar. When the number of stations is 20 and 25, the number of handoffs calculated by the two are equal. When the number of stations is less than 20, PSO is slightly better than SA. GA has the worst performance in the number of handoffs, and only when the number of sites is 25 is it better than SA and PSO. The performance of the three algorithms in terms of energy consumption is shown in Figure 6(b). The energy consumption increases as the number of sites increases. Obviously, the results calculated by PSO are optimal in terms of energy consumption. Finally, these three algorithms were also measured from the running time. Although GA performs poorly in the number of handoffs and energy consumption, its execution time cost is the lowest. Although PSO has a slight advantage over SA in the number of handoffs and energy consumption, its execution time cost is much lower than SA. Therefore, PSO can effectively solve this multiobjective optimization problem.

Conclusion
Deploying services on edge nodes can bring computing and storage resources closer to users, thereby reducing service delays and improving user experience. However, the dynamic feature of user equipment in mobile edge computing has led to Since the edge nodes communicate through the backhaul link, the service forwarding between the edge nodes will cause a high delay, which leads to a significant reduction in the quality of user experience. Therefore, reducing service migration is a very important task.
The study considers the use of transmission power control technology to reduce the number of service migrations during user movement. Under the assumption that the user's moving route is known, the edge node of the user's wireless connection is controlled through the transmission power of the MEC server, so the number of wireless handoffs during the user's movement is reduced. Meanwhile, in order to avoid energy waste caused by excessive transmission power, minimizing the energy consumption of the MEC server is also regarded as an optimization objective. The multiobjective optimization problem is transformed into a single-objective problem through the weight coefficient conversion method, and then the PSO algorithm is used to solve the problem. The experimental results show the effectiveness of the PSO algorithm in this multiobjective optimization problem.

Data Availability
All of the data used in this study are already available on the Internet and is easily accessible.

Conflicts of Interest
The authors declare that they have no conflicts of interest.   Wireless Communications and Mobile Computing