Method and device for unloading mobile edge network service
1. A method for offloading traffic of a mobile edge network, comprising:
predicting the position of the terminal according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of a mobile edge computing server;
calculating first stay time of the terminal in the service range of the mobile edge computing server according to the first predicted position information, and acquiring first processing time required by the mobile edge computing server to finish computing a task to be unloaded of the terminal;
and under the condition that the first stay time is shorter than the first processing time, the task to be unloaded of the terminal is processed by a local terminal.
2. The method for offloading a service of a mobile edge network according to claim 1, wherein obtaining a first processing time required for a mobile edge computing server to complete a task computation to be offloaded by a terminal comprises:
calculating first uploading time of the service to be unloaded of the terminal to a mobile edge calculation server according to the first predicted position information;
acquiring first calculation time required by the mobile edge calculation server for calculating the service to be unloaded of the terminal;
and acquiring first processing time required by the mobile edge computing server to finish the computation of the task to be unloaded of the terminal according to the first uploading time and the first computing time.
3. The method for offloading the traffic of the mobile edge network according to claim 2, wherein the calculating a first upload time for offloading the traffic to be offloaded by the terminal to the mobile edge computing server specifically comprises:
calculating the average uploading rate of a first task of the terminal in the service range of the mobile edge calculation server according to the first predicted position information;
and calculating first uploading time of the traffic to be unloaded of the terminal to the mobile edge calculation server according to the average uploading rate of the first task.
4. The method for offloading traffic of a mobile edge network according to claim 1, wherein calculating the first staying time of the terminal within the service range of the mobile edge computing server specifically comprises:
according to the first predicted position information, obtaining first time when the terminal enters the service range of the mobile edge computing server and second time when the terminal leaves the service range of the mobile edge computing server;
and calculating the first stay time of the terminal in the service range of the mobile edge calculation server according to the first time and the second time.
5. The method for offloading the service of the mobile edge network according to claim 1, wherein the terminal location prediction is performed according to the terminal historical location information, and first predicted location information of the terminal within the service range of the mobile edge computing server is determined, specifically:
and performing rolling prediction through a rolling window based on a preset step length according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of the mobile edge computing server.
6. The method of claim 1, wherein after calculating a first retention time of the terminal within a service range of the mobile edge computing server and obtaining a first processing time required by the mobile edge computing server to complete a task computation to be offloaded by the terminal, the method further comprises:
and under the condition that the first stay time is not less than the first processing time, acquiring an optimal unloading scheme of the task to be unloaded of the terminal based on a genetic algorithm.
7. The method for offloading the mobile edge network traffic according to claim 6, wherein the obtaining of the optimal offloading scheme for the task to be offloaded by the terminal based on the genetic algorithm specifically comprises:
generating a plurality of chromosomes as initial populations based on a binary coding method;
in the binary coding method, 0 represents that a task is processed by a local terminal, and 1 represents that the task is unloaded to a mobile edge computing server for processing;
performing genetic operation based on the initial population, and obtaining an optimal chromosome under the condition of meeting a preset termination condition;
and decoding the optimal chromosome according to the binary coding method to obtain an optimal unloading scheme of the task to be unloaded of the terminal.
8. A mobile edge network traffic offload device, comprising:
the terminal position prediction module is used for predicting the position of the terminal according to the historical position information of the terminal and determining first predicted position information of the terminal in the service range of the mobile edge computing server;
the unloading scheme calculation module is used for calculating first stay time of the terminal in the service range of the mobile edge calculation server according to the first predicted position information and acquiring first processing time required by the mobile edge calculation server to finish the calculation of a task to be unloaded of the terminal;
and the unloading scheme acquisition module is used for processing the task to be unloaded by the terminal by the local terminal under the condition that the first retention time is less than the first processing time.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of the method for mobile edge network traffic offload according to any of claims 1 to 7.
10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor, performs the steps of the mobile edge network traffic offload method according to any of claims 1 to 7.
Background
With the development of scientific technology, people hope to process more data in a shorter time in the era of information explosion, and the traditional cloud computing has the defects of large communication delay and the like. Mobile Edge Computing (MEC) has been developed to provide more reliable and efficient Computing services for Mobile devices. At present, edge computing has become a leading edge and a hot spot of research of mobile edge cloud computing, and can provide pervasive computing and storage services for mobile and big data applications. With the proliferation of mobile user equipment and the ever-increasing demand for services for mobile users, simple edge computing has not been able to meet the demand.
In real-world scenarios, mobile users have a large number of tasks that require computation, which, due to the limited resources of the mobile device, would cause significant delays if all were performed at the local device. In order to solve the problems of computation delay and limited resources of the mobile device, the concept of task offloading is proposed. The task offloading has the advantage of offloading part or all of the computing tasks to nearby servers, thereby enabling the user equipment to run more efficiently the compute-intensive applications and improving the user experience. However, due to the high mobility of the user, the stay time of the user in the service range of the edge server is relatively short, and if the user leaves the service range while processing the traffic, the offloading is interrupted and the task offloading fails.
In the prior art, the dynamic characteristics of the mobile application program, including mobility and changing specifications, are considered, and the application program is completely distributed to the cloud service center. The above prior art is directed to a general low-speed mobile offloading scheme in the MEC scenario. However, when the MEC server is in a high-mobility environment of the user, the link between the MEC base station and the user is frequently established and disconnected, so that the link fluctuates frequently, and the conventional algorithm is not suitable for a scenario in which the user moves at a high speed.
Therefore, how to better achieve task offloading in a high-mobility environment of a user has become a research focus of interest in the industry.
Disclosure of Invention
The invention provides a method and a device for unloading mobile edge network services, which are used for better realizing task unloading in a high-mobility environment of a user.
The invention provides a method for unloading mobile edge network service, which comprises the following steps:
predicting the position of the terminal according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of a mobile edge computing server;
calculating first stay time of the terminal in the service range of the mobile edge computing server according to the first predicted position information, and acquiring first processing time required by the mobile edge computing server to finish computing a task to be unloaded of the terminal;
and under the condition that the first stay time is shorter than the first processing time, the task to be unloaded of the terminal is processed by a local terminal.
According to the method for unloading the mobile edge network service provided by the invention, the first processing time required by the mobile edge computing server to complete the computation of the task to be unloaded of the terminal is obtained, and the method specifically comprises the following steps:
calculating first uploading time of the service to be unloaded of the terminal to a mobile edge calculation server according to the first predicted position information;
acquiring first calculation time required by the mobile edge calculation server for calculating the service to be unloaded of the terminal;
and acquiring first processing time required by the mobile edge computing server to finish the computation of the task to be unloaded of the terminal according to the first uploading time and the first computing time.
According to the method for unloading the mobile edge network service provided by the invention, the first uploading time of the service to be unloaded of the terminal to the mobile edge computing server is calculated, specifically, the first uploading time is
Calculating the average uploading rate of a first task of the terminal in the service range of the mobile edge calculation server according to the first predicted position information;
and calculating first uploading time of the traffic to be unloaded of the terminal to the mobile edge calculation server according to the average uploading rate of the first task.
According to the method for offloading the mobile edge network service provided by the invention, the first staying time of the terminal in the service range of the mobile edge computing server is calculated, and the method specifically comprises the following steps:
according to the first predicted position information, obtaining first time when the terminal enters the service range of the mobile edge computing server and second time when the terminal leaves the service range of the mobile edge computing server;
and calculating the first stay time of the terminal in the service range of the mobile edge calculation server according to the first time and the second time.
According to the method for unloading the mobile edge network service provided by the invention, the terminal position is predicted according to the terminal historical position information, and the first predicted position information of the terminal in the service range of the mobile edge computing server is determined, which specifically comprises the following steps:
and performing rolling prediction through a rolling window based on a preset step length according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of the mobile edge computing server.
According to the method for offloading the mobile edge network service provided by the invention, after calculating the first staying time of the terminal in the service range of the mobile edge computing server and acquiring the first processing time required by the mobile edge computing server to finish the computation of the task to be offloaded of the terminal, the method further comprises the following steps:
and under the condition that the first stay time is not less than the first processing time, acquiring an optimal unloading scheme of the task to be unloaded of the terminal based on a genetic algorithm.
According to the method for unloading the mobile edge network service provided by the invention, based on a genetic algorithm, an optimal unloading scheme of a task to be unloaded of the terminal is obtained, and the method specifically comprises the following steps:
generating a plurality of chromosomes as initial populations based on a binary coding method;
in the binary coding method, 0 represents that a task is processed by a local terminal, and 1 represents that the task is unloaded to a mobile edge computing server for processing;
performing genetic operation based on the initial population, and obtaining an optimal chromosome under the condition of meeting a preset termination condition;
and decoding the optimal chromosome according to the binary coding method to obtain an optimal unloading scheme of the task to be unloaded of the terminal.
The invention also provides a device for unloading the mobile edge network service, which comprises:
the terminal position prediction module is used for predicting the position of the terminal according to the historical position information of the terminal and determining first predicted position information of the terminal in the service range of the mobile edge computing server;
the unloading scheme calculation module is used for calculating first stay time of the terminal in the service range of the mobile edge calculation server according to the first predicted position information and acquiring first processing time required by the mobile edge calculation server to finish the calculation of a task to be unloaded of the terminal;
and the unloading scheme acquisition module is used for processing the task to be unloaded by the terminal by the local terminal under the condition that the first retention time is less than the first processing time.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of any one of the above methods for unloading the mobile edge network traffic.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the mobile edge network traffic offload method as described in any of the above.
According to the method and the device for unloading the mobile edge network service, the predicted position information of the terminal in the service range of the mobile edge computing server is predicted through the terminal historical position information, the stay time of the terminal in the service range of the mobile edge computing server and the processing time required by the calculation of the task to be unloaded of the terminal are further calculated according to the terminal predicted position information, and the task to be unloaded of the terminal is directly processed by the local terminal under the condition that the stay time is less than the processing time, so that reasonable resources are distributed to high-speed mobile users in advance, the unloading success rate of the user service is improved, the task processing time of the user in the range of a base station is minimized, the switching of the base station is reduced, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a traffic offloading method for a mobile edge network according to the present invention;
FIG. 2 is a schematic diagram of an algorithm overall flow of a traffic offloading method of a mobile edge network provided in the present invention;
fig. 3 is an overall scheme model diagram of a traffic offloading method of a mobile edge network according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a classical neuron architecture for a long term memory network according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a prediction module using rolling prediction according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a traffic offload device of a mobile edge network provided in the present invention;
fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a traffic offloading method for a mobile edge network provided in the present invention, as shown in fig. 1, including:
and step S1, predicting the terminal position according to the terminal historical position information, and determining the first predicted position information of the terminal in the service range of the mobile edge computing server.
Specifically, the terminal described in the present invention refers to a user terminal, and the terminal history location information refers to location coordinates of the user terminal at a history time.
The service range of the Mobile Edge Computing server described in the present invention refers to the coverage range of the base station wireless signal corresponding to the Mobile Edge Computing (MEC) server.
It should be noted that the mobile edge network according to the embodiment of the present invention includes a high-speed mobile user terminal, a user task, and an MEC server. The mobile edge network system comprises a plurality of MEC servers, and each MEC server corresponds to one base station. The set of MEC servers may be denoted as K ═ {1, 2.., K }; in a coordinate system set by the system, the MEC server position coordinates can be expressed as (a, B) in a plane coordinate system, wherein a represents the abscissa of the MEC server position, and B represents the ordinate of the MEC server position; the user terminal position coordinates are expressed as (x, y), where x represents the abscissa of the user terminal position and y represents the user terminal positionThe vertical coordinate of the device; dividing the global time T of the optimization algorithm into T time periods, and expressing the position coordinates of the user terminal in the T time periods as { (x)1,y1),(x2,y2),...,(xt,yt)}。
The first predicted position information described in the present invention refers to the predicted position coordinates of the terminal within the service range of each MEC server.
Further, according to the historical position information of the terminal, based on a preset prediction network model, a long-time memory artificial neural network model can be adopted to predict first prediction position information of the terminal in the service range of the mobile edge computing server.
Step S2, according to the first predicted position information, calculating a first staying time of the terminal within the service range of the mobile edge computing server, and obtaining a first processing time required by the mobile edge computing server to complete the computation of the task to be offloaded by the terminal.
Specifically, the first dwell time described herein refers to a dwell time of the terminal within the service range of the MEC server, i.e., a period of time from a time when the terminal enters the service range of the MEC server to a time when the terminal leaves the service range of the MEC server.
The tasks to be unloaded of the terminal described by the invention refer to all user tasks needing to be unloaded, which are obtained by updating the user service information by the system within the stay time of the terminal in the service range of the MEC server.
The first processing time described in the present invention refers to the total time consumed in the process from the unloading and uploading of the task to be unloaded by the terminal to the completion of the calculation of the task to be unloaded by the terminal by the MEC server, and finally, the calculation result is returned to the terminal.
Further, according to the first predicted position information, the first stay time of the terminal in the service range of the MEC server can be calculated, and the first processing time required by the MEC server to complete the calculation of the task to be unloaded of the terminal is obtained.
Step S3, when the first staying time is shorter than the first processing time, the task to be unloaded by the terminal is processed by the local terminal.
Specifically, the processing of the task to be offloaded by the terminal by the local terminal described in the present invention means that the user terminal stays for a short time, and the MEC server cannot process the task to be offloaded by the terminal within the stay time, so that a link between the MEC base station and the user terminal is frequently established and disconnected, and the link fluctuates frequently, and therefore, the task to be offloaded by the terminal is not offloaded to the MEC server, but is directly processed by the local user terminal.
Further, the first staying time of the terminal within the service range of the MEC server and the first processing time required by the MEC server to complete the calculation of the task to be offloaded by the terminal are calculated through the step S2, the first staying time is compared with the first processing time, and the task to be offloaded by the terminal is directly processed by the local user terminal under the condition that the first staying time is less than the first processing time.
According to the method provided by the embodiment of the invention, the predicted position information of the terminal in the service range of the mobile edge computing server is predicted through the terminal historical position information, the stay time of the terminal in the service range of the mobile edge computing server and the processing time required by the task to be unloaded of the terminal are further calculated according to the terminal predicted position information, and the task to be unloaded of the terminal is directly processed by the local terminal under the condition that the stay time is less than the processing time, so that reasonable resources are distributed to high-speed mobile users in advance, the unloading success rate of user services is improved, the task processing time of the user in the range of a base station is minimized, base station switching is reduced, and the user experience is improved.
Optionally, the obtaining of the first processing time required by the mobile edge computing server to complete the computation of the task to be offloaded by the terminal includes:
calculating first uploading time of the service to be unloaded of the terminal to a mobile edge calculation server according to the first predicted position information;
acquiring first calculation time required by the mobile edge calculation server for calculating the service to be unloaded of the terminal;
and acquiring first processing time required by the mobile edge computing server to finish the computation of the task to be unloaded of the terminal according to the first uploading time and the first computing time.
Specifically, the first upload time described in the present invention refers to the time required for completing the offload upload of the task to be offloaded by the terminal to the MEC server.
The first calculation time described in the present invention refers to the total time required for the MEC server to complete the calculation of the to-be-offloaded service of each terminal.
Further, the first uploading time and the first calculating time are summed, so that the first processing time required by the mobile edge calculating server to finish the calculation of the task to be unloaded of the terminal can be obtained. In an embodiment of the invention, each user terminal's task set may use a triplet Ru,Zu,DuAnd represents the size of the user's remaining task, the number of CPU cycles required to complete the remaining task, and the latency requirement to complete the remaining task, respectively.
If the task to be unloaded by the user terminal is executed on the MEC server, the task is uploaded to the MEC server, and then the MEC server operates the task. The average task uploading rate of the user terminal is calculated by deducing the first staying time of the user in the server and according to the task uploading rate at each moment in the first staying time, and can be expressed as Shannon formula
Wherein, Bu,kRepresenting the channel bandwidth, wherein the fixed MEC server allocates the fixed channel bandwidth to the user terminal, and the channel bandwidth is the average value of all users sharing the channel; p represents the uplink signal transmission power between the user terminal and the current MEC server; sigma2Representing additive white gaussian noise; gu,k(t) the first uploading time of the to-be-unloaded traffic of the path loss terminal to the mobile edge computing server is represented as
After uploading the task to be unloaded of the terminal to the MEC server, calculating the task to be unloaded by using the resources of the MEC server, so in the embodiment of the invention, the definition isThe size of the available computing resource of the user u on the MEC server k is equal to the average value of all users sharing the MEC server k, and the first computing time required by the MEC server to compute the service to be unloaded of the terminal is
Further, when the task to be unloaded by the terminal is unloaded to the MEC server for execution, the MEC server completes the first processing time required by the calculation of the task to be unloaded by the terminalFor the sum of the task upload time and the computation time of the task on the MEC server, the pass-back time is negligible, i.e. the first processing time can be expressed as:
according to the method provided by the embodiment of the invention, the first uploading time for the task to be unloaded of the terminal to be unloaded to the MEC server is calculated, the first calculation time required by the MEC server for calculating the service to be unloaded of the terminal is obtained, the first uploading time and the first calculation time are summed, the first processing time required by the MEC server for completing the calculation of the task to be unloaded of the terminal is obtained, the obtained first processing time is more in line with the actual situation, and accurate judgment conditions are provided for the unloading decision of the task to be unloaded of the subsequent calculation terminal.
Optionally, the first upload time for the traffic to be offloaded by the computing terminal to be offloaded to the mobile edge computing server is calculated, specifically, the first upload time is
Calculating the average uploading rate of a first task of the terminal in the service range of the mobile edge calculation server according to the first predicted position information;
and calculating first uploading time of the traffic to be unloaded of the terminal to the mobile edge calculation server according to the average uploading rate of the first task.
Specifically, the first task average upload rate described in the present invention refers to an average upload rate in a process of offloading a task to be offloaded by a terminal to an MEC server within a service range of the MEC server.
Further, according to the coordinates of each predicted position of the terminal in the service range of the MEC server and the coordinates of the base station position of the MEC server, the path loss generated by task unloading at each predicted position of the terminal can be obtained; according to the path loss, the task uploading rate corresponding to each predicted position of the terminal can be calculated, and further the first task average uploading rate of the terminal in the service range of the MEC server can be obtained.
In an embodiment of the invention, the data may be represented by a formulaAnd calculating the distance between the user terminal and the MEC server. According to the predicted real-time position of the user terminal, the path loss of the user terminal at each predicted position in the service range of the MEC server can be obtained according to the formula G which is 32.44+20lg d (Km) +20lg f (MHz) (db), and according to the formula GAnd calculating the task uploading rate of each predicted position of the user terminal, so that the task average uploading rate of the user terminal in the service range of the MEC server can be calculated.
Further, according to the average uploading rate of the first task and the size of the task to be unloaded of the terminal, the first uploading time of the service to be unloaded of the terminal to the mobile edge computing server is calculated.
According to the method provided by the embodiment of the invention, the first uploading time for the terminal to-be-unloaded service to be unloaded to the MEC server is obtained by calculating the average uploading rate of the first task of the terminal in the service range of the MEC server, so that the first processing time required by the MEC server to finish the calculation of the terminal to-be-unloaded task can be obtained through subsequent calculation, and a judgment condition is provided for calculating the unloading decision of the terminal to-be-unloaded task.
Optionally, calculating a first retention time of the terminal within the service range of the mobile edge computing server, specifically:
according to the first predicted position information, obtaining first time when the terminal enters the service range of the mobile edge computing server and second time when the terminal leaves the service range of the mobile edge computing server;
and calculating the first stay time of the terminal in the service range of the mobile edge calculation server according to the first time and the second time.
Specifically, the first time described in the present invention refers to a time when the terminal starts to enter the service range of the MEC server.
The second time described in the present invention refers to a time when the terminal leaves the service range of the MEC server.
Further, according to the first predicted position information of the terminal in the service range of the MEC server and the position information of the MEC server base station, the first time and the second time can be calculated, and then the difference is made between the second time and the first time, so that the first staying time of the terminal in the service range of the MEC server can be obtained.
In the embodiment of the invention, the stay time of the user in the coverage area of the MEC server is obtained according to the time when the user terminal enters and leaves the service area of the MEC server. Setting the time of the user entering the service range of the MEC server as pt and the time of leaving the service range of the MEC server as qt, and setting the stay time of the user in the service range of the MEC server as qt
According to the method provided by the embodiment of the invention, the first time when the terminal enters the service range of the MEC server and the second time when the terminal leaves the service range of the MEC server are calculated according to the first predicted position information, so that the first staying time of the terminal in the service range of the MEC server can be calculated, and a judgment condition is provided for the unloading decision of the task to be unloaded of the subsequent calculation terminal.
Optionally, the terminal location prediction is performed according to the terminal historical location information, and first predicted location information of the terminal in the service range of the mobile edge computing server is determined, specifically:
and performing rolling prediction through a rolling window based on a preset step length according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of the mobile edge computing server.
In particular, the scrolling window described herein has a time attribute with a time interval size.
In the embodiment of the invention, as time goes on, the rolling window continuously rolls and advances on the global time axis of the optimization algorithm of the invention, and in the time interval, the prediction of the terminal position information is completed based on the prediction network model.
In the embodiment of the invention, the terminal position information in the rolling window is input into the prediction network every time the rolling window rolls once, and a group of terminal predicted position information can be obtained.
The preset step described in the present invention refers to a preset time interval for scrolling the scrolling window.
Further, according to the historical position information of the terminal and the position information of the MEC server, a rolling window can perform rolling prediction on a global time axis based on a preset step length and a prediction network model, and the predicted position information of the terminal in the service range of each MEC server is determined.
When the rolling window traverses the complete local time, the predicted position information of the user terminal on the global time axis can be obtained, namely the motion trail and the real-time position information of the user terminal can be obtained through prediction.
In the embodiment of the invention, the prediction network model can adopt a Long Short-Term Memory artificial neural network (LSTM) model.
In the embodiment of the invention, a multi-step prediction method is adopted firstly, the length of a rolling window is set to be L, and then the prediction step number is adaptively adjusted by a prediction network according to the size of a loss function, so that the prediction result is more accurate.
And performing rolling prediction by adopting a rolling window method in T time periods divided by the global time T. Inputting historical positions of the user terminal in the previous m time periods { (x)1,y1),(x2,y2),...,(xm,ym) Predicting the position of the user terminal in the last n time periods by the LSTM network (x)m+1,ym+1),(xm+2,ym+2),...,(xn,yn) T, m + n < t, stipulated for ensuring accuracy: m is more than n. Thereafter, the scroll window scrolls forward 1 time interval input { (x)1+l,Y1+l),(x2+l,y2+l),...,(xm+l,ym+l) Wherein L is less than or equal to m. And predicting unknown values of the terminal in the future time period through the LSTM network according to the values of the known terminal in the historical time period. And so on until the prediction of the whole time interval is completed. Through prediction, the predicted user terminal position is output, and the moving track and the real-time position of the mobile user terminal can be known in advance.
According to the method provided by the embodiment of the invention, the prediction is carried out based on the LSTM network and the rolling window according to the historical position information of the terminal, the global long-time prediction is converted into the local short-time optimization prediction, the prediction precision is favorably improved, and the obtained first prediction position information of the terminal in the service range of the MEC server is more accurate.
Optionally, after calculating a first retention time of the terminal within the service range of the mobile edge computing server and acquiring a first processing time required by the mobile edge computing server to complete the computation of the task to be offloaded by the terminal, the method further includes:
and under the condition that the first stay time is not less than the first processing time, acquiring an optimal unloading scheme of the task to be unloaded of the terminal based on a genetic algorithm.
Specifically, the optimal offloading scheme described in the present invention refers to an optimal offloading decision of a service to be offloaded by a user terminal. The unloading decision comprises that the task to be unloaded of the terminal is processed by the local terminal or the task to be unloaded of the terminal is unloaded to the MEC server for processing.
Further, under the condition that the first staying time is not less than the first processing time, an optimal unloading scheme of the task to be unloaded of the terminal is obtained based on a genetic algorithm.
According to the method provided by the embodiment of the invention, when the first retention time is judged and obtained to be not less than the first processing time, the processing time of the task to be unloaded of the user terminal can be optimized by adopting a genetic algorithm, and the optimal unloading scheme of the task to be unloaded of the terminal is obtained, so that the reasonable distribution of mobile edge network resources is facilitated, and the system performance is improved.
Optionally, based on a genetic algorithm, obtaining an optimal offloading scheme of the task to be offloaded by the terminal, specifically:
generating a plurality of chromosomes as initial populations based on a binary coding method;
in the binary coding method, 0 represents that a task is processed by a local terminal, and 1 represents that the task is unloaded to a mobile edge computing server for processing;
performing genetic operation based on the initial population, and obtaining an optimal chromosome under the condition of meeting a preset termination condition;
and decoding the optimal chromosome according to the binary coding method to obtain an optimal unloading scheme of the task to be unloaded of the terminal.
Specifically, the preset termination condition described in the present invention includes a preset convergence condition, or a preset maximum number of iterations.
In the embodiment of the invention, the optimal unloading scheme of the task to be unloaded of the terminal can be solved and obtained by utilizing a genetic algorithm.
In the genetic algorithm, an encoding method is the key of the genetic algorithm, and both the mutation probability and the cross probability are influenced by the encoding method, so that the efficiency of genetic calculation is greatly influenced by the encoding problem.
The encoding method comprises binary encoding, a floating point type encoding method and the like, and the binary encoding method can be selected in consideration of optimizing the unloading decision so as to optimize the task processing time of a user.
In an embodiment of the present invention, each solution may be defined by a chromosome, which is defined using a binary encoding method. If the task is processed by the local terminal, the code is 0; if the task is unloaded to the MEC server for processing, the code is 1.
Further, based on the binary coding method, a plurality of chromosomes can be generated as an initial population;
and generating a progeny population by genetic operations of selection, crossing and mutation based on the initial population obtained. The parent population and the offspring population are merged into a new population and all chromosomes are sorted in descending order according to the calculated fitness. According to the natural evolution principle, chromosomes with poor fitness are removed, and a certain number of chromosomes with good fitness are reserved in a new population. Based on a population evolution algorithm, fitness calculation, selection operation, crossover operation and mutation operation are repeatedly carried out until a preset termination condition is reached, and an optimal chromosome is obtained.
And further, decoding the obtained optimal chromosome according to a binary coding method to obtain an optimal unloading scheme of the task to be unloaded of the terminal.
The method of the embodiment of the invention obtains the initial population based on the binary coding method, performs genetic operation on the initial population, performs iterative computation to obtain the optimal chromosome, and obtains the optimal unloading scheme of the task to be unloaded by the terminal by decoding the optimal chromosome, thereby realizing the minimization of the task processing time of the mobile user, improving the unloading success rate of the user task and further improving the performance of the system.
Fig. 2 is a schematic diagram of an overall algorithm flow of the method for offloading the mobile edge network traffic provided by the present invention, and as shown in fig. 2, the overall algorithm flow of the method for offloading the mobile edge network traffic provided by the embodiment of the present invention mainly includes a prediction module part and a calculation module part, and the specific flow steps include:
step S210, initializing a user and recording system parameters;
specifically, the system model can be established according to the structure of the user, the task and the MEC.
In the mobile edge network of the present invention, high-speed mobile subscribers, tasks and MEC servers are included. Fig. 3 is an overall scheme model diagram of a traffic offloading method for a mobile edge network according to an embodiment of the present invention.
In an embodiment of the present invention, the set of user terminals may be denoted as Ut={1,2,3...ut}. Each user obtains a new task at the beginning of each time period, the task arrives according to Poisson distribution, the task triple is expressed as { R, Z and D }, the size of the task, the number of CPU cycles required for completing the task and the time delay requirement for completing the task are represented respectively, each task has two optional unloading modes, and the task can be calculated on local user equipment or unloaded to an MEC server. Introducing variablesIndicating whether the task is processed at the local user equipment or offloaded to the MEC server for computation, i.e.
There are multiple MEC servers in the system, each with its own fixed service scope. Updating the users in each base station and the task sets of the users at the beginning of each time period, if the users process the tasks locally, only occupying self computing resources, and not occupying channel bandwidth and resources of an MEC server; if the task is unloaded to the MEC server for calculation, the task needs to occupy the channel bandwidth to be uploaded to the MEC server, and then the calculation resources on the MEC server are used for calculation. The total bandwidth of the channel and the total resource of the same MEC server are fixed and can be used by a plurality of users together.
In the embodiment of the invention, a task model is established according to the state information of the user, the task and the MEC.
In the embodiment of the invention, the total time of the optimization algorithm is T, and the size of T is larger than the tolerance time of the common task. The total time T is divided into T time periods, and the user defaults to rest in the same time period. And at the beginning of each time period, updating the users and the task sets of the users within the range of the base station through the real-time positions of the users obtained by the early-stage prediction module. Each user's task set may use a triple Ru,Zu,DuThe MEC servers are respectively represented by the size of the remaining task of the user, the number of CPU cycles required to complete the remaining task and the time delay requirement for completing the remaining task, a plurality of MEC servers are arranged in the system, and the set of MEC servers can be represented as K { (1, 2.. multidot.k }, and the coordinates are { (a)1,B1),(A2,B2),...,(Ak,Bk)}。
In an embodiment of the present invention, the processing steps in the prediction module specifically include:
step S211, inputting a user history track;
step S212, LSTM predicts network prediction;
in step S213, the predicted user position is output.
In an embodiment of the present invention, a long-term memory network (LSTM network) is used as the prediction network. Fig. 4 is a schematic diagram of a classical neuron structure of a long-term and short-term memory network according to an embodiment of the present invention.
Fig. 5 is a schematic diagram illustrating a principle that a prediction module provided in an embodiment of the present invention adopts rolling prediction, and as shown in fig. 5, prediction modes are mainly divided into single-step prediction and multi-step prediction.
In the embodiment of the invention, because the user moves at a high speed and the stay time in the limited server coverage range is relatively short, the prediction module is introduced, the historical track of the user is taken as input to predict the real-time position at the later stage, the task calculation is ensured to be completed before the user leaves the MEC server coverage range, and the unloading success rate is improved. As the former track data is needed and the former known data are less, in order to improve the prediction accuracy, the invention adopts a long-time memory network (LSTM network) and a rolling prediction method, uses the historical information of the former time periods to predict the user positions of the next time periods, and uses the predicted user positions in the later calculation.
Step S214, deducing the stay time of the user in the base station;
in an embodiment of the invention, the real-time location of the user is updated by the prediction module, thereby deducing that the stay time of the user in the service range of the MEC server is
Specifically, according to the predicted user position, whether the user enters the coverage area of a new MEC server or not can be deduced, the staying time of the user in the service area of the MEC server is known, the average task uploading rate of the user is calculated, resources are distributed to the user in advance, and unloading decisions are made.
Step S215, updating the user position and the service information in the base station;
step S216, deducing the calculation time of the user task on the MEC server;
each task of the user has two optional unloading modes, and the local terminal processes or unloads the task to the MEC server for calculation. Through the prediction of the previous period, if the stay time of the user in the service range of the MEC server is short and the task cannot be calculated and completed before the user leaves the MEC server, the task is specified to be processed locally in the range of the MEC server; and if the user stays in the range of the MEC server for a long time, uploading the task to the MEC server for calculation.
In the embodiment of the invention, a time delay model is established according to the state information of the user, the task and the MEC.
When tasks are executed locally, the invention definesIs local to user uIf resources are available, the local execution time of the task is as follows:
when the task is executed on the MEC server, the processing time of the task is the sum of the uploading time and the calculation time, the returning time can be ignored, namely, the processing time of the task on the MEC server k is the sum of the task uploading time and the calculation time of the task on the MEC server, namely
Step S217, judging whether the stay time of the user in the base station is not less than the MEC calculation time, and entering step S218 to perform local task processing under the condition that the stay time of the user in the base station is less than the MEC calculation time; and (5) under the condition that the residence time of the user in the base station is not less than the MEC calculation time, the step S219 is carried out, and the genetic algorithm is used for solving the optimization problem.
In the embodiment of the invention, a task logic model is established according to the state information of the user, the task and the MEC.
As a user moving at a high speed, the moving speed is high, and the staying time in the coverage area of the base station is relatively short, so that the user must experience the problem of base station handover in a path. The invention provides a prediction module aiming at the phenomenon, and predicts the real-time position of the user according to the historical track. The prediction module is used for deducing the stay time of a user in the coverage range of a certain MEC server in advance through prediction, and if the stay time of the user in the service range of the MEC server is short and a task cannot be calculated and completed before the user leaves the MEC server, the task is specified to be processed locally in the range of the MEC server; and if the user stays in the range of the MEC server for a long time, uploading the task to the MEC server for calculation. Therefore, the unloading success rate is improved, and the user experience is ensured.
And step S219, solving an optimization problem by a genetic algorithm.
Specifically, according to the system model, the system task offloading optimization objective is set to minimize the user traffic completion time within the service range of the base station. Thus, the optimization objective may be expressed as
Wherein C1 denotes that the task is guaranteed to be executed locally or processed on some MEC server; c2 denotes ensuring that each user performs task computations on only one MEC server at a time; c3 indicates that ensuring that the task is processed at the MEC server ensures both that the latency requirements of the task are met and that the task processing is completed before the user leaves the service area of the MEC server.
In the embodiment of the present invention, the specific steps of the genetic algorithm for solving the optimization problem include:
step S2190, digitally encodes and decodes the potential solution.
The encoding mode of the genetic algorithm comprises binary encoding, a floating point type encoding method and the like, and the binary encoding method is adopted for the project considering that the project needs to optimize the task processing time by optimizing unloading decision. If the task is processed locally, the code is 0; if the task is executed at the MEC server, the code is 1.
I.e., 0-local execution; 1-MEC server.
Step S2191 sets a fitness function and a selection function.
After decoding the individual codes, obtaining the unloading decision of the user, namely 0 is processed locally by the task; 1 is calculated on the MEC server for the task. And (4) calculating the total task processing time of the user according to the unloading decision, and since the optimization goal of the project is to minimize the task processing time of all the users, subtracting the optimization goal from a larger value and adding a constraint condition as a fitness function to evaluate the quality of the individual for screening. Then, the parent is selected by roulette, i.e. the probability of each individual entering the next generation is equal to the ratio of its fitness value to the sum of the fitness values of the individuals in the whole population. The selected individuals can be used as parents to carry out subsequent operations.
In step S2192, a chromosome crossing operation and a mutation operation are performed.
In the selected parent, randomly selecting a cross point in the individual code string, and performing gene exchange with another paired individual to form two new individuals to complete chromosome cross inheritance. Then, a certain bit is mutated with a certain probability, namely 0 is changed into 1, and 1 is changed into 0, so that a new individual is formed again. And (4) evolving, namely selecting a proper individual by using a fitness function to reserve, and repeating the steps to obtain the final optimal unloading decision.
Genetic Algorithm (GA) is a computational model of the biological evolution process that simulates the natural selection and Genetic mechanism of Darwinian biological evolution theory, and is a method for searching for an optimal solution by simulating the natural evolution process. The method has the main advantages that the method directly operates the structural object without the limitation of derivation and function continuity; the method has the advantages of inherent hidden parallelism and better global optimization capability; by adopting a probabilistic optimization method, the optimized search space can be automatically acquired and guided without a determined rule, and the search direction can be adaptively adjusted.
The algorithm provided by the embodiment of the invention is based on a task unloading and resource allocation optimization algorithm combining prediction and a genetic algorithm, and is used for determining the unloading decision of a user and allocating the common resources of a channel. Through the digital coding of the phenotype potential solution, the optimal unloading decision is obtained through the calculation of a series of genetic algorithms, so that the task processing time of a mobile user is minimized, the unloading success rate of the user task is improved, and the performance of the system is improved.
Further, step S220, outputting an offloading decision and a final service processing time;
step S221, the algorithm is ended.
According to the method provided by the embodiment of the invention, in a mobile edge network scene of high-speed movement of a user, the real-time position of the user is predicted, the stay time of the user in the service range of the MEC server is deduced according to the time of the user entering and leaving the base station of the MEC server, and the path loss is calculated according to the distance between the user and the base station, so that the task uploading average rate of the user terminal in the range of the MEC server is calculated, the unloading decision and the optimization of resource allocation are provided for the user, the unloading success rate is improved, the performance of the system is optimized, and the user experience is optimal.
The algorithm provided by the embodiment of the invention is a task unloading and resource allocation optimization algorithm based on the combination of LSTM network prediction and genetic algorithm, and is used for determining the unloading decision of the task to be unloaded of the user terminal and allocating the public resource of the channel. The optimal unloading decision is obtained through the digital coding of the phenotype potential solution and the calculation of a series of genetic algorithms, so that the task processing time of a mobile user is minimized, the unloading success rate of the user task is improved, and the performance of the system is improved.
Fig. 6 is a schematic structural diagram of a traffic offload device of a mobile edge network provided by the present invention, as shown in fig. 6, including:
the terminal position prediction module 610 is configured to perform terminal position prediction according to the terminal historical position information, and determine first predicted position information of the terminal within a service range of the mobile edge computing server;
an unloading scheme calculating module 620, configured to calculate, according to the first predicted location information, a first retention time of the terminal within a service range of the mobile edge computing server, and obtain a first processing time required by the mobile edge computing server to complete a task computation to be unloaded by the terminal;
an unloading scheme obtaining module 630, configured to, when the first retention time is less than the first processing time, process the task to be unloaded by the terminal by using a local terminal.
The apparatus described in this embodiment may be used to implement the above method embodiments, and the principle and technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of an electronic device provided in the present invention, and as shown in fig. 7, the electronic device may include: a processor (processor)710, a communication Interface (Communications Interface)720, a memory (memory)730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may invoke logic instructions in the memory 730 to perform the mobile edge network traffic offload method, comprising: predicting the position of the terminal according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of a mobile edge computing server; calculating first stay time of the terminal in the service range of the mobile edge computing server according to the first predicted position information, and acquiring first processing time required by the mobile edge computing server to finish computing a task to be unloaded of the terminal; and under the condition that the first stay time is shorter than the first processing time, the task to be unloaded of the terminal is processed by a local terminal.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer being capable of executing the mobile edge network traffic offload method provided by the above methods, the method including: predicting the position of the terminal according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of a mobile edge computing server; calculating first stay time of the terminal in the service range of the mobile edge computing server according to the first predicted position information, and acquiring first processing time required by the mobile edge computing server to finish computing a task to be unloaded of the terminal; and under the condition that the first stay time is shorter than the first processing time, the task to be unloaded of the terminal is processed by a local terminal.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the method for offloading mobile edge network traffic provided by the above methods, the method comprising: predicting the position of the terminal according to the historical position information of the terminal, and determining first predicted position information of the terminal in the service range of a mobile edge computing server; calculating first stay time of the terminal in the service range of the mobile edge computing server according to the first predicted position information, and acquiring first processing time required by the mobile edge computing server to finish computing a task to be unloaded of the terminal; and under the condition that the first stay time is shorter than the first processing time, the task to be unloaded of the terminal is processed by a local terminal.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.