Edge service dynamic migration method based on improved whale optimization algorithm
By improving the whale optimization algorithm and long-term memory network to predict user location, the problems of high computing costs and overfitting in dynamic migration of edge services are solved, lower service migration energy consumption and delay are achieved, and the algorithm solution accuracy and convergence speed are improved.
Patent Information
- Application Number
- CN202411905189.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art has problems such as high computational cost, over-heavy dependence on training data, over-fitting phenomenon and local optimal solution traps in dynamic migration of edge services.
The edge service dynamic migration method based on the improved whale optimization algorithm is adopted to optimize edge service migration strategies through long and short-term memory networks, dynamic adaptive iteration termination judgment, adaptive dynamic fluctuation nonlinear convergence and taboo search.
It effectively reduces the energy consumption and delay of service migration, improves the algorithm's solution accuracy and convergence speed, and avoids local optimal solution and overfitting.
Smart Images

Figure CN119997103A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer network technology, and in particular to an edge service dynamic migration method based on an improved whale optimization algorithm. Background Art
[0002] Mobile Edge Computing (MEC) refers to sinking part of the computing, storage and other capabilities of the data center in mobile cloud computing to the edge of the network, that is, close to the user's physical location, so that the user's request can be processed and the result can be returned by the MEC server at the edge of the network. When a user requests an edge service on the MEC server, due to the limited service coverage of the MEC server, if the user's location exceeds the coverage of the current MEC server during the movement, the service response time will be too long or even interrupted. At this time, it is necessary to dynamically migrate the edge service requested by the user to other MEC servers that can provide high-quality services during the user's movement. How to achieve dynamic migration of edge services requested by users is a research hotspot in the field of mobile edge computing.
[0003] The current mainstream edge service dynamic migration methods include methods based on deep reinforcement learning and methods based on heuristic algorithms.
[0004] The edge service dynamic migration method based on deep reinforcement learning refers to extracting complex state features from raw data through deep learning, and then determining the best time and target location for migration through reinforcement learning. Although the edge service dynamic migration method based on deep reinforcement learning has strong environmental adaptability and the ability to continuously learn and optimize, this method requires a lot of computing resources for training, and the computing cost will be high when dealing with large-scale problems. In the study of this problem, the data of users during the movement is random, and the scene conditions are different. The deep reinforcement learning model requires multi-faceted data features for effective model training so that the intelligent agent can make the best decision in a complex environment. Therefore, the edge service dynamic migration method based on deep reinforcement learning is too dependent on training data, and the training results are prone to overfitting, resulting in unstable quality of migration results.
[0005] The edge service dynamic migration method based on heuristic algorithm refers to the use of heuristic algorithm to solve the edge service dynamic migration problem. Heuristic is a method of continuously searching for feasible solutions in the solution space. The edge service dynamic migration problem is essentially a process of optimizing a feasible solution, so many experts and scholars choose to use heuristic algorithms to solve the edge service dynamic migration problem. For example, some scholars use a service dynamic migration strategy based on particle swarm algorithm to jointly optimize the allocation of computing and communication resources, while satisfying the user's computing delay constraints and minimizing its total energy consumption. The dynamic migration of edge services is a complex problem. It is necessary to fully consider multiple factors such as the resources required for service requests, the dynamic changes in user locations, and the distribution of server resources, and comprehensively derive the service migration direction and server selection plan. The edge service dynamic migration method based on heuristic algorithm can effectively solve the edge service migration problem. By constructing the objective function and selecting the optimal strategy from the feasible solutions, the optimal service migration strategy in the multi-user scenario can be obtained. However, this type of algorithm has the problems of not being able to guarantee the global optimal solution, being prone to falling into the local optimal solution, being difficult to adjust parameters, and having a slow convergence speed.
[0006] WOA (Whale Optimization Algorithm) has the advantages of strong global search capability, small number of parameters, self-adaptation and high parallelism, but it is sensitive to parameters and is prone to fall into local optimal solutions in the later stages of iteration. The Tabu Search Algorithm can quickly locate and improve local optimal solutions and avoid cyclic searches, but it consumes a lot of computing resources, has a slow convergence speed, and requires additional computing and storage resources. Summary of the invention
[0007] In view of the shortcomings of the prior art, the present invention provides a method for dynamic migration of edge services based on an improved whale optimization algorithm. The present invention performs dynamic migration of edge services for multiple users, performs dynamic migration of services based on the prediction of user locations, and takes reducing service migration energy consumption and reducing service migration delay as optimization goals, which is more in line with real scenarios.
[0008] The technical means adopted by the present invention are as follows:
[0009] The present invention discloses a method for dynamic migration of edge services based on an improved whale optimization algorithm, comprising the following steps:
[0010] S1. Obtaining user service request information and edge server information, wherein the user service request information includes user current location information, user historical location information and service information, and the edge server information includes location information of each edge server;
[0011] S2, inputting the user's current location information and historical location information into a long short-term memory network, wherein the long short-term memory network is used to predict the user's location information at the next moment;
[0012] S3, judging whether the user is about to exceed the coverage of the current server based on the predicted location information of the user at the next moment, if it is judged that the user will not exceed the coverage of the current server at the next moment, executing step S7, otherwise executing step S4;
[0013] S4, determining a service migration location point based on the user location information predicted by the long short-term memory network;
[0014] S5. Filter out a set of edge servers that can cover the service migration location point based on the location information of the edge server;
[0015] S6. Construct an edge service dynamic migration model with minimizing the total cost of service migration as the optimization goal, and solve the edge service dynamic migration model based on the improved whale optimization algorithm;
[0016] S7. Determine whether the service request has ended or the user has reached the destination. If the edge service has not been completed or has reached the destination, the next moment the user moves to is taken as the current moment, and the process goes to step S2 to continue predicting the user's location at future moments and find the location point closest to the user that is beyond the coverage of the current edge server. If the service is completed or the user has reached the destination, the user location prediction and service migration work are terminated.
[0017] Furthermore, the improved whale optimization algorithm makes the following improvements to the traditional whale optimization algorithm:
[0018] Dynamic adaptive iteration termination judgment is performed based on the correlation between the number of iterations and the fitness value;
[0019] Update the convergence factor based on the adaptive dynamic fluctuation nonlinear convergence method;
[0020] A taboo table is set during the population optimization process to avoid repeated searches.
[0021] Further, based on the correlation between the number of iterations and the fitness value, dynamic adaptive iteration termination judgment is performed, including: calculating the fitness value angle according to the following formula:
[0022]
[0023] Among them, f Gen Represents the optimal fitness value at the Gen-th iteration, μ represents the average fitness value in the fitness value set, and h represents the length of the fitness value set.
[0024] Further, updating the convergence factor based on the adaptive dynamic fluctuation nonlinear convergence method includes: calculating the convergence factor according to the following formula:
[0025]
[0026] Among them, a0 represents the current convergence factor, Gen is the current number of iterations, and MaxIt is the maximum number of iterations.
[0027] Furthermore, the edge service dynamic migration model is:
[0028]
[0029] Among them, Tcost n,m It represents the service migration delay of the nth user’s service request to the mth MEC server, Ecost n,m represents the energy consumption of service migration performed by migrating the service request of the nth user to the mth MEC server, x n,m Indicates whether the service of the nth user is executed on the mth MEC server, λ t , e Represents the weight coefficients of service migration delay and energy consumption, Tup n,m Tdeal is the service request transmission delay n,m The latency of executing services for MEC servers, Twait n,m The waiting delay for the service to be processed on the MEC server, Eup n,m Transmitting energy consumption for service requests, Edeal n,m Energy consumption for executing services for MEC servers, Ewait n,m The waiting energy consumption of the service waiting to be processed on the MEC server, c n,m Represents user U n The computing resources occupied by the service on the mth MEC server, rcmec m Represents the computing resources of the mth server.
[0030] Furthermore, the user's location information is predicted based on the long short-term memory network, including:
[0031] The predicted user location information is used as the input data of the long short-term memory network to continuously predict the location information of several users.
[0032] Further, determining the service migration location point based on the user location information predicted by the long short-term memory network includes:
[0033] From the predicted user locations at several future moments, in order from farthest to closest to the user's current location, find the location closest to the user that is beyond the coverage of the current edge server as the service migration location point.
[0034] Compared with the prior art, the present invention has the following advantages:
[0035] The present invention proposes a method for dynamic migration of edge services based on an improved whale optimization algorithm. The method performs dynamic migration of edge services for multiple users, and performs dynamic migration of services based on the prediction of user locations, with the goal of reducing service migration energy consumption and service migration delay as optimization goals, which is more in line with real scenarios. In terms of algorithms, the whale optimization algorithm is improved from three aspects: dynamic adaptive iteration termination judgment, adaptive dynamic fluctuation nonlinear convergence, and taboo search: first, a dynamic adaptive iteration termination judgment method is proposed, which associates the number of iterations with the fitness value, avoiding excessive iterations when the algorithm does not reach the target value; then, an adaptive dynamic fluctuation nonlinear convergence method is proposed to help the algorithm avoid falling into a local optimal solution and improve the accuracy of the algorithm solution; finally, a taboo search method is introduced to improve the convergence speed of the algorithm and the ability to develop better solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0037] Figure 1 This is a flow chart of a method for dynamic migration of edge services based on an improved whale optimization algorithm in an embodiment of the present invention.
[0038] Figure 2 1 is a diagram showing the structure of a long short-term memory network in an embodiment of the present invention.
[0039] Figure 3 This is a cost function comparison diagram for performing service migration using the method of the present invention and the comparative method in the present invention. DETAILED DESCRIPTION
[0040] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0041] The present invention proposes a method for dynamic migration of edge services based on an improved whale optimization algorithm. The method solves the problem that the user's location exceeds the service coverage of the current server during the migration process, causing service quality degradation or service interruption. The following describes the process of the method using a user as an example. Figure 1 The method mainly comprises the following steps:
[0042] Step 1: Obtain the user's service request information and edge server information
[0043] The present invention considers the problem of dynamic migration of edge services of multi-user and multi-edge servers in an edge scenario, which consists of a gateway, a cloud data center, M edge servers and N users who need to perform service migration.
[0044] Multiple edge services are deployed on each edge server, such as ticket booking service, restaurant recommendation service, scenic spot recommendation service, etc. The user set is represented as U = {U1, U2, ..., U n ,...,U N}, 1≤n≤N, where U n represents the nth user; the server set is represented as MEC = {MEC1, MEC2, ..., MEC m ,...,MEC M}, 1≤m≤M, where MEC m Represents the mth edge server.
[0045] The user's service set is represented as S = {S1, S2, ..., S n ,...,S N}, 1≤n≤N, where S n Represents the service of the nth user. Assume that an edge server is placed in each area, and ensure that all areas are covered by at least one edge server. Each edge server has a certain amount of computing resources for computing user services, and each edge server has a certain amount of storage capacity for storing cached resources. Each area has a corresponding set of historical user request sequences for resources, and users in each area can send service requests to the local edge server in their area. Each service has a corresponding historical data request sequence on each edge server. n The service is assigned to the mth edge server for execution, denoted by x n,m (1≤n≤N,1≤m≤M).
[0046] Step 2: Predict the user's location at a future moment based on LSTM
[0047] In order to provide mobile users with personalized high-quality edge services and enable them to obtain services that meet their needs in a timely and accurate manner at the edge, the present invention uses an LSTM (Long Short-Term Memory) model to predict the user's location at a future moment based on the user's historical and current location, and then performs service migration based on the predicted user location at a future moment.
[0048] The LSTM model is a special recurrent neural network (RNN) that is widely used in sequence modeling tasks. The LSTM network structure consists of multiple LSTM units, each of which represents a time step. The LSTM model controls and manages the flow of information through a gating mechanism. Through the interaction of various gates, the LSTM model can selectively memorize and forget information when processing sequence data, thereby better capturing long-term dependencies in the sequence.
[0049] An LSTM unit consists of a cell state and a hidden state. The cell state is responsible for storing and transmitting information, while the hidden state is used for external output. During the LSTM training process, for each time step, LSTM receives input, saves the state of the previous time step, updates the cell state, and outputs the prediction result of the current time step. The structure of the LSTM unit is as follows Figure 2 shown.
[0050] Figure 2 In the example, t represents the current time step, x t is the input of the current time step t; h t-1 , C t-1 is the hidden state and cell state at the previous time step t-1; σ is the Sigmoid activation function, which maps the input to a value between 0 and 1; W f , W i , W c , W o is the weight matrix; b f , b i , b c , b o is the bias vector; f t 、i t , O t are the gate values of the forget gate, input gate, and output gate at the current time step t respectively; C t 、h t are the candidate cell state, cell state, and hidden state at the current time step t, respectively; tanh is the hyperbolic tangent function, which maps the input to a value between -1 and 1.
[0051] The workflow of the LSTM unit is as follows:
[0052] (1) Calculate the forget gate value f t The forget gate determines which information is discarded from the cell state, and its gate value calculation formula is shown in formula (1).
[0053] f t =σ(W f [h t-1 ,x t ]+b f ) (1)
[0054] (2) Calculate the input gate value i t When new input enters the LSTM network, the input gate determines which information is retained, and the gate value calculation formula is shown in formula (2).
[0055] i t =σ(W i [h t-1 ,x t ]+b i ) (2)
[0056] (3) Calculate candidate cell states The candidate cell state indicates how much influence the input at the current time step has on the cell state. The calculation formula of is shown in formula (3).
[0057]
[0058] (4) Update cell status C t The cell state is updated according to the results of the forget gate and the input gate. The update formula is shown in formula (4).
[0059]
[0060] (5) Calculate the output gate value O t The output gate controls which information should be output, and the gate value calculation formula is shown in formula (5).
[0061] O t =σ(W o [h t-1 ,x t ]+b o ) (5)
[0062] (6) Calculate the hidden state h t The calculation formula is shown in formula (6).
[0063] h t =O t ×tanh(C t ) (6)
[0064] In the present invention, according to the predicted longitude and latitude of the user location h t and historical latitude and longitude h t-1 、h t-2 Use the velocity formula and acceleration formula to calculate h t The corresponding velocity and acceleration, and h t The corresponding speed and acceleration are used as the current user location information and input into the LSTM prediction model to predict the user location at the next moment. By analogy, the longitude and latitude of the user location at multiple moments in the future can be continuously predicted.
[0065] It was found in the experiment that when the longitude and latitude of the user's location were predicted continuously for five moments, the location error was within an acceptable range, and each time a service dynamic migration strategy was derived through data and models, a corresponding amount of time was required. The time interval of five moments was proved by experiments to meet the needs of dynamic migration of edge services. Therefore, the present invention will predict the longitude and latitude of the user's location at the next five moments at a time, and in the next step, determine whether the user is about to exceed the current server coverage based on the predicted user location at the next five moments.
[0066] Step 3: Determine whether the user is about to go beyond the current server coverage
[0067] First, a method for determining whether the user's location at a certain moment is beyond the coverage of the current server is given as follows:
[0068] Assume that the nth user U n The longitude and latitude of the position at time t is The location longitude and latitude of the mth edge server is (lat m ,lon m ), whose service radius is r m The commonly used formula for calculating the distance between two points on the earth is the Haversine formula. First, the difference in latitude and longitude between the two points is calculated, as shown in formulas (7) and (8).
[0069]
[0070] The two differences are converted into radians, and the Haversine formula is used to calculate the spherical distance c between the two points, as shown in formulas (9) and (10), where atan2 is the inverse tangent function, which takes into account the positive and negative and quadrant issues.
[0071]
[0072] The actual distance between the two points is then calculated using the average radius of the earth, R (approximately 6371 km), as shown in formula (11).
[0073] d=R·c·1000 (11)
[0074] When d>r m , the user's location is beyond the coverage of the current server.
[0075] Next, select a location from the five user locations predicted in step 2 in order from far to near to the user to determine whether it is beyond the coverage of the current server. If none of the five locations is beyond the coverage of the current edge server, it means that the location is still within the coverage of the current server, and go to step 7; otherwise, after finding the location point closest to the user that is beyond the coverage of the current edge server, go to step 4.
[0076] Step 4: Determine the service migration location
[0077] In step 3, the location closest to the user and beyond the coverage of the current edge server is found from the predicted user locations at the next five moments in the future in the order from far to near. The present invention uses this location as the service migration location point (lat n ,lon n ).
[0078] Step 5: Obtain a set of edge servers that can cover the service migration location
[0079] After determining the edge service migration location, based on the edge service migration location, the location of all edge servers from the user to the target area, and the server service radius, determine whether the distance from the predicted edge service migration location to each edge server location is less than the server coverage radius, thereby obtaining a set of edge servers that can cover the predicted edge service migration location.
[0080] The edge server discovery algorithm based on user location is shown in Algorithm 1. Since the server discovery process for each user is the same, Algorithm 1 performs edge server discovery for a single user.
[0081]
[0082]
[0083] Step 6: Make edge service migration decisions based on the improved whale optimization algorithm
[0084] The dynamic migration of edge services is a complex problem in itself, and it is necessary to consider many factors to come up with the final service migration strategy. Therefore, the multi-objective optimization algorithm is more suitable for solving the problem of dynamic service migration. The Whale Optimization Algorithm (WOA) is a heuristic algorithm inspired by the collective action of whale groups. Compared with traditional heuristic algorithms, it has the advantages of strong global search ability, strong adaptability, parallelism, and simple implementation.
[0085] In order to obtain a dynamic migration scheme for edge services with low service migration delay and low service migration energy consumption, the present invention comprehensively considers factors such as service migration delay and service migration energy consumption, and takes minimizing the total cost of service migration as the optimization goal. The algorithm updates the position of each individual through searching for prey, surrounding prey, and attacking with a bubble net, and adjusts the step size of the individual by the ratio of the current number of iterations to the maximum number of iterations to control the convergence speed of the search process. In the update process, the individual with the best fitness in the current population is selected as the global optimal solution, and multi-objective optimization is achieved through iterative operations. However, the traditional WOA algorithm has the problems of slow convergence speed, easy to fall into local optimality in the late iteration, and insufficient solution accuracy.
[0086] The present invention proposes dynamic adaptive iteration termination judgment, adaptive dynamic fluctuation nonlinear convergence and taboo search to improve the traditional WOA algorithm, and then adopts the improved whale optimization algorithm to solve the dynamic migration problem of edge services to obtain an optimized migration strategy.
[0087] (1) Dynamic Adaptive Iteration Termination Judgment
[0088] Traditional heuristic algorithms can only end their operation when the target value is achieved or the maximum number of iterations is reached. This ending method can only achieve the best effect when the iteration is terminated when the target value is reached, but this method is prone to iteration waste after reaching the target value. The dynamic adaptive iteration termination judgment proposed in the present invention iteratively updates and stores the current optimal fitness value result each time, takes one-fourth of the maximum number of iterations as the storage set length, stores the latest fitness value, and then calculates the fitness value angle through the inverse tangent function. If the angle is less than 0.1, it means that the subsequent iterations of the algorithm have too low cost performance, and then the optimization is jumped out. If a better result is found during the optimization process, it means that the algorithm is jumping out of the local optimal solution and the number of iterations is recalculated.
[0089] Therefore, the dynamic adaptive iteration termination judgment proposed in the present invention associates the number of iterations with the fitness value, which not only avoids excessive iteration waste when the algorithm fails to reach the target value, but also improves the iteration cost-effectiveness.
[0090] The fitness value angle calculation formula is shown in formula (12), where f GenRepresents the optimal fitness value at the Gen-th iteration, μ represents the average fitness value in the fitness value set, and h represents the length of the fitness value set.
[0091]
[0092] (2) Adaptive dynamic fluctuation nonlinear convergence
[0093] In the traditional WOA algorithm, since the optimal position in the search space is unknown, the WOA algorithm assumes that the current best candidate solution position is the target prey position. After the target prey position is defined, other whales will try to surround the target prey position. The calculation formulas of this process are shown in formulas (13), (14), (15), and (16).
[0094] X(Gen+1)=X * (Gen)-A×D (13)
[0095] A=2×a×ra (14)
[0096] D=|C×X * (Gen)-X * (Gen)| (15)
[0097] C=2×r (16)
[0098] Among them, X(Gen+1) is the initial position of the whale in the next iteration, Gen is the number of current iterations, r is a random value in the interval [0,1], D represents the enclosing step length, A and C are coefficients, and X *(Gen) is the position of the current optimal solution, and a is a parameter that gradually approaches 0 from 2. The change of a value will affect the contraction range, and finally gradually contract to the optimal solution. Therefore, the a value affects the global exploration and local development of the whale optimization algorithm. When a is large, it has a strong global search ability and is easy to jump out of the local optimum, but its local development ability is weak, resulting in a decrease in convergence speed. On the contrary, if a is small, its local development ability is strong, the convergence speed is accelerated, but it is easy to fall into the local optimum. In the traditional WOA algorithm, a decreases linearly from 2 to 0, and there are often multiple local optimal values in complex optimization problems. The linear decreasing strategy will affect the ability of the algorithm to jump out of the local optimum. Therefore, the present invention proposes an adaptive dynamic fluctuation nonlinear convergence method. Every time the algorithm finds a better solution, it changes the Gen value to 1, assigns the current a value to a0, and then updates the a value according to the values of Gen and a0. In the early stage of iteration, a has a large value and a strong global exploration ability, which is conducive to avoiding the algorithm from falling into the local optimal solution. In the later stages of iteration, the a value decays to a smaller value, and the local development capability is stronger, which is conducive to enhancing population convergence. Each time the algorithm finds a better solution, it means that the algorithm still has the ability to develop a better solution. By updating the a value, the a value decay speed is reduced, and the global exploration capability is enhanced, thus helping the algorithm to jump out of the local optimal solution.
[0099] Changing the convergence factor reduces the convergence speed. When a better solution is not found, the convergence speed will become faster and faster. This method not only balances the capabilities of local search and global search, but also improves the probability of the algorithm jumping out of the local optimal solution and the accuracy of the solution. The calculation formula of a is shown in (17). The initial value of a0 is 2. As the iteration is updated to the value of a, Gen is the current number of iterations, and MaxIt is the maximum number of iterations.
[0100]
[0101] (3) Taboo Search
[0102] The traditional WOA algorithm's shrinking and encircling prey and bubble net attack hunting methods are to independently search for the best by multiple populations, and repeated searches are inevitable in the search process. Therefore, the concept of taboo search is introduced, and a taboo table is set in the population optimization process to avoid repeated searches, thereby improving the algorithm's convergence speed. By randomly mutating repeated populations, the algorithm's ability to develop better solutions is improved.
[0103] (4) Construction of edge service dynamic migration model
[0104] Assume that there are N users who need to migrate services. During the migration and switching process, the edge service migration point and the service fragment of the nth user have been determined before the migration. Therefore, the present invention determines the migration strategy for one migration, that is, the problem to be solved is to migrate the service fragments of N users to M MEC servers.
[0105] The present invention uses service migration delay Tcost and service migration energy consumption Ecost to calculate the total cost of service migration for N users, and takes minimizing the total cost of service migration as the optimization goal to solve the edge service dynamic migration strategy.
[0106] Next, we take the nth user U n This article takes the migration of a service request to the mth MEC server as an example to introduce the calculation of service migration latency and energy consumption.
[0107] 1) Service migration delay calculation
[0108] The service migration delay includes the service request transmission delay, service execution delay and service waiting delay. The smaller the service migration delay, the better the effect. Suppose the service migration delay of the nth user's service request to be migrated to the mth MEC server is Tcost n,m , which is calculated as shown in formula (18).
[0109] Tcost n,m =Tup n,m +Tdeal n,m +Twait n,m (18)
[0110] Among them, Tup n,m Tdeal is the service request transmission delay; n,m The delay in executing services for the MEC server; Twait n,m It is the waiting delay of the service waiting for processing on the MEC server, that is, the waiting delay caused by insufficient MEC server resources due to multiple service requests arriving at the MEC server at the same time. The waiting delay of the service is the difference between the start execution time of the service and the arrival time of the service request.
[0111] 2) Calculation of energy consumption of service migration
[0112] The service migration energy consumption includes the service request transmission energy consumption, the service execution energy consumption on MEC and the service waiting energy consumption. n The energy consumption of service migration performed by migrating the service request to the mth MEC server is Ecost n,m , which is calculated as shown in formula (19).
[0113] Ecost n,m =Eup n,m +Edeal n,m +Ewait n,m (19)
[0114] Among them, Eup n,m Transmitting energy consumption for service requests, Edeal n,mEnergy consumption for executing services for MEC servers, Ewait n,m The waiting energy consumption of services waiting to be processed on the MEC server.
[0115] 3) Calculation of total cost of service migration
[0116] The total cost of migrating services for N users to M MEC servers is calculated as shown in formula (21).
[0117]
[0118] Among them, x n,m The value of x is 0 or 1. n,m =1(m≠0) means the nth user U n The service is executed on the mth MEC server. If x n,m = 0 (m≠0), it means the nth user U n The service is not executed on the mth MEC server, and a service can only select one MEC server for migration. t , e Represent the weight coefficients of service migration delay and energy consumption respectively. The size of the two weight coefficients depends on the specific needs of the service to be migrated. For example, if the energy consumption of the service is too large, the power and memory capacity of the user device will be quickly exhausted. In this case, the energy consumption weight coefficient λ of the service migration can be specified. e Slightly larger; if the current service is delay-sensitive, the delay weight coefficient λ of the service migration can be t Specify slightly larger.
[0119] 4) Edge service dynamic migration model
[0120] The present invention constructs an edge service dynamic migration model with minimizing the total cost of service migration as the optimization goal, as shown in formula (22).
[0121]
[0122] Let the two-dimensional matrix X = {x n,m},1≤n≤N,1≤m≤M, then each element of X stores a set of service migration strategies for migrating N services to M MEC servers. C1 restricts a service to only one location for migration, C2 represents that the weight coefficient of service migration delay and energy consumption of each service is added to 1, and C3 represents that each MEC server cannot process services that exceed its computing resources at the same time, where c n,m Represents user U n The computing resources occupied by the service on the mth MEC server, rcmec m Represents the computing resources of the mth server.
[0123] (5) Solving the edge service dynamic migration model based on the improved whale optimization algorithm
[0124] The present invention adopts the improved whale optimization algorithm to solve the edge service dynamic migration model. The corresponding relationship between the improved whale optimization algorithm and the element of the edge service dynamic migration model is shown in Table 1.
[0125] Table 1 Element correspondence table
[0126]
[0127] The pseudo code of the edge service dynamic migration model solution algorithm based on the improved whale optimization algorithm is shown in Algorithm 2. Assuming that there are N users who want to migrate services, Algorithm 2 solves the service migration decision for these N users.
[0128]
[0129]
[0130]
[0131] Step 7: Determine whether the service request has ended or the user has reached the end point
[0132] If the edge service is not completed or reaches the end point, the next moment the user moves to is taken as the current moment, and the process goes to step S2 to continue predicting the user's location at future moments and find the location point closest to the user that is beyond the coverage of the current edge server; if the service is completed or the user reaches the end point, the user location prediction and service migration work are terminated.
[0133] In order to verify the effectiveness of the method of the present invention, experimental comparisons are carried out with the particle swarm algorithm (PSO), the grey wolf algorithm (GWO) and the original whale optimization algorithm (WOA), and the experimental results are demonstrated by the cost function value.
[0134] (1) Datasets and Experimental Evaluation Indicators
[0135] The present invention selects a mixed dataset of Geolife dataset, GWA-T-12 and Hohai University dataset. In this model, location information, CPU frequency and service data size need to be considered, so the above three datasets need to be fused. The present invention fuses the above three datasets according to the following rules:
[0136] 1) For service request data, the service request data size and the user location to which the service belongs are obtained through the edge service request information and user location information provided by the Hohai University dataset;
[0137] 2) For the MEC server data, the location information provided by the Hohai University dataset and the maximum CPU frequency provided by the GWA-T-12 dataset are randomly combined one by one;
[0138] 3) For the user group, the walking and running datasets of Hohai University are combined and pieced together. The edge server is deployed according to the user location, and then the server location information is randomly matched with the maximum CPU frequency provided by the GWA-T-12 dataset.
[0139] Finally, the service dataset contains the edge service request size information and user location information provided by the Hohai University dataset. The MEC server dataset also contains the location information provided by the Hohai University dataset and the maximum CPU frequency provided by the GWA-T-12 dataset. The user location prediction model uses the Geolife dataset for user location prediction training.
[0140] The evaluation index used in the comparative experiment is: cost function value. The cost function value is the value obtained by normalizing the service migration delay and the service migration energy consumption.
[0141] (2) Comparative experiment
[0142] Experimental comparisons were conducted on a 13th Gen Intel(R) Core(TM) i7-13700H processor and Windows 11 operating system to verify the effectiveness of the proposed method. The comparison algorithms include particle swarm optimization (PSO), grey wolf algorithm (GWO) and the original whale optimization algorithm (WOA).
[0143] The number of services has a great impact on the performance of the algorithm. Therefore, the present invention conducts experiments under different service numbers. Four groups of experiments are conducted on the four methods under the conditions of 50, 100, and 150 service numbers. Each group of experiments is run 20 times, and the average value is taken as the experimental result. The experimental results are compared in Figure 3 .
[0144] Experimental results show that the cost function value of the method of the present invention is lower than that of the other three methods. And as the total number of services increases, the advantages of the method of the present invention continue to expand. This is because as the total number of services increases, the number of services that need to be migrated also increases, and when the number of MECs and the maximum number of computing resources that MEC can provide remain unchanged, the competition between services also increases with the increase in the number of services, and the situation where multiple services select the same MEC server at the same time will increase, which will also generate larger waiting delays and waiting energy consumption. The method of the present invention improves the whale optimization algorithm in three aspects, which improves the algorithm's solution accuracy, solution efficiency, and the ability to develop better solutions, helping users find servers with lower costs. Therefore, the method of the present invention can obtain a more cost-effective dynamic migration solution for edge services.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for dynamic migration of edge services based on an improved whale optimization algorithm, characterized in that: The following steps are involved: S1. Obtaining user service request information and edge server information, wherein the user service request information includes user current location information, user historical location information and service information, and the edge server information includes location information of each edge server; S2, inputting the user's current location information and historical location information into a long short-term memory network, wherein the long short-term memory network is used to predict the user's location information at the next moment; S3, judging whether the user is about to exceed the coverage of the current server based on the predicted location information of the user at the next moment, if it is judged that the user will not exceed the coverage of the current server at the next moment, executing step S7, otherwise executing step S4; S4, determining a service migration location point based on the user location information predicted by the long short-term memory network; S5. Filter out a set of edge servers that can cover the service migration location point based on the location information of the edge server; S6. Construct an edge service dynamic migration model with minimizing the total cost of service migration as the optimization goal, and solve the edge service dynamic migration model based on the improved whale optimization algorithm; S7, determine whether the service request has ended or the user has reached the end point. If the edge service has not been completed or has reached the end point, take the next time the user moves to as the current time, go to step S2 to continue predicting the user's location at future times and find the location point closest to the user that is beyond the coverage of the current edge server; If the service is completed or the user reaches the destination, the user location prediction and service migration work are terminated.
2. According to claim 1, a method for dynamic migration of edge services based on an improved whale optimization algorithm is characterized in that: The improved whale optimization algorithm makes the following improvements to the traditional whale optimization algorithm: Dynamic adaptive iteration termination judgment is performed based on the correlation between the number of iterations and the fitness value; Update the convergence factor based on the adaptive dynamic fluctuation nonlinear convergence method; A taboo table is set during the population optimization process to avoid repeated searches.
3. The method for dynamic migration of edge services based on the improved whale optimization algorithm according to claim 2 is characterized in that: Based on the correlation between the number of iterations and the fitness value, dynamic adaptive iteration termination judgment is performed, including: calculating the fitness value angle according to the following formula: Among them, f Gen Represents the optimal fitness value at the Gen-th iteration, μ represents the average fitness value in the fitness value set, and h represents the length of the fitness value set.
4. The method for dynamic migration of edge services based on the improved whale optimization algorithm according to claim 2 is characterized in that: The convergence factor is updated based on the adaptive dynamic fluctuation nonlinear convergence method, including: calculating the convergence factor according to the following formula: Among them, a0 represents the current convergence factor, Gen is the current number of iterations, and MaxIt is the maximum number of iterations.
5. The method for dynamic migration of edge services based on the improved whale optimization algorithm according to claim 1 is characterized in that: The edge service dynamic migration model is: C2:λ t +λ e =1,λ t >0.λ e >0 Among them, Tcost n,m It represents the service migration delay of the nth user’s service request to the mth MEC server, Ecost n,m represents the energy consumption of service migration performed by migrating the service request of the nth user to the mth MEC server, x n,m Indicates whether the service of the nth user is executed on the mth MEC server, λ t , e Represents the weight coefficients of service migration delay and energy consumption, Tup n,m Tdeal is the service request transmission delay n,m The latency of executing services for the MEC server, Twait n,m The waiting delay for the service to be processed on the MEC server, Eup n,m Transmitting energy consumption for service requests, Edeal n,m Energy consumption for executing services for MEC servers, Ewait n,m The waiting energy consumption of the service waiting to be processed on the MEC server, c n,m Represents the computing resources occupied by the service of the nth user on the mth MEC server, rcmec m Represents the computing resources of the mth server.
6. The method for dynamic migration of edge services based on the improved whale optimization algorithm according to claim 1, characterized in that: Predict user location information based on long short-term memory network, including: The predicted user location information is used as the input data of the long short-term memory network to continuously predict the location information of several users.
7. The method for dynamic migration of edge services based on the improved whale optimization algorithm according to claim 6 is characterized in that: Determining a service migration location point based on the user location information predicted by the long short-term memory network includes: From the predicted user locations at several future moments, in order from farthest to closest to the user's current location, find the location closest to the user that is beyond the coverage of the current edge server as the service migration location point.