Task unloading method based on meta reinforcement learning
By adopting the Seq2Seq network model that combines meta-reinforcement learning and GRU attention mechanism in the edge computing environment, it solves the problem of task offloading decision-making under limited resources, achieves more efficient resource utilization and faster task processing, and reduces the cost of user equipment. delay and energy consumption.
Patent Information
- Application Number
- CN202410858517.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-22
AI Technical Summary
In an edge computing environment with limited resources, how to effectively make task offloading decisions, especially how to optimize the energy consumption and delay of user equipment in complex and changeable environments with different task sequence dimensions.
Using a task offloading method based on meta-reinforcement learning, the task offloading process is modeled as multiple Markov decision processes, combined with the Seq2Seq network model of the GRU attention mechanism and the TD3 algorithm, and integrated into the MR-TD3 algorithm. By constructing DAG and Markov Kov decision model, calculates delay and energy consumption, optimizes resource allocation and offloading strategies.
It improves the efficiency and stability of task offloading, can better handle diverse inputs, enhances understanding of task relationships, achieves more efficient resource utilization and faster task processing time, and reduces device delays and energy consumption.
Smart Images

Figure CN118819836A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing technology, and in particular to a task offloading method based on meta-reinforcement learning. Background Art
[0002] With the rapid development of communication technologies such as 5G and the Internet of Things, the access of user devices has shown an exponential growth. Although emerging technologies bring convenience to life, they also bring challenges such as latency, energy consumption, and cost. When performing computationally intensive tasks, the load limit of user devices becomes a significant problem. In order to solve this problem, edge computing came into being. Task offloading, as a distributed computing paradigm, effectively alleviates the above challenges by deploying edge servers at the edge of the network. Edge servers have computing and decision-making capabilities. Users can offload tasks to edge servers to reduce transmission energy consumption and transmission latency while meeting task computing requirements. Although edge servers provide computing and storage, providing computing for all user devices becomes a key issue due to limited resources. How to provide users with the best offloading decision under limited resources has become a problem that needs to be solved at present.
[0003] With the rapid development of edge computing, task offloading has become an effective means to improve the performance of mobile applications. Task offloading is a technology that offloads some or all tasks of a mobile application from the user's device to an edge server or cloud. However, existing technologies still have problems in complex and changing environments, especially when the task sequence dimensions are different. At the same time, the energy consumption of the device and the delay of the task are still bottlenecks that need to be solved urgently.
[0004] (1) Environmental complexity: Mobile environments often face uncertainties such as network fluctuations and insufficient computing resources.
[0005] (2) Different dimensions of task sequences: Mobile applications usually consist of multiple tasks, which may have different execution times, resource requirements, and priorities. In the existing technology, how to conduct effective training and decision-making for the case of different dimensions of task sequences remains a challenge.
[0006] (3) Energy consumption and delay optimization: The resources of user devices are limited, and users are sensitive to the delay of task execution. Summary of the invention
[0007] The purpose of the present invention is to provide a task offloading method based on meta-reinforcement learning, model the task offloading process as multiple Markov decision processes, construct a Seq2Seq (Sequence-to-Sequence) network model based on a GRU (Gated Recurrent Unit) attention mechanism, and integrate the MR-TD3 algorithm of meta-reinforcement learning and the TD3 algorithm, thereby improving the efficiency and stability of task offloading.
[0008] The technical solution of the present invention is to propose a task offloading method based on meta-reinforcement learning, comprising the following steps:
[0009] S1. Establish a task offloading scenario of a multi-user single edge server and decompose the task into a series of subtasks with dependencies.
[0010] S2. Model the offloading task as a DAG (Directed Acyclic Graph) according to the application of the user device, and obtain characteristic information of the DAG; wherein the characteristic information of the DAG includes data volume, computing efficiency, offloading method and CPU power.
[0011] S3. Build a Seq2Seq network model based on the GRU attention mechanism, embed the feature information of the DAG in step S2 into the network model, and obtain the offloading sequence of different tasks by more accurately understanding and processing the input sequence. When the model faces diverse inputs, it can still handle them well. Enhance the model's understanding of the relationship between tasks, thereby improving the effect of task offloading.
[0012] S4. Based on the characteristic information of DAG, calculate the total delay and total energy consumption of local task processing and edge task offloading.
[0013] S5. Construct different types of tasks based on the feature information of DAG, model edge task offloading as a Markov decision model, and obtain state function, action function and reward function according to delay and energy consumption.
[0014] S6. According to the function obtained in step S5, MRL (Meta Reinforcement Learning) and TD3 algorithm are integrated to obtain MR-TD3 algorithm to adapt to the adjustment strategy when facing new tasks. The MR-TD3 algorithm is used to process workload and resource allocation to obtain more efficient resource utilization and faster task processing time, thus completing the task offloading.
[0015] Furthermore, in step S1, the unloading task scenario includes the following contents:
[0016] The user device set is N, N = {1, 2, 3, ..., n}, n represents the total number of user devices; each user device has different computing and storage capabilities and is distributed in different geographical locations. The user device communicates and transmits data with the edge server through the mobile communication network to establish an offload task scenario.
[0017] In the offloading task scenario, the user device executes the task according to the status of the local system and the relevant configuration file of the task, decomposes the task into a series of sub-tasks with dependencies, processes the sub-tasks that meet the local resource utilization and task execution time locally; offloads the sub-tasks that meet the network bandwidth and delay to the edge server for processing via wireless channel transmission; returns the processing results to the user device through the network; and sets that the sub-task can only be executed after the task is fully executed and the computing resources of the edge server are sufficient.
[0018] Furthermore, in step S2, the DAG includes the following contents:
[0019] DAG consists of a set of subtasks and a set of directed edges representing the dependencies between subtasks, denoted as Where G represents a directed acyclic graph, T represents a set of subtasks, represents a set of directed edges, t i It is the task j The direct parent task, t j It is the task i subtasks, where j>i; when there are no subtasks in the DAG, it means the task exits.
[0020] Furthermore, in step S3, the unloading sequence of different tasks is obtained, including the following contents:
[0021] The Seq2Seq network model based on the GRU attention mechanism includes a self-attention layer, an encoder, an attention layer and a decoder; the encoder includes a bidirectional gated recurrent unit, and the decoder includes a GRU network with an attention mechanism.
[0022] The feature information of the directed acyclic graph and the dependency relationship of its corresponding input sequence are concatenated to form the input data, which is then input into the network model. The context representation is obtained through the self-attention layer, and then the context vector is generated through the bidirectional processing of the encoder. The specific expression is:
[0023]
[0024]
[0025] in, represents the forward function of the i'th vector in the subtask; f encrepresents the forward function; represents the backward function of the i'th vector in the subtask; represents the forward function of the i'-1th vector in the subtask; b enc represents the backward function; represents the backward function of the i'+1th vector in the subtask; t i+1 represents the i+1th task; h i‘ represents the function of the i'th vector in the subtask; a represents the output weight coefficient of the encoder, a = [0,1]; c represents the context vector, including the forward information and backward information of the subtask.
[0026] The attention layer dynamically selects and focuses on the information in the input data according to the context vector and the state of the decoder, and generates the output sequence [d1, d2, ...d t ], and then obtain the unloading sequence π(α1|s1) of different tasks and its value V(s1), where d t represents the output of the decoder at the tth time step.
[0027] Furthermore, in step S4, the delay and energy consumption are calculated using the data size, computing efficiency, offloading method and CPU power of the tasks in the directed acyclic graph.
[0028] The two uninstallation methods are shown as follows:
[0029]
[0030] During the unloading process, both delay and energy consumption should be considered. The calculation process of delay and energy consumption of the two unloading methods is as follows:
[0031] (1) When the task is executed locally, the delay of the i-th task and energy consumption The calculation formula is:
[0032]
[0033]
[0034] Among them, σ represents the number of CPU execution task instructions, w i represents the data size of the i-th task, f l Indicates the computing efficiency of the local device (i.e., the number of CPU cycles per second), e l Indicates the average energy consumption of executing an instruction locally.
[0035] The total delay when executing locally on n user devices and total energy consumption The calculation formula is:
[0036]
[0037] Where I represents the total number of tasks.
[0038] (2) When the task is offloaded to the edge server, the transmission delay of the i-th task is The calculation formula is:
[0039]
[0040] Among them, b n Indicates the bandwidth between the local user device and the edge server.
[0041] The tasks and data offloaded to the edge server do not need to be returned to the user device in the downlink, only the calculation results need to be transmitted. Therefore, the response time and energy consumption of the downlink are much smaller than those of the uplink, and the return time and energy consumption of the calculation result of the i-th task can be ignored.
[0042] The delay of offloading the i-th task to the edge server Including transmission delay and calculation time, the specific formula is:
[0043]
[0044] Among them, f e Represents the computational efficiency of the edge server.
[0045] The energy consumption of offloading the i-th task to the edge server The calculation formula is:
[0046]
[0047] Among them, e e represents the average energy consumption of an instruction offloaded from the edge, e t Indicates the energy consumed in transmitting a unit size of data.
[0048] The total latency of n user devices offloading to the edge server and total energy consumption The calculation formula is:
[0049]
[0050] The delay T of all tasks total and energy consumption E total The calculation formula is:
[0051]
[0052]
[0053] Furthermore, in step S5, obtaining the state function, action function and reward function includes the following contents:
[0054] Different types of tasks are constructed based on the feature information of the directed acyclic graph and the calculation results of step S4. When the number of calculation instructions is greater than the number of instructions executed locally, the task is offloaded to the edge server, otherwise the task is executed locally. Each Markov decision corresponds to a separate task in meta-learning, and the edge task offloading is modeled as a Markov decision model. The specific expression is:
[0055]
[0056] in, represents the distribution probability of the task, ρ(T) represents the type of task; St represents the state function; A represents the action function; P represents the state transition probability matrix; P0 represents the initial state distribution; R represents the reward function; γ represents the discount factor, γ∈[0,1].
[0057] When the agent interacts with the environment, it sends an action environment to the current state function, gives the next state and reward, and formulates the state function, action function and reward function of Markov decision-making based on the interaction information. The specific contents are as follows:
[0058] When offloading a subtask, the execution delay of the subtask depends on the CPU cycles required for the task, the size of the uploaded and downloaded data, the DAG topology, the execution decision of the previous task, the transmission rate, the device power, and the edge computing resources; the specific expression of the state function is:
[0059]
[0060] Among them, St represents the state function of the i-th task; A 1:i-1 represents the offloading decision record of the first i-1 tasks; Indicates the maximum processing delay of a task. The execution time of a task exceeds The task processing fails.
[0061] In order to convert the subtask set of the DAG topology into a subtask sequence and preserve the priority relationship, add serial numbers to the tasks and sort the subtasks according to the serial numbers. The specific expression is:
[0062]
[0063] Among them, T represents the task set, child(t i ) represents the subtask set of the i-th task, rank(t j ) represents the sequence number of the jth subtask, rank(t i) represents the sequence number of the i-th task.
[0064] Convert the directed acyclic graph into a task vector and a subtask vector of the i-th task. The size of the vector is set to the maximum value contained in all applications or is directly represented by 0 if it is less than the maximum value.
[0065] The unloading location decision of the i-th task is the action function, which is specifically expressed as:
[0066] d′ i ={α t |α t ∈{0,1}}
[0067] Among them, d′ i represents the unloading location decision of the i-th task, α t Indicates the action environment.
[0068] The best offloading strategy should have the lowest task processing delay and user device energy consumption. If a task cannot be completed due to insufficient device energy or execution timeout, it means that the offloading is not completed and the execution condition T i (con) = 1; otherwise T i (con)=0.
[0069] The reward and punishment conditions are:
[0070]
[0071] Among them, T i (con) represents the reward and punishment function of the i-th task; ΔE i It represents the difference in energy consumption between two adjacent tasks. represents the energy consumption of the offloading decision record of the first i tasks, represents the energy consumption of the offloading decision record of the first i-1 tasks; ΔT i represents the delay difference between two adjacent tasks. represents the processing time of the offloading decision records of the first i tasks, represents the processing time of the offloading decision records of the first i-1 tasks; Indicates the remaining energy of the user equipment after completing the i-1th task.
[0072] The optimization goal of the algorithm is to minimize delay and energy consumption, so the reward is defined as the increment of delay and energy consumption after task offloading. The specific expression is:
[0073]
[0074] in, represents the target weights of delay and energy consumption, and ω represents the penalty factor for task failure.
[0075] Furthermore, in step S6, task offloading includes the following contents:
[0076] According to the state, action and reward function of the Markov decision model in step S5, meta-reinforcement learning is combined with the TD3 algorithm to obtain the MR-TD3 algorithm, so that task offloading can adapt to tasks in different environments, achieve generalization and improve the adaptability of the algorithm to the environment.
[0077] The current value network in the TD3 algorithm is φ′ represents the target strategy network, θ′1 represents the parameters of the first target value network, and θ′2 represents the parameters of the second target value network; the second value network is Q θ2(s,a) , the parameters are φ, θ1 and θ2.
[0078] In the TD3 algorithm, adding noise to the target action enhances exploration and smoothes the regional values of the value network action; the action of the task offloading strategy during training And the expected reward y is expressed as:
[0079]
[0080] Among them, π φ′ (s′) represents the policy network in state s′, represents the shear noise function, r represents the discount factor, represents the current value network, φ′ represents the target strategy network, θ1′ represents the parameters of the first target value network, and θ2′ represents the parameters of the second target value network.
[0081] The MR-TD3 algorithm is trained using the A2C (Advantage actor-critic) algorithm. The parameters φ, θ1 and θ2 of the second value network are randomly initialized, and the parameters of the target value network are initialized φ→φ', θ1→θ1', θ2→θ2'. The training rounds are k=1,2,3…K. Due to the inevitable overestimation problem of cumulative error, the TD3 algorithm adopts the dual-Q learning idea, uses two independent value functions, and uses smaller values for updating to reduce the bias caused by overestimation.
[0082] Gradient ascent is used to obtain the return parameter φ with the maximum expected return; for the objective function of the actor-critic network and It is expressed as:
[0083]
[0084] in, Represents the first value network in the TD3 algorithm, πφ (s) represents the policy network in state s, and a represents the policy network action.
[0085] The MR-TD3 algorithm includes inner loop learning and outer loop learning. The inner loop learning combines the GRU-based Seq2Seq network with TD3, so that the dominant actor-critic algorithm can adapt to the training environment with different numbers of subtasks. The outer loop learning uses the gradient update of meta-parameters to minimize the objective function, which involves the update problem of second-order gradients. The present invention uses a first-order approximation method to represent it.
[0086] Among them, the inner and outer loop functions are:
[0087]
[0088] in, and Represent the gradient updates of the inner and outer loops, respectively. represents the sample strategy parameters, and They represent the critic and actor objective functions in the MR-TD3 algorithm respectively.
[0089] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:
[0090] (1) The present invention adopts a Seq2Seq network model based on the GRU attention mechanism, which can better capture the dependencies in long sequences through the gating unit. At the same time, it can alleviate the gradient disappearance and reduce the number of training times, which helps to improve the efficiency and stability of model training.
[0091] (2) The present invention adds an attention mechanism between the decoder and the encoder, so that the decoder can dynamically pay attention to the output of the encoder related to the current generation step and consider the dependencies between different tasks when generating the offloading strategy;
[0092] Adding a self-attention mechanism to the encoder can better understand the complex dependencies in the input sequence.
[0093] (3) The present invention designs an MR-TD3 algorithm that integrates meta-reinforcement learning and the TD3 algorithm. By adopting MRL, the agent can better and more quickly adapt to changes in the learning environment and new tasks, so that it can make faster adjustment strategies when facing new tasks. By using the TD3 algorithm to improve the update of the Q network, it is possible to avoid the instability of training caused by overestimation of the Q value, thereby improving the sample efficiency of learning. Under the constraints of the maximum tolerable delay and energy consumption of the task, the delay and energy consumption of the device can be minimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] Figure 1It is an overall implementation flow chart of the present invention.
[0095] Figure 2 It is an edge computing scene diagram in an embodiment of the present invention.
[0096] Figure 3 This is a diagram of the custom sequence network structure based on the gated recurrent unit attention mechanism of the present invention.
[0097] Figure 4 It is a structural diagram of the gated cycle unit of the present invention.
[0098] Figure 5 It is the MR-TD3 algorithm architecture diagram of the present invention. DETAILED DESCRIPTION
[0099] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0100] To achieve the above objectives, the present invention proposes a task offloading method based on meta-reinforcement learning, such as Figure 1 As shown, the specific steps are as follows:
[0101] S1. Establish a multi-user single edge server offloading task scenario and decompose the task into subtasks; Figure 2 As shown, the specific contents are:
[0102] The user equipment set is N, N = {1, 2, 3, ..., n}, n represents the total number of user equipment; the user equipment communicates and transmits data with the edge server through the mobile communication network to establish an offloading task scenario.
[0103] In the offloading task scenario, each user device has different computing and storage capabilities and is distributed in different geographical locations. The user device executes tasks based on the status of the local system and the relevant configuration files of the task. Each task can be decomposed into a series of subtasks with dependencies. When the application of the user device executes computing tasks, these tasks may contain different subtasks and require different computing resources. Some tasks can be executed locally on the user device. According to the local resource utilization and the time of task execution, the subtasks that meet the conditions are processed locally; according to network bandwidth, delay and other conditions, the subtasks that meet the conditions are offloaded to the edge server through wireless channel transmission for processing; the processing results are returned to the user device through the mobile communication network. It is set that the subtask can only be executed after the task is fully executed. The user device offloads the task to the edge server and the computing resources of the edge server are sufficient.
[0104] In this embodiment, the offloading scenario is established: In a smart city, the intelligent transportation system monitors traffic flow, vehicle speed, and road conditions through a large number of sensors and cameras. These devices are installed on traffic lights, roadsides, and bridges, and continuously generate a large amount of data, which needs to be processed in real time to provide timely decision support for the traffic management system, such as adjusting the duration of traffic lights, publishing road conditions information, and path planning for autonomous vehicles. Each sensor and camera can be regarded as a user device, which usually has limited computing power and cannot process all the data. Therefore, it is necessary to offload some data processing tasks to nearby edge servers to quickly process complex tasks.
[0105] Each sensor and camera device has different computing and storage capabilities and is distributed in different geographical locations. The devices communicate and transmit data with the edge server through wireless networks. The task of preprocessing the video collected by the device is decomposed into several subtasks for task processing decisions.
[0106] S2. Model the offloading task as a directed acyclic graph according to the information of the user device, and obtain characteristic information of the directed acyclic graph; wherein the characteristic information of the directed acyclic graph includes data volume, computing efficiency, offloading method and CPU power; the specific contents are:
[0107] A directed acyclic graph consists of a set of subtasks and a set of directed edges representing the dependencies between subtasks, denoted as Where G represents a directed acyclic graph, T represents a set of subtasks, represents a set of directed edges, t i It is the task j The direct parent task, t j It is the task i subtasks, where j>i; when there are no subtasks in the directed acyclic graph, it means the task exits.
[0108] In this embodiment, a roadside camera is used as the center, and its tasks are modeled as a DAG graph, including subtasks such as data collection, preprocessing, target detection, and trajectory prediction. Each subtask has its preconditions and subsequent tasks. The roadside camera collects traffic flow data in real time, and these data are used as the initial task.
[0109] The local device of the camera performs preliminary preprocessing on the data and decomposes it into subtask t1. If the computing resources of the local device are sufficient, it is completed directly locally, otherwise the task is offloaded to the edge server.
[0110] After data preprocessing is completed, vehicle and pedestrian recognition is performed t2. The system will decide whether to offload this task to the edge server based on the network bandwidth and device computing power.
[0111] After target detection is completed, trajectory prediction t3 is performed, and the system will make dynamic decisions based on the task dependencies and resource utilization in the DAG graph.
[0112] After each subtask is executed, the system returns the results to the local device and stores or further passes the results to the traffic management system for real-time traffic control and optimization.
[0113] S3: Build a sequence-to-sequence network model based on the GRU attention mechanism, input the feature information of the directed acyclic graph in step S2 into the network model, and obtain the offloading sequence of different tasks; the specific content is:
[0114] like Figure 3 As shown in the figure, the Seq2Seq network model based on the GRU attention mechanism includes a self-attention layer, an encoder, an attention layer, and a decoder. In order to overcome the problem of serious information loss when the input sequence is too long, different attention mechanisms are added to the encoder and decoder layers, respectively, which is conducive to the decoder to dynamically pay attention to the output of the encoder related to the current generation step and consider the dependencies between different tasks when generating the unloading strategy. The encoder adds a self-attention mechanism to better understand the complex dependencies in the input sequence.
[0115] like Figure 4 As shown, the encoder includes a bidirectional gated recurrent unit and the decoder includes a GRU network with an attention mechanism.
[0116] The feature information of the directed acyclic graph and the dependency relationship of its corresponding input sequence are concatenated to form the input data, which is then input into the network model. The context representation is obtained through the self-attention layer, and then the context vector is generated through the bidirectional processing of the encoder. The specific expression is:
[0117]
[0118]
[0119] in, represents the forward function of the i'th vector in the subtask; f enc represents the forward function; represents the backward function of the i'th vector in the subtask; represents the forward function of the i'-1th vector in the subtask; t i represents the i-th task; b enc represents the backward function; represents the backward function of the i'+1th vector in the subtask; t i+1 represents the i+1th task; h i‘represents the function of the i'th vector in the subtask; a represents the output weight coefficient of the encoder; c represents the context vector, including the forward and backward information of the subtask.
[0120] The attention layer dynamically selects and focuses on the information in the input data according to the context vector and the state of the decoder, and generates the output sequence [d1, d2, ...d t ], and then obtain the unloading sequence π(α1|s1) of different tasks and its value V(s1), where d t represents the output of the decoder at the tth time step.
[0121] S4. Based on the feature information of the directed acyclic graph, calculate the total delay and total energy consumption of local task processing and edge task offloading; the specific content is:
[0122] The latency and energy consumption are calculated using the data size, computational efficiency, offloading method, and CPU power of tasks in a directed acyclic graph.
[0123] The two uninstallation methods are shown as follows:
[0124]
[0125] Calculate the delay and energy consumption of the two offloading methods. The specific process is as follows:
[0126] (1) When the task is executed locally, the delay of the i-th task and energy consumption The calculation formula is:
[0127]
[0128] Among them, σ represents the number of CPU execution task instructions, w i represents the data size of the i-th task, f l represents the computational efficiency of the local device, e l Indicates the average energy consumption of executing an instruction locally.
[0129] The total delay when executing locally on n user devices and total energy consumption The calculation formula is:
[0130]
[0131] Where I represents the total number of tasks.
[0132] (2) When the task is offloaded to the edge server, the transmission delay of the i-th task is The calculation formula is:
[0133]
[0134] Among them, b n Indicates the bandwidth between the local user device and the edge server.
[0135] The delay of offloading the i-th task to the edge server Including transmission delay and calculation time, the specific formula is:
[0136]
[0137] Among them, f e Represents the computational efficiency of the edge server.
[0138] The energy consumption of offloading the i-th task to the edge server The calculation formula is:
[0139]
[0140] Among them, e e represents the average energy consumption of an instruction offloaded from the edge, e t Indicates the energy consumed in transmitting a unit size of data.
[0141] The total latency of n user devices offloading to the edge server and total energy consumption The calculation formula is:
[0142]
[0143] The delay T of all tasks total and energy consumption E total The calculation formula is:
[0144]
[0145]
[0146] S5. Construct different types of tasks based on the feature information of the directed acyclic graph, model the edge task offloading as a Markov decision model, and obtain the state function, action function and reward function according to the delay and energy consumption; the specific content is:
[0147] Different types of tasks are constructed according to the characteristic information of the directed acyclic graph and the calculation results of step S4. When the number of calculation instructions is greater than the number of instructions executed locally, the task is offloaded to the edge server, otherwise the task is executed locally. The edge task offloading is modeled as a Markov decision model, and the specific expression is:
[0148]
[0149] in, represents the distribution probability of the task, ρ(T) represents the type of task; St represents the state function; A represents the action function; P represents the state transition probability matrix; P0 represents the initial state distribution; R represents the reward function; γ represents the discount factor.
[0150] The state function, action function and reward function of Markov decision making are formulated according to the interactive information between the agent and the environment. The specific contents are as follows:
[0151] When offloading a subtask, the execution delay of the subtask depends on the CPU cycles required for the task, the size of the uploaded and downloaded data, the directed acyclic graph topology, the execution decision of the previous task, the transmission rate, the device power, and the edge computing resources; the specific expression of the state function is:
[0152]
[0153] Among them, St represents the state function of the i-th task, G represents a directed acyclic graph, and A 1:i-1 represents the offloading decision record of the first i-1 tasks, represents the maximum processing delay of the task, σ represents the number of CPU instructions to execute the task, and w i Indicates the data size of the i-th task.
[0154] Add serial numbers to tasks, sort subtasks according to serial numbers, and convert the subtask set of directed acyclic graph topology into a subtask sequence. The specific expression is:
[0155]
[0156] Among them, T represents the task set, child(t i ) represents the subtask set of the i-th task, rank(t j ) represents the sequence number of the jth subtask, rank(t i ) represents the sequence number of the i-th task, represents the time when the i-th task is offloaded to the edge server, t i represents the i-th task, t j Indicates t i The jth subtask of .
[0157] The unloading location decision of the i-th task is the action function, which is specifically expressed as:
[0158] d′ i ={α t |α t ∈{0,1}}
[0159] Among them, d′ i represents the unloading location decision of the i-th task, αt Indicates the action environment. 0 means that the task is calculated on the local device, and 1 means that the task is offloaded to the edge server for offloading.
[0160] The reward and punishment conditions are:
[0161]
[0162] Among them, T i (con) represents the reward and punishment function of the i-th task; ΔE i It represents the difference in energy consumption between two adjacent tasks. represents the energy consumption of the offloading decision record of the first i tasks, represents the energy consumption of the offloading decision record of the first i-1 tasks; ΔT i represents the delay difference between two adjacent tasks. represents the processing time of the offloading decision records of the first i tasks, represents the processing time of the offloading decision records of the first i-1 tasks; Indicates the remaining energy of the user equipment after completing the i-1th task.
[0163] In order to minimize the total energy consumption of task processing and total delay To improve the success rate of task processing, the optimization goal of the algorithm is to minimize delay and energy consumption. Therefore, the reward is defined as the negative increment of delay and energy consumption after task offloading. The expression of the reward function is:
[0164]
[0165] in, represents the target weights of delay and energy consumption, and ω represents the penalty factor for task failure.
[0166] S6, such as Figure 5 As shown, according to the function obtained in step S5, the meta-reinforcement learning is integrated with the TD3 algorithm to obtain the MR-TD3 algorithm, which is used to process the workload and resource allocation to complete the task offloading; the specific contents are:
[0167] According to the state, action and reward function of the Markov decision model in step S5, meta-reinforcement learning is combined with the TD3 algorithm to obtain the MR-TD3 algorithm; the current value network in the TD3 algorithm is φ′ represents the target strategy network, θ1′ represents the parameters of the first target value network, and θ2′ represents the parameters of the second target value network; the second value network is Q θ2(s,a) , the parameters are φ, θ1 and θ2.
[0168] In the TD3 algorithm, adding noise to the target action enhances exploration and smoothes the regional values of the value network action; the action of the task offloading strategy during training And the expected reward y is expressed as:
[0169]
[0170] Among them, π φ′ (s′) represents the policy network in state s′, represents the shear noise function, r represents the discount factor, represents the current value network, φ′ represents the target strategy network, θ1′ represents the parameters of the first target value network, and θ2′ represents the parameters of the second target value network.
[0171] The MR-TD3 algorithm is trained using the A2C (Advantage actor-critic) algorithm. The parameters φ, θ1 and θ2 of the second value network are randomly initialized, and the parameters of the target value network are initialized φ→φ', θ1→θ1', θ2→θ2'. The training rounds are k=1,2,3…K. Due to the inevitable overestimation problem of cumulative error, the TD3 algorithm adopts the dual-Q learning idea, uses two independent value functions, and uses smaller values for updating to reduce the bias caused by overestimation.
[0172] Gradient ascent is used to obtain the return parameter φ with the maximum expected return; for the objective function of the actor-critic network and It is expressed as:
[0173]
[0174]
[0175] in, Represents the first value network in the TD3 algorithm, π φ (s) represents the policy network in state s, and a represents the policy network action.
[0176] The MR-TD3 algorithm includes inner loop learning and outer loop learning. The inner loop learning combines the Seq2Seq network based on GRU with TD3, so that the dominant actor-critic algorithm can adapt to the training environment with different numbers of subtasks. The outer loop learning uses the gradient update of meta parameters to minimize the objective function. The inner loop learning must download the meta-policy parameters from the outer loop learning, complete the training of the inner loop network and obtain a specific unloading strategy. The edge server collects all the experience of the inner loop training and extracts features for the outer loop training to obtain a new meta-policy until a stable meta-policy is obtained and the outer loop training is stopped. When there is a task to be executed, the user device task is input into the parser, parsed into the corresponding DAG by the parser, and the inner loop learning completes the inner loop training by downloading the meta-policy parameters through the outer loop; the trained policy parameters are unloaded to the transmission unit through the scheduler and transmitted to the edge task executor, and the execution of this task is completed according to the computing resources of the device, and the final result of the task is returned to the local device.
[0177] The inner and outer loop functions are:
[0178]
[0179] in, and Represent the gradient updates of the inner and outer loops, respectively. represents the sample strategy parameters, and They represent the critic and actor objective functions in the MR-TD3 algorithm respectively.
[0180] Task offloading can effectively process large amounts of real-time data in intelligent transportation systems, reduce the burden on local equipment, and improve the efficiency and accuracy of data processing, thereby realizing intelligent and efficient traffic management.
[0181] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A task offloading method based on meta-reinforcement learning, It is characterized in that include: S1. Establish a multi-user single edge server offloading task scenario and decompose the task into subtasks; S2. Modeling the offloading task as a directed acyclic graph according to the information of the user device, and obtaining characteristic information of the directed acyclic graph; wherein the characteristic information of the directed acyclic graph includes data volume, computing efficiency, offloading method and CPU power; S3, construct a sequence-to-sequence network model based on the GRU attention mechanism, input the feature information of the directed acyclic graph in step S2 into the network model, and obtain the offloading sequence of different tasks; S4. Based on the feature information of the directed acyclic graph, calculate the total delay and total energy consumption of local task processing and edge task offloading; S5. Construct different types of tasks based on the feature information of the directed acyclic graph, model the edge task offloading as a Markov decision model, and obtain the state function, action function and reward function according to the delay and energy consumption; S6. According to the function obtained in step S5, the meta-reinforcement learning is integrated with the TD3 algorithm to obtain the MR-TD3 algorithm, and the workload and resource allocation are processed using the algorithm to complete the task offloading.
2. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S1, the unloading task scenario includes the following contents: The user equipment set is N, N = {1, 2, 3, ..., n}, n represents the total number of user equipment; the user equipment communicates and transmits data with the edge server through the mobile communication network to establish an offloading task scenario; In the offloading task scenario, the user device executes the task according to the status of the local system and the relevant configuration file of the task, decomposes the task into subtasks, and sets that the subtasks can only be executed after the task is fully executed.
3. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S2, the directed acyclic graph includes the following contents: A directed acyclic graph consists of a set of subtasks and a set of directed edges representing the dependencies between subtasks, denoted as Where G represents a directed acyclic graph, T represents a set of subtasks, represents a set of directed edges, t i It is the task j The direct parent task, t j It is the task i subtasks, where j>i; when there are no subtasks in the directed acyclic graph, it means the task exits.
4. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S3, the unloading sequence of different tasks is obtained, including the following contents: The Seq2Seq network model based on the GRU attention mechanism includes a self-attention layer, an encoder, an attention layer, and a decoder; the encoder includes a bidirectional gated recurrent unit, and the decoder includes a GRU network with an attention mechanism; The feature information of the directed acyclic graph and the dependency relationship of its corresponding input sequence are concatenated to form the input data, which is then input into the network model. The context representation is obtained through the self-attention layer, and then the context vector is generated through the bidirectional processing of the encoder. The specific expression is: in, represents the forward function of the i'th vector in the subtask; f enc represents the forward function; represents the backward function of the i'th vector in the subtask; represents the forward function of the i'-1th vector in the subtask; t i represents the i-th task; b enc represents the backward function; represents the backward function of the i'+1th vector in the subtask; t i+1 represents the i+1th task; h i‘ represents the function of the i'th vector in the subtask; a represents the output weight coefficient of the encoder; c represents the context vector, including the forward and backward information of the subtask; The attention layer dynamically selects and focuses on the information in the input data according to the context vector and the state of the decoder, and generates the output sequence [d 1 ,d 2 ,...d t ], and then get the unloading sequence π(α 1 |s 1 ) and its value V(s 1 ), where d t represents the output of the decoder at the tth time step.
5. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S4, the delay and energy consumption are calculated using the data size, computing efficiency, offloading method and CPU power of the tasks in the directed acyclic graph; The two uninstallation methods are shown as follows: Calculate the delay and energy consumption of the two offloading methods. The specific process is as follows: (1) When the task is executed locally, the delay of the i-th task and energy consumption The calculation formula is: Among them, σ represents the number of CPU execution task instructions, w i represents the data size of the i-th task, f l represents the computational efficiency of the local device, e l It represents the average energy consumption of executing an instruction locally; The total delay of n user devices when executing locally and total energy consumption The calculation formula is: Where I represents the total number of tasks; (2) When the task is offloaded to the edge server, the transmission delay of the i-th task is The calculation formula is: Among them, b n Represents the bandwidth between the local user device and the edge server; The delay of offloading the i-th task to the edge server Including transmission delay and calculation time, the specific formula is: Among them, f e represents the computational efficiency of the edge server; The energy consumption of offloading the i-th task to the edge server The calculation formula is: Among them, e e represents the average energy consumption of an instruction offloaded from the edge, e t Indicates the energy consumed to transmit a unit size of data; The total latency of n user devices offloading to the edge server and total energy consumption The calculation formula is: The delay of all tasks is T total and energy consumption E total The calculation formula is:
6. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S5, obtaining the state function, action function and reward function includes the following: Different types of tasks are constructed according to the characteristic information of the directed acyclic graph and the calculation results of step S4. When the number of calculation instructions is greater than the number of instructions executed locally, the task is offloaded to the edge server, otherwise the task is executed locally. The edge task offloading is modeled as a Markov decision model, and the specific expression is: in, represents the distribution probability of the task, ρ(T) represents the type of task; St represents the state function; A represents the action function; P represents the state transition probability matrix; P 0 represents the initial state distribution; R represents the reward function; γ represents the discount factor; The state function, action function and reward function of Markov decision making are formulated according to the interactive information between the agent and the environment. The specific contents are as follows: When offloading a subtask, the execution delay of the subtask depends on the CPU cycles required for the task, the size of the uploaded and downloaded data, the directed acyclic graph topology, the execution decision of the previous task, the transmission rate, the device power, and the edge computing resources; the specific expression of the state function is: Among them, St represents the state function of the i-th task, G represents a directed acyclic graph, and A 1:i-1 represents the offloading decision record of the first i-1 tasks, represents the maximum processing delay of the task, σ represents the number of CPU instructions to execute the task, and w i Indicates the data size of the i-th task; Add serial numbers to tasks, sort subtasks according to serial numbers, and convert the subtask set of directed acyclic graph topology into a subtask sequence. The specific expression is: Among them, T represents the task set, child(t i ) represents the subtask set of the i-th task, rank(t j ) represents the sequence number of the j-th subtask, rank(t i ) represents the sequence number of the i-th task, T i edge represents the time when the i-th task is offloaded to the edge server, t i represents the i-th task, t j Indicates t i The jth subtask of The unloading location decision of the i-th task is the action function, which is specifically expressed as: d′ i ={α t |α t ∈{0,1}} Where d′ i represents the unloading location decision of the i-th task, α t Indicates the action environment, 0 means that the task is calculated on the local device, and 1 means that the task is offloaded to the edge server for offloading; The reward and punishment conditions are: Among them, T i (con) represents the reward and punishment function of the i-th task; ΔE i It represents the difference in energy consumption between two adjacent tasks. represents the energy consumption of the offloading decision record of the first i tasks, represents the energy consumption of the offloading decision record of the first i-1 tasks; ΔT i represents the delay difference between two adjacent tasks. represents the processing time of the offloading decision records of the first i tasks, represents the processing time of the offloading decision records of the first i-1 tasks; Represents the remaining energy of the user equipment after completing the i-1th task; The expression of the reward function is: in, represents the target weights of delay and energy consumption, and ω represents the penalty factor for task failure.
7. The task offloading method based on meta-reinforcement learning according to claim 1, It is characterized in that In step S6, task offloading includes the following contents: According to the state, action and reward function of the Markov decision model in step S5, meta-reinforcement learning is combined with the TD3 algorithm to obtain the MR-TD3 algorithm; the current value network in the TD3 algorithm is φ′ represents the target policy network, θ′ 1 represents the parameters of the first target value network, θ′ 2 Represents the parameters of the second target value network; the second value network is Q θ2(s,a) , parameters are φ, θ 1 and θ 2 ; Adding noise to the target action in the TD3 algorithm; Actions of the task offloading strategy during training And the expected reward y is expressed as: Among them, π φ′ (s′) represents the policy network in state s′, represents the shear noise function, r represents the discount factor, represents the current value network, φ′ represents the target strategy network, and θ′ 1 represents the parameters of the first target value network, θ′ 2 represents the parameters of the second target value network; The MR-TD3 algorithm is trained using the dominant actor-critic algorithm, and the parameters φ and θ of the second value network are randomly initialized. 1 and θ 2 , initialize the parameters of the target value network φ→φ',θ 1 →θ 1 ',θ 2 →θ 2 '; Gradient ascent is used to obtain the return parameter φ with the maximum expected return; for the objective function of the actor-critic network and It is expressed as: in, Represents the first value network in the TD3 algorithm, π φ (s) represents the policy network in state s, and a represents the policy network action; The MR-TD3 algorithm includes inner loop learning and outer loop learning. The inner loop learning combines the GRU-based Seq2Seq network with TD3, while the outer loop learning uses the gradient update of the meta-parameters to minimize the objective function. The inner and outer loop functions are: in, and Respectively represent the gradient updates of the inner and outer loops, represents the sample strategy parameters, and They represent the critic and actor objective functions in the MR-TD3 algorithm, respectively, k represents the kth training round, and K represents the maximum number of training rounds.
Citation Information
Cited By
Task unloading method and computer equipment
CN119396498A
Multi-agent cooperation edge caching method and system based on gating communication mechanism
CN119402497A
Dependent subtask-oriented mobile edge computing task scheduling system and method
CN119759585A
Method and system for reasoning unloading of large model agent in edge computing scene and medium
CN119861982A
A method, system, and medium for inference offloading of large model agents in edge computing scenarios.
CN119861982B
