MEC task unloading decision-making method based on discrete soft actor-commentator algorithm
Through the MEC task offloading decision-making method based on the discrete soft actor-critic algorithm, the task offloading solution for intelligent vehicles is optimized, solving the problems of high data transmission delay and insufficient resources in the traditional architecture, and minimizing the task delay in the Internet of Vehicles. and improvement of resource efficiency.
Patent Information
- Application Number
- CN202411140656.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-10-29
AI Technical Summary
The traditional central cloud server architecture has the problems of long data transmission distance and high latency in the Internet of Vehicles (V2X), which cannot meet the needs of low latency and high bandwidth. Moreover, the computing, storage heterogeneity and task of MEC server and remote cloud Heterogeneity and insufficient resources lead to inefficient task offloading, affecting data transmission speed and stability.
The MEC task offloading decision-making method based on the discrete soft actor-critic algorithm is adopted. By establishing a mathematical model of the MEC system, the task offloading decision is optimized into a Markov decision problem, and the neural network is used to optimize the task offloading scheme of the intelligent vehicle to find the best destinations and routes to minimize vehicle mission delays.
It minimizes the delay of smart vehicle tasks in the Internet of Vehicles scenario, improves resource utilization efficiency, improves the shortcomings of MEC technology in offloading tasks of the Internet of Vehicles, and improves user experience and network bandwidth.
Smart Images

Figure CN118870433A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of mobile edge computing, and in particular relates to a MEC task offloading decision method based on a discrete soft actor-critic algorithm. Background Art
[0002] Vehicle-to-Everything (V2X) refers to connecting vehicles to the Internet through wireless communication technology to achieve information exchange and data sharing between vehicles and between vehicles and infrastructure. With the rapid development of the Internet of Things and wireless communication technology, V2X is gradually becoming an important development direction in the field of intelligent transportation. However, V2X applications need to process a large amount of data, and the processing and transmission of these data require low-latency and high-bandwidth network support to ensure real-time and reliability; while the traditional central cloud server architecture has the problems of long data transmission distance and high latency, which cannot meet the needs of V2X applications. In this case, the adoption of Mobile Edge Computing (MEC) technology has become a trend, that is, by deploying computing resources, storage capabilities and network services at edge nodes close to vehicles, the tasks that need to be calculated are offloaded to edge nodes in order to reduce latency, increase network bandwidth and improve user experience.
[0003] However, the computing and storage of different MEC servers and remote clouds are often not exactly the same, and in real vehicle networking scenarios, there are often problems such as heterogeneous tasks and uneven user distribution. In addition, when there are a large number of vehicles, the resources of MEC devices are insufficient, which makes it impossible to meet the needs of all vehicles. Vehicles and equipment need to make collaborative decisions and manage resources. The data transmission of a large number of vehicles may affect the speed and stability of data transmission. Problems still exist. By optimizing the task offloading strategy and finding a suitable offloading path and destination for task data, the task processing efficiency can be effectively improved and resources can be effectively utilized, which is of great significance to the implementation, development and promotion of V2X. Summary of the invention
[0004] In order to overcome the problems existing in the prior art, the present invention provides a MEC task offloading decision method based on a discrete soft actor-critic algorithm.
[0005] The present invention is achieved through the following technical solutions:
[0006] The MEC task offloading decision method based on the discrete soft actor-critic algorithm establishes a mathematical model for the PC5-Uu dual-communication mode MEC system including a remote cloud server, a roadside MEC server, a base station MEC server, multiple roadside units, a base station and multiple smart vehicles. In the task offloading process in which smart vehicles transmit task data to the computing destination for processing, the offloading decision optimization problem with the goal of minimizing the weighted delay of smart vehicle tasks is transformed into a Markov decision problem, and the discrete soft actor-critic algorithm is used to optimize the task offloading scheme of smart vehicles in the scene, find the best destination and the best path for task offloading for smart vehicles, thereby minimizing the vehicle task delay. The specific steps are as follows:
[0007] Step 1: Establish a MEC offloading model;
[0008] The MEC offloading model is a general model, which is a model established for the complete MEC system, including the MEC offloading scenario model, the MEC offloading communication model, and the MEC offloading calculation model;
[0009] (1) Establish a MEC offloading scenario model;
[0010] The MEC system contains a two-way road with M roadside units S={S1,S2,…,S M}, each roadside unit is connected to a roadside MEC server in a wired manner and the adjacent roadside units are also connected in a wired manner. The total computing resources of a single roadside MEC server are F r , roadside unit m represents one of the M roadside units, that is, m∈M; the set of N intelligent vehicles equipped with OBU and vehicle Ethernet on the road is set to V={V1,V2,…,V N}, each smart vehicle can communicate with the roadside unit in its communication range in PC5 mode and offload the task to the MEC server matching the roadside unit for calculation. Smart vehicle n represents one of the N smart vehicles, that is, n∈N; all smart vehicles in the scene generate a task to be processed at the same time in each time slot, and the task generated by smart vehicle n is set to L n ={D n ,C n ,T n max ,B n}; where Dn is the task data size, C n is the amount of computing resources required for the task data of the task unit, The maximum acceptable delay to complete the task; B nis the number of channel resource blocks / subchannels occupied when uploading the task. When the smart vehicle communicates with the roadside unit, it can occupy 1 to 5 resource blocks. In addition, there is a 5G base station in the scene, which communicates with the surrounding roadside units by wired connection. It can also communicate with vehicles within the communication range through Uu mode. The 5G base station is connected to the 5G MEC server by wire. The computing resources of the 5G MEC server are F b , and communicate with the remote cloud server in a long-distance wired manner; 1 5G base station and M roadside units and their matching MEC servers constitute a joint edge node, and each roadside unit and the roadside unit and 5G base station are wired connected;
[0011] (2) Establishing a MEC offloading communication model;
[0012] When a vehicle communicates with a roadside unit in PC5 mode, the total bandwidth of a single roadside unit is W r , the total bandwidth is divided into multiple resource blocks in the frequency domain, and the bandwidth of a resource block is W rb ; When the vehicle communicates with the 5G base station in Uu mode, the total bandwidth is W b , the channel is divided into multiple sub-channels in the frequency domain, and the sub-channel bandwidth is W bb ;
[0013] The connection decision variable is a n = {0,1}, indicating that the smart vehicle n chooses to communicate with the roadside unit or the 5G base station, a n = 0 means that the smart vehicle n chooses to communicate with the roadside unit, a n =1 means that the intelligent vehicle n chooses to communicate with the 5G base station; calculate the decision variable b n = {b n1 ,b n2 ,…,b nM ,b nb ,b nc} Choose to offload tasks to a roadside MEC server, 5G MEC server or cloud server for intelligent vehicles to perform calculations. n Each item in b can only take the value 0 or 1 and b n Only one of the items in can be 1, that is, it satisfies If b n1 ,b n2 ,…,b nM If one of b is 1, it means that the task of smart vehicle n will be offloaded to the corresponding roadside MEC server; if b nb If b is 1, it means that the task of smart vehicle n will be offloaded to the 5GMEC server; if b nc If it is 1, it means that the task of smart vehicle n will be offloaded to the cloud server;
[0014] When the vehicle chooses to communicate with the roadside unit, record d nr is the distance between the vehicle and the roadside unit, then the channel gain h between vehicle n and roadside unit m nr for:
[0015]
[0016] According to Shannon's theorem, the transmission rate R nr for:
[0017]
[0018] Among them, p n is the transmission power of smart vehicle n, p n 4W; 2 is the noise power of the wireless channel, σ 2 is -114dbm; at this time the transmission delay for:
[0019]
[0020] When the smart vehicle chooses to communicate with the 5G base station, remember nb is the distance between the smart vehicle and the 5G base station, then the channel gain h between the smart vehicle n and the base station nb for:
[0021]
[0022] According to Shannon's theorem, the transmission rate R nb for:
[0023]
[0024] Transmission delay at this time for:
[0025]
[0026] When the sum of the resource blocks required by the tasks selected to communicate with a roadside unit exceeds the total number of resource blocks provided by the roadside unit, the tasks will be transmitted in batches, k n is the batch order to which the tasks of smart vehicle n are randomly assigned, that is, the tasks of smart vehicle n will be assigned in the kth batch. n The batch is transmitted, t in is the time interval between adjacent batches, t in is 10ms, then the total delay in the communication phase is for:
[0027]
[0028] (3) Establish a MEC offloading calculation model;
[0029] When the intelligent vehicle n offloads the task to the roadside MEC server for calculation, the calculation delay for:
[0030]
[0031] Among them, f nm Indicates the computing resources allocated to the roadside MEC server m for computing the task of intelligent vehicle n. The tasks calculated on the roadside MEC server evenly share the computing resources of the server, that is:
[0032]
[0033] Among them, F r is the total computing resources of each roadside MEC server; when the vehicle offloads the task to the 5GMEC server for calculation, the calculation delay for:
[0034]
[0035] Among them, f nb represents the computing resources allocated by the 5G MEC server for the task of vehicle n; the tasks calculated on the 5G MEC server are evenly distributed among the server’s computing resources, that is:
[0036]
[0037] The cloud server is equipped with rich computing and storage capabilities. When executing remote cloud computing tasks, the average processing time required and the delay of data transmission from the roadside unit or 5G base station to the cloud server via the remote wired network is a constant value τ c , which includes the task execution time calculated on the cloud server and the return line access time from the roadside unit to the cloud server. Therefore, when the smart vehicle n offloads the task to the cloud server for calculation, the calculation delay for:
[0038]
[0039] According to the above content, the total task delay T of intelligent vehicle n n for:
[0040]
[0041] Step 2: Mathematically model the unloading decision optimization problem with the goal of minimizing the weighted delay of the task of the intelligent vehicle;
[0042] The weight λ of the intelligent vehicle nn for:
[0043]
[0044] Therefore, the problem to be optimized by this method, that is, the sum of the weighted delays of all vehicle tasks in the scene is:
[0045]
[0046] Among the constraints:
[0047] C1 means that the smart vehicle can only communicate with one roadside unit or 5G base station at a time;
[0048] C2 means that the task can only be computed on a roadside MEC or 5G MEC or cloud server;
[0049] C3 indicates that the task of smart vehicle n can only be offloaded to a roadside MEC server for calculation or not offloaded to a roadside MEC server for calculation;
[0050] C4 indicates that the task of smart vehicle n can only be offloaded to the 5G MEC server for calculation or not offloaded to the 5G MEC server for calculation;
[0051] C5 indicates that the task of smart vehicle n can only be offloaded to the cloud server for calculation or not offloaded to the cloud server for calculation;
[0052] C6 represents the channel resource constraints imposed on each roadside unit;
[0053] C7 represents the channel resource constraints imposed on 5G base stations;
[0054] Step 3: Convert the task offloading decision optimization problem into a Markov decision process and define the state space, action space and reward mechanism for it;
[0055] (1) State space s t is defined as:
[0056] s t ={s1(t),s2(t),…,s n (t),…s N (t)} (16)
[0057] in, D n is the data size of the task, C n is the amount of computing resources required for the task data of the task unit, The maximum acceptable delay for completing the task is B n The number of channel resource blocks / subchannels occupied when uploading the task;
[0058] (2) Action space a t, that is, the offloading decision of all intelligent vehicles’ tasks, a t It is expressed as:
[0059] a t ={a1(t),a2(t),…,a n (t),…,a N (t)} (17)
[0060] Among them, a n (t) = [a n (t),b n1 (t),b n2 (t),…,b nM (t),b nb (t),b nc (t)], represents the task offloading decision of intelligent vehicle n; for the convenience of optimization, a n (t) is rewritten as an array of length 2*(M+2), the first (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the roadside unit, and the second (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the base station;
[0061] (3) Reward mechanism: The reward value is set according to the weighted sum of the task delays of the intelligent vehicles in a time slot in the system. t Set to the inverse of the weighted sum of delays, r t It is expressed as:
[0062]
[0063] Then the long-term reward R is:
[0064]
[0065] Among them, μ is the discount factor. When the calculation delay of a task exceeds its maximum tolerable delay, the reward value will be reduced as a penalty. At the same time, when the sum of the communication resources occupied by the tasks connected to the same roadside unit exceeds the communication resources provided by the roadside unit, the decision is considered invalid and a new decision is made.
[0066] (4) According to the above definition, the original optimization problem is transformed into a Markov decision problem, and the transformed problem is expressed as:
[0067]
[0068] Step 4: Design the neural network required for the discrete soft actor-critic algorithm;
[0069] The discrete soft actor-critic algorithm has two neural networks, the Actor network and the Critic network; the Actor network uses a three-layer fully connected neural network, the first layer contains 4*N neurons, the second layer contains 64 neurons, the activation function is the Relu function, the third layer has N groups of outputs, the connection is (M+2)*N neurons, and the activation function is the Softmax function; the 4 Critic networks use a three-layer fully connected neural network, the first layer contains 4*N neurons, the second layer contains 128 neurons, the activation function is the Relu function, the third layer contains (M+2)*N neurons, the third layer outputs the action-state pair value, and the third layer outputs the state value estimate;
[0070] Step 5: Task offloading decision optimization based on discrete soft actor-critic algorithm. The specific process is as follows:
[0071] Process (1): Initialize the scenario parameters, including: the number of roadside units M, the number of vehicles N, the resource block size / subchannel bandwidth B, the bandwidth of each base station B b , the bandwidth of each roadside unit is B r , vehicle upload power p n , time interval between adjacent batches t in ; Initialize network training parameters, including: Actor network parameters θ, Q0 Critic network parameters ω (0) 、Network parameters ω of Q1Critic network (1) , the network parameters of V Critic network ω (v) , Network parameters of Target V Critic network and temperature parameter α; the agent’s experience pool The size is 500, the sampling upper limit is 1000, the starting training experience number min_size is 200, the number of training rounds num_epochs is 1000, the number of experience batches required for a single training is 64, the soft update parameter ρ is 0.005, the discount factor μ is 0.9, and the target temperature parameter is -0.1, and the Actor network learning rate is 10 -3 , the critic network learning rate is 10 -2 , the learning rate is 10 -2 , the optimizer is Adam;
[0072] Process (2): Obtain the initial state s from the environment according to formula (16) t ; Set r = 0, t = 0; Clear the experience pool ;
[0073] Process (3): Actor network according to state st Output all action probabilities π(a|s t ), determine the action a at time t by sampling t , the agent performs a t and interact with the environment to obtain s t+1 , r t+1 ; If the channel resources of all roadside units are not overloaded, the sampled data {s t ,a t ,r t ,s t '}Store to experience pool In t 's as the next time slot t , t = t + 1; if the channel resources of a roadside unit are overloaded, that is, the sum of the channel resources occupied by the tasks generated by the vehicles communicating with the roadside unit exceeds the total channel resources of the roadside unit, the action at time t needs to be re-determined;
[0074] Process (4): Repeat process (3) until t reaches the experience pool The size is 500 or the sampling limit of 1000 is reached;
[0075] Process (5): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), calculate the state value estimate of the V Critic network according to formula (21) And use formula (22) as the Loss function to train the V Critic network:
[0076]
[0077] where a t ' is all possible actions re-predicted by the unupdated Actor network π; α is the temperature parameter; q0 is the output of the Q0Critic network, q1 is the output of the Q1Critic network, and v is the output of the VCritic network;
[0078] Process (6): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), the true value estimate of the Q Critic function is obtained according to formula (23) And use formula (24) as the loss function to train the networks Q0 and Q1:
[0079]
[0080] in represents the experience pool;
[0081] Process (7): Train the Actor network using formula (25) as the Loss function:
[0082]
[0083] Where π is the output of the Actor network;
[0084] Process (8): Use formula (26) as the Loss function to train the temperature parameter α:
[0085]
[0086] Process (9): Update the Target V Critic network using the weighted summation method:
[0087]
[0088] Where ρ is the soft update parameter;
[0089] Process (10): loop process (2) to process (9) for num_epoches times; clear the experience pool
[0090] Process (11) At this point, the training is completed. The task state s(t) of the intelligent vehicle in the scene is input into the Actor network, and the output π of the Actor network is sampled probabilistically through the sample function to obtain the required unloading strategy for each intelligent vehicle.
[0091] Compared with the prior art, the present invention has the following beneficial effects:
[0092] The present invention provides a MEC task offloading decision method based on a discrete soft actor-critic algorithm, designs 1 Actor network, 2 Q Critic networks, 1 V Critic network and 1 Target V Critic network, and uses the temperature parameter to increase the exploration ability of the intelligent agent. Compared with other classic task offloading decision schemes, lower task processing latency can be achieved under different total computing resource sizes and different task data sizes. By optimizing the task offloading decision, the shortcomings of MEC technology in the task offloading problem of Internet of Vehicles are effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0093] Figure 1 The overall flow chart of the MEC task offloading decision method based on the discrete soft actor-critic algorithm provided by the present invention.
[0094] Figure 2A flowchart of the neural network required for the discrete soft actor-critic algorithm in step 4 of this method. DETAILED DESCRIPTION
[0095] The present invention provides a MEC task offloading decision method based on a discrete soft actor-critic algorithm. By establishing a mathematical model for a PC5-Uu dual-communication mode MEC system including a remote cloud server, a roadside MEC server, a base station MEC server, multiple roadside units, a base station and multiple vehicles, in the face of a task offloading process in which a vehicle transmits task data to a computing destination for processing, the offloading decision optimization problem with the goal of minimizing the weighted delay of the task of the intelligent vehicle is converted into a Markov decision problem, and the discrete soft actor-critic algorithm is used to optimize the task offloading scheme of the vehicle in the scene, and the best destination and the best path for the vehicle to offload the task are found, thereby minimizing the vehicle task delay. The method is characterized in that the specific steps are as follows:
[0096] Step 1: Establish a MEC offloading model;
[0097] The MEC offloading model is a general model, which is a model established for the complete MEC system, including the MEC offloading scenario model, the MEC offloading communication model, and the MEC offloading calculation model;
[0098] (1) Establish a MEC offloading scenario model;
[0099] The MEC system contains a two-way road with M equally spaced roadside units S = {S1, S2, ..., S M}, each roadside unit is connected to a roadside MEC server in a wired manner and adjacent roadside units are also connected in a limited manner. The total computing resources of a single roadside MEC server are F r , roadside unit m represents one of the M roadside units, that is, m∈M; the set of N intelligent vehicles equipped with OBU and vehicle Ethernet on the road is set to V={V1,V2,…,V N}, each of which can communicate with the roadside unit in the communication range in PC5 mode and offload the task to the MEC server matching the roadside unit for calculation. Smart vehicle n represents one of the N smart vehicles, that is, n∈N; all smart vehicles in the scene generate a task to be processed at the same time in each time slot, and the task generated by smart vehicle n is set to Where D n is the data size of the task, C n is the amount of computing resources required for the task data of the task unit, The maximum acceptable delay for completing the task is B nis the number of channel resource blocks / subchannels occupied when uploading the task. When the smart vehicle communicates with the roadside unit, it can occupy 1 to 5 resource blocks. In addition, there is a 5G base station in the scene, which communicates with the surrounding roadside units in a wired manner. It can also communicate with smart vehicles within the communication range through the Uu mode. The 5G base station is connected to the 5G MEC server in a wired manner. The computing resources of the 5G MEC server are F b , and communicate with the remote cloud server in a long-distance wired manner; 1 5G base station and M roadside units and their matching MEC servers constitute a joint edge node. Because there are wired connections between each roadside unit and between each roadside unit and the 5G base station, task data can be quickly transferred between different edge computing servers through these short-range wired connections;
[0100] Taking into account the limited computing power of smart vehicle equipment and the impact of task data processing on the energy consumption of smart vehicles, in the scenario designed by this method, smart vehicles do not directly process tasks. The tasks generated by smart vehicles are calculated by different MEC servers and remote cloud servers. All tasks generated in the same time slot are considered to be generated simultaneously. Considering that the bandwidth resources used for wired communication are very abundant and the communication rate is extremely high, this method ignores the delay of short-range wired communication and only considers the delay generated when the task is offloaded to the remote cloud server. This method does not consider the time to generate data instances after the task data is uploaded. The 5G base station is equipped with a MEC system controller, which is responsible for judging the offloading decision and communication resource allocation. After the smart vehicle generates a task, it transmits the task-related information to the MEC system controller, and the controller will output (transmit back) the offloading decision and communication resource allocation decision corresponding to each task. Since the data of task information and decision results are very small, the delay of this stage is ignored.
[0101] (2) Establishing a MEC offloading communication model;
[0102] When a smart vehicle communicates with a roadside unit in PC5 mode, the total bandwidth of a single roadside unit is W r , the total bandwidth is divided into multiple resource blocks in the frequency domain, and the bandwidth of a resource block is W rb When different intelligent vehicles perform task offloading, the number of resource blocks occupied by task data is also different. When each task is transmitted, the side chain control information (SCI) that occupies two resource blocks is also transmitted at the same time. However, since the amount of this information is too small compared with the task data, its size is ignored, and the size of the transmitted data is approximately the size of the task data. When the intelligent vehicle communicates with the 5G base station in Uu mode, the total bandwidth is W b , the channel is divided into multiple sub-channels in the frequency domain, and the sub-channel bandwidth is W bb ,Different smart vehicles will occupy different numbers of sub-channels when transmitting data.
[0103] The connection decision variable is a n = {0,1}, indicating that the smart vehicle n chooses to communicate with the roadside unit or the 5G base station, a n = 0 means that the smart vehicle n chooses to communicate with the roadside unit, a n =1 means that the intelligent vehicle n chooses to communicate with the 5G base station; calculate the decision variable b n = {b n1 ,b n2 ,…,b nM ,b nb ,b nc} The smart vehicle chooses to offload the task to one of the m roadside MEC servers, the 5G MEC server or the cloud server for calculation, b n Each item in b can only take the value 0 or 1 and b n Only one of the items in can be 1, that is, it satisfies If b n1 ,b n2 ,…,b nM If one of b is 1, it means that the task of smart vehicle n will be offloaded to the corresponding roadside MEC server; if b nb If b is 1, it means that the task of smart vehicle n will be offloaded to the 5G MEC server; if b nc If it is 1, it means that the task of smart vehicle n will be offloaded to the cloud server;
[0104] When a smart vehicle chooses to communicate with a roadside unit, nr is the distance between the smart vehicle and the roadside unit, then the channel gain h between the smart vehicle n and the roadside unit m nr for:
[0105]
[0106] According to Shannon's theorem, the transmission rate R nr for:
[0107]
[0108] Among them, p n is the transmission power of smart vehicle n, p n 4W; 2 is the noise power of the wireless channel, σ 2 is -114dbm; at this time the transmission delay for:
[0109]
[0110] When the smart vehicle chooses to communicate with the 5G base station, remembernb is the distance between the smart vehicle and the base station, then the channel gain h between the smart vehicle n and the base station nb for:
[0111]
[0112] According to Shannon's theorem, the transmission rate R nb for:
[0113]
[0114] Transmission delay for:
[0115]
[0116] When the total number of resource blocks required for the tasks selected to communicate with a roadside unit exceeds the total number of resource blocks provided by the roadside unit, the tasks will be transmitted in batches.
[0117] k n is the batch order to which the tasks of smart vehicle n are randomly assigned, that is, the tasks of smart vehicle n will be assigned in the kth batch. n The batch is transmitted, t in is the time interval between adjacent batches, t in is 10ms, then the total delay in the communication phase is for:
[0118]
[0119] (3) Establish a MEC offloading calculation model;
[0120] When smart vehicle n offloads the task to the roadside MEC server for calculation, the calculation delay T n c r o for:
[0121]
[0122] Among them, f nm Indicates the computing resources allocated to the roadside MEC server m for computing the task of intelligent vehicle n. The tasks calculated on the roadside MEC server evenly share the computing resources of the server, that is:
[0123]
[0124] Among them, F r is the total computing resources of each roadside MEC server; when the smart vehicle offloads the task to the 5GMEC server for computing, the computing delay for:
[0125]
[0126] Among them, f nb It indicates the computing resources allocated by the 5G MEC server for the task of intelligent vehicle n. The tasks calculated on the 5G MEC server evenly share the computing resources of the server, that is:
[0127]
[0128] The cloud server is equipped with rich computing and storage capabilities. When executing remote cloud computing tasks, the average processing time required and the delay of data transmission from the roadside unit or 5G base station to the cloud server via the remote wired network is a constant value τ c , which includes the task execution time calculated on the cloud server and the return line access time from the roadside unit to the cloud server. Therefore, when the smart vehicle n offloads the task to the cloud server for calculation, the calculation delay for:
[0129]
[0130] This method ignores the delay formed by the service entity, the delay of short-distance wired communication and the delay of the result back to the smart vehicle. Therefore, according to the above content, the total task delay T of smart vehicle n is n for:
[0131]
[0132] Step 2: Mathematically model the unloading decision optimization problem with the goal of minimizing the weighted delay of the task of the intelligent vehicle;
[0133] The weight of the task uploaded by smart vehicle n is λ n for:
[0134]
[0135] Therefore, the problem to be optimized by this method, that is, the sum of the weighted delays of all intelligent vehicle tasks in the scene is:
[0136]
[0137] Among the constraints:
[0138] C1 means that the smart vehicle can only communicate with one roadside unit or 5G base station at a time;
[0139] C2 means that the task can only be computed on a roadside MEC or 5G MEC or cloud server;
[0140] C3 indicates that the task of smart vehicle n can only be offloaded to a roadside MEC server for calculation or not offloaded to a roadside MEC server for calculation;
[0141] C4 indicates that the task of smart vehicle n can only be offloaded to the 5G MEC server for calculation or not offloaded to the 5G MEC server for calculation;
[0142] C5 indicates that the task of smart vehicle n can only be offloaded to the cloud server for calculation or not offloaded to the cloud server for calculation;
[0143] C6 represents the channel resource constraints imposed on each roadside unit;
[0144] C7 indicates the channel resource constraints imposed on 5G base stations;
[0145] Step 3: Convert the task offloading decision optimization problem into a Markov decision process and define the state space, action space and reward mechanism for it;
[0146] (1) State space s t is defined as:
[0147] s t ={s1(t),s2(t),…,s n (t),…s N (t)} (16)
[0148] in, D n is the data size of the task, C n is the amount of computing resources required for the task data per task, T n max The maximum acceptable delay for completing the task is B n The number of channel resource blocks / sub-channels occupied when uploading the task;
[0149] (2) Action space a t , that is, the offloading decision of all intelligent vehicles’ tasks, a t It is expressed as:
[0150] a t ={a1(t),a2(t),…,a n (t),…,a N (t)} (17)
[0151] Among them, a n (t) = [a n (t),b n1 (t),b n2 (t),…,b nM (t),b nb (t),b nc(t)], represents the task offloading decision of intelligent vehicle n; for the convenience of optimization, a n (t) is rewritten as an array of length 2*(M+2), the first (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the roadside unit, and the second (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the base station;
[0152] (3) Reward mechanism: The reward value is set according to the weighted sum of the task delays of the intelligent vehicles in a time slot in the system. t Set to the inverse of the weighted sum of delays, r t It is expressed as:
[0153]
[0154] The long-term reward R is:
[0155]
[0156] Among them, μ is the discount factor. When the calculation delay of a task exceeds its maximum tolerable delay, the reward value will be reduced as a penalty. At the same time, when the sum of the communication resources occupied by the tasks connected to the same roadside unit exceeds the communication resources provided by the roadside unit, the decision is considered invalid and a new decision is made.
[0157] (4) According to the above definition, the original optimization problem is transformed into a Markov decision problem, and the transformed problem is expressed as:
[0158]
[0159] Step 4: Design the neural network required for the discrete soft actor-critic algorithm;
[0160] The discrete soft actor-critic algorithm has two neural networks: the Actor network and the Critic network; Figure 2 As shown in the figure, the Actor network uses a three-layer fully connected neural network. The first layer contains 4*N neurons, the second layer contains 64 neurons, the activation function is the Relu function, the third layer has N groups of outputs, the connection is (M+2)*N neurons, and the activation function is the Softmax function; the four Critic networks use a three-layer fully connected neural network. The first layer contains 4*N neurons, the second layer contains 128 neurons, the activation function is the Relu function, and the third layer contains (M+2)*N neurons. The output of the third layer of the Q Critic network is the action-state pair value, and the output of the third layer of the V Critic network is the state value estimate;
[0161] Step 5: Task offloading decision optimization based on discrete soft actor-critic algorithm. The specific process is as follows:
[0162] Process (1): Initialize the scenario parameters, including: the number of roadside units M, the number of smart vehicles N, the resource block size / subchannel bandwidth B, the bandwidth of each base station B b , the bandwidth of each roadside unit is B r , smart vehicle upload power p n , time interval between adjacent batches t in ; Initialize network training parameters, including: Actor network parameters θ, Q0 Critic network parameters ω (0) 、Network parameters ω of Q1 Critic network (1) , the network parameters of V Critic network ω (v) , Network parameters of Target V Critic network and temperature parameter α; the agent’s experience pool The size is 500, the sampling upper limit is 1000, the starting training experience number min_size is 200, the number of training rounds num_epochs is 1000, the number of experience batches required for a single training is 64, the soft update parameter ρ is 0.005, the discount factor μ is 0.9, and the target temperature parameter is -0.1, and the Actor network learning rate is 10 -3 , the critic network learning rate is 10 -2 , the learning rate is 10 -2 , the optimizer is Adam;
[0163] Process (2): Obtain the initial state s from the environment according to formula (16) t ; Set r = 0, t = 0; Clear the experience pool
[0164] Process (3): Actor network according to state s t Output all action probabilities π(a|s t ), determine the action a at time t by sampling t , the agent executes a t and interact with the environment to obtain s t+1 , r t+1 ; If the channel resources of all roadside units are not overloaded, the sampled data {s t ,a t ,r t ,s t '}Store to experience pool In t 's as the next time slot t, t = t + 1; if the channel resources of a roadside unit are overloaded, that is, the sum of the channel resources occupied by the tasks generated by the vehicles communicating with the roadside unit exceeds the total channel resources of the roadside unit, the action at time t needs to be re-determined;
[0165] Process (4): Repeat process (3) until t reaches the experience pool The size is 500 or the sampling limit of 1000 is reached;
[0166] Process (5): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), calculate the state value estimate U of the V Critic network according to formula (21) t (v) And use formula (22) as the Loss function to train the network V Critic:
[0167]
[0168] where a t ' is all possible actions re-predicted by the unupdated Actor network π; α is the temperature parameter; q0 is the output of the Q0Critic network, q1 is the output of the Q1Critic network, and v is the output of the VCritic network;
[0169] Process (6): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), the true value estimate of the Q Critic function is obtained according to formula (23) And use formula (24) as the loss function to train the networks Q0 and Q1:
[0170]
[0171] in Represents experience pool;
[0172] Process (7): Train the Actor network using formula (25) as the Loss function:
[0173]
[0174] Where π is the output of the Actor network;
[0175] Process (8): Use formula (26) as the Loss function to train the temperature parameter α:
[0176]
[0177] Process (9): Update the Target V Critic network using the weighted summation method:
[0178]
[0179] Where ρ is the soft update parameter;
[0180] Process (10): loop steps (2) to (9) for num_epoches times; clear the experience pool ;
[0181] Process (11): At this point, the training is completed. The task state s(t) of the smart vehicle in the scene is input into the Actor network. The output π of the Actor network is sampled probabilistically through the sample function to obtain the required unloading strategy for each smart vehicle.
Claims
1. A MEC task offloading decision method based on a discrete soft actor-critic algorithm, by establishing a mathematical model for a PC5-Uu dual-communication mode MEC system including a remote cloud server, a roadside MEC server, a base station MEC server, multiple roadside units, a base station and multiple smart vehicles, in the face of the task offloading process in which smart vehicles transmit task data to a computing destination for processing, the offloading decision optimization problem with the goal of minimizing the weighted delay of smart vehicle users' tasks is converted into a Markov decision problem, and the discrete soft actor-critic algorithm is used to optimize the task offloading scheme of smart vehicles in the scene, find the best destination and the best path for task offloading for smart vehicles, thereby minimizing the task delay of smart vehicles, characterized in that, The specific steps are as follows: Step 1: Establish a MEC offloading model; The MEC offloading model is a general model, which is a model established for the complete MEC system, including the MEC offloading scenario model, the MEC offloading communication model, and the MEC offloading calculation model; (1) Establish a MEC offloading scenario model; The MEC system contains a two-way road with M roadside units S={S1,S2,…,S M }, each roadside unit is connected to a roadside MEC server in a wired manner and the adjacent roadside units are also connected in a wired manner. The total computing resources of a single roadside MEC server are F r , roadside unit m represents one of the M roadside units, that is, m∈M; the set of N intelligent vehicles equipped with OBU and vehicle Ethernet on the road is set to V={V1,V2,…,V N }, each of which can communicate with the roadside unit in the communication range in PC5 mode and offload the task to the MEC server matching the roadside unit for calculation. Smart vehicle n represents one of the N smart vehicles, that is, n∈N; all smart vehicles in the scene generate a task to be processed at the same time in each time slot, and the task generated by smart vehicle n is set to Where D n is the data size of the task, C n is the amount of computing resources required for the task data of the task unit, The maximum acceptable delay to complete the task; B n is the number of channel resource blocks / subchannels occupied when uploading the task. When the smart vehicle communicates with the roadside unit, it can occupy 1 to 5 resource blocks. In addition, there is a 5G base station in the scene, which communicates with the surrounding roadside units by wired connection. It can also communicate with smart vehicles within the communication range through Uu mode. The 5G base station is connected to the 5G MEC server by wire. The computing resources of the 5G MEC server are F b , and communicate with the remote cloud server in a long-distance wired manner; 1 5G base station and M roadside units and their matching MEC servers constitute a joint edge node, and each roadside unit and the roadside unit and 5G base station are wired connected; (2) Establishing a MEC offloading communication model; When a smart vehicle communicates with a roadside unit in PC5 mode, the total bandwidth of a single roadside unit is W r , the total bandwidth is divided into multiple resource blocks in the frequency domain, and the bandwidth of a resource block is W rb ; When the smart vehicle communicates with the 5G base station in Uu mode, the total bandwidth is W b , the channel is divided into multiple sub-channels in the frequency domain, and the sub-channel bandwidth is W bb ; The connection decision variable is a n = {0,1}, indicating that the smart vehicle n chooses to communicate with the roadside unit or the 5G base station, a n = 0 means that the smart vehicle n chooses to communicate with the roadside unit, a n =1 means that the smart vehicle n chooses to communicate with the 5G base station; Calculate the decision variable b n = {b n1 ,b n2 ,…,b nM ,b nb ,b nc } For smart vehicles, choose to offload tasks to a roadside MEC server, 5GMEC server or cloud server for calculation, b n Each item in b can only take the value 0 or 1 and b n Only one of the items in can be 1, that is, it satisfies If b n1 ,b n2 ,…,b nM If one of b is 1, it means that the task of smart vehicle n will be offloaded to the corresponding roadside MEC server; if b nb If b is 1, it means that the task of smart vehicle n will be offloaded to the 5G MEC server; if b nc If it is 1, it means that the task of smart vehicle n will be offloaded to the cloud server; When a smart vehicle chooses to communicate with a roadside unit, nr is the distance between the smart vehicle and the roadside unit, then the channel gain h between the smart vehicle n and the roadside unit m nr for: According to Shannon's theorem, the transmission rate R nr for: Among them, p n is the transmission power of smart vehicle n, p n is 4W; 2 is the noise power of the wireless channel, σ 2 is -114dbm; at this time the transmission delay for: When the smart vehicle chooses to communicate with the 5G base station, remember nb is the distance between the smart vehicle and the 5G base station, then the channel gain h between the smart vehicle n and the base station nb for: According to Shannon's theorem, the transmission rate R nb for: Transmission delay at this time for: When the sum of the resource blocks required by the tasks selected to communicate with a roadside unit exceeds the total number of resource blocks provided by the roadside unit, the tasks will be transmitted in batches, k n is the batch order to which the tasks of smart vehicle n are randomly assigned, that is, the tasks of smart vehicle n will be assigned in the kth batch. n The batch is transmitted, t in is the time interval between adjacent batches, t in is 10ms, then the total delay in the communication phase is for: (3) Establish a MEC offloading calculation model; When the intelligent vehicle n offloads the task to the roadside MEC server for calculation, the calculation delay for: Among them, f nm Indicates the computing resources allocated to the roadside MEC server m for computing the task of intelligent vehicle n. The tasks calculated on the roadside MEC server evenly share the computing resources of the server, that is: where F r is the total computing resources of each roadside MEC server; when the smart vehicle offloads the task to the 5GMEC server for computing, the computing delay for: Among them, f nb It indicates the computing resources allocated by the 5G MEC server for the task of intelligent vehicle n; the tasks calculated on the 5G MEC server are evenly distributed among the server’s computing resources, that is: The cloud server is equipped with rich computing and storage capabilities. When executing remote cloud computing tasks, the average processing time required and the delay of data transmission from the roadside unit or 5G base station to the cloud server via the remote wired network is a constant value τ c , which includes the task execution time calculated on the cloud server and the return line access time from the roadside unit to the cloud server. Therefore, when the smart vehicle n offloads the task to the cloud server for calculation, the calculation delay for: According to the above content, the total task delay T of intelligent vehicle n n for: Step 2: Mathematically model the unloading decision optimization problem with the goal of minimizing the weighted delay of the task of the intelligent vehicle; The weight λ of the intelligent vehicle n n for: Therefore, the problem to be optimized by this method, that is, the sum of the weighted delays of all intelligent vehicle tasks in the scene is: Among the constraints: C1 means that the smart vehicle can only communicate with one roadside unit or 5G base station at a time; C2 means that the task can only be computed on a roadside MEC or 5G MEC or cloud server; C3 indicates that the task of smart vehicle n can only be offloaded to a roadside MEC server for calculation or not offloaded to a roadside MEC server for calculation; C4 indicates that the task of smart vehicle n can only be offloaded to the 5G MEC server for calculation or not offloaded to the 5G MEC server for calculation; C5 indicates that the task of smart vehicle n can only be offloaded to the cloud server for calculation or not offloaded to the cloud server for calculation; C6 represents the channel resource constraints imposed on each roadside unit; C7 represents the channel resource constraints imposed on 5G base stations; Step 3: Convert the task offloading decision optimization problem into a Markov decision process and define the state space, action space and reward mechanism for it; (1) State space s t is defined as: s t ={s1(t),s2(t),…,s n (t),…s N (t)} (16) in, D n is the data size of the task, C n is the amount of computing resources required for the task data of the task unit, The maximum acceptable delay for completing the task is B n The number of channel resource blocks / subchannels occupied when uploading the task; (2) Action space a t , that is, the offloading decision of all intelligent vehicles’ tasks, a t It is expressed as: a t ={a1(t),a2(t),…,a n (t),…,a N (t)} (17) Among them, a n (t) = [a n (t),b n1 (t),b n2 (t),…,b nM (t),b nb (t),b nc (t)], represents the task offloading decision of intelligent vehicle n; for the convenience of optimization, a n (t) is rewritten as an array of length 2*(M+2), the first (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the roadside unit, and the second (M+2) bits indicate whether the intelligent vehicle n unloads the task to the corresponding destination for calculation when choosing to communicate with the base station; (3) Reward mechanism: The reward value is set according to the weighted sum of the task delays of the intelligent vehicles in a time slot in the system, and the immediate reward is set to r t is the inverse of the weighted sum of delays, r t It is expressed as: The long-term reward R is: Among them, μ is the discount factor. When the calculation delay of a task exceeds its maximum tolerable delay, the reward value will be reduced as a penalty. At the same time, when the sum of the communication resources occupied by the tasks connected to the same roadside unit exceeds the communication resources provided by the roadside unit, the decision is considered invalid and a new decision is made. (4) According to the above definition, the original optimization problem is transformed into a Markov decision problem, and the transformed problem is expressed as: Step 4: Design the neural network required for the discrete soft actor-critic algorithm; The discrete soft actor-critic algorithm has two neural networks, the Actor network and the Critic network; the Actor network uses a three-layer fully connected neural network, the first layer contains 4*N neurons, the second layer contains 64 neurons, the activation function is the Relu function, the third layer has N groups of outputs, the connection is (M+2)*N neurons, and the activation function is the Softmax function; the 4 Critic networks use a three-layer fully connected neural network, the first layer contains 4*N neurons, the second layer contains 128 neurons, the activation function is the Relu function, the third layer contains (M+2)*N neurons, the third layer outputs the action-state pair value, and the third layer outputs the state value estimate; Step 5: Task offloading decision optimization based on discrete soft actor-critic algorithm. The specific process is as follows: Process (1): Initialize scenario parameters, including: number of roadside units M, number of smart vehicles N, resource block size / subchannel bandwidth B, bandwidth of each base station B b , the bandwidth of each roadside unit is B r , smart vehicle upload power p n , time interval between adjacent batches t in ; Initialize network training parameters, including: Actor network parameters θ, Q0 Critic network parameters ω (0) 、Network parameters ω of Q1 Critic network (1) , the network parameters of V Critic network ω (v) , Network parameters of Target V Critic network and temperature parameter α; the agent’s experience pool The size is 500, the sampling upper limit is 1000, the starting training experience number min_size is 200, the number of training rounds num_epochs is 1000, the number of experience batches required for a single training is 64, the soft update parameter ρ is 0.005, the discount factor μ is 0.9, and the target temperature parameter is -0.1, and the Actor network learning rate is 10 -3 , the critic network learning rate is 10 -2 , the learning rate is 10 -2 , the optimizer is Adam; Process (2): Obtain the initial state s from the environment according to formula (16) t ; Set r = 0, t = 0; Clear the experience pool Process (3): Actor network according to state s t Output all action probabilities π(a|s t ), determine the action a at time t by sampling t , the agent performs a t and interact with the environment to obtain s t+1 , r t+1 ; If the channel resources of all roadside units are not overloaded, the sampled data {s t ,a t ,r t ,s t '}Store to experience pool In t 's as the next time slot t , t = t + 1; if the channel resources of a roadside unit are overloaded, that is, the sum of the channel resources occupied by the tasks generated by the vehicles communicating with the roadside unit exceeds the total channel resources of the roadside unit, the action at time t needs to be re-determined; Process (4): Repeat process (3) until t reaches the experience pool The size is 500 or the sampling limit of 1000 is reached; Process (5): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), calculate the state value estimate of the V Critic network according to formula (21) And use formula (22) as the Loss function to train the V Critic network: where a t ' is all possible actions re-predicted by the unupdated Actor network π; α is the temperature parameter; q0 is the output of the Q0Critic network, q1 is the output of the Q1Critic network, and v is the output of the VCritic network; Process (6): Extract data from the experience pool (s t ,a t ,s t+1 ,r t+1 ), the true value estimate of the Q Critic function is obtained according to formula (23) And use formula (24) as the loss function to train the networks Q0 and Q1: in Represents experience pool; Process (7): Train the Actor network using formula (25) as the Loss function: Where π is the output of the Actor network; Process (8): Use formula (26) as the Loss function to train the temperature parameter α: Process (9): Update the Target V Critic network using the weighted summation method: Where ρ is the soft update parameter; Process (10): loop process (2) to process (9) for num_epoches times; clear the experience pool Process (11): At this point, the training is completed. The task state s(t) of the smart vehicle in the scene is input into the Actor network. The output π of the Actor network is sampled probabilistically through the sample function to obtain the required unloading strategy for each smart vehicle.
Citation Information
Cited By
Calculation unloading and caching joint optimization method and device based on improved A3C algorithm
CN120075897A
