Task scheduling method and system in edge cloud based on deep reinforcement learning
By building a task scheduling system based on DQN network in the edge cloud, the problems of long response time, high energy consumption and high cost in edge cloud task scheduling are solved, and efficient and low-cost task scheduling is achieved.
Patent Information
- Application Number
- CN202311004103.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-08-10
AI Technical Summary
The existing edge cloud task scheduling suffers from problems such as long average response time, high energy consumption, and high cost.
A task scheduling method based on deep reinforcement learning is adopted. By constructing a DQN network model on edge nodes, including a main network and a target network, and using a state monitor to collect the environmental state, the task scheduler performs action evaluation and parameter optimization for task requests, thereby achieving efficient task scheduling on virtual machines.
It reduced average response time, lowered energy consumption, optimized resource allocation costs, and improved the efficiency and accuracy of task scheduling.
Smart Images

Figure CN116954866B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep reinforcement learning technology, specifically to a method and system for task scheduling in edge cloud environments based on deep reinforcement learning. Background Technology
[0002] The rapid development of the Internet of Things (IoT) and 5G technologies has spurred the growth of compute-intensive applications such as augmented reality, facial recognition, and autonomous driving. These applications generate massive amounts of data and place significant demands on latency and computing power. However, the limited resources of end devices lead to bottlenecks when handling large-scale applications, as well as challenges in providing sustained power.
[0003] Processing large amounts of data on edge devices using edge computing helps save data transmission bandwidth, reduce transmission latency, and minimize energy consumption. Furthermore, it protects user data privacy and prevents the leakage of sensitive information. By offloading service requests from centralized cloud computing centers to distributed edge devices, response time is reduced and reliability is improved. In addition, deploying edge cloud in small server clusters near end users enables the execution of resource-intensive applications at the network edge.
[0004] Task offloading is one of the key advantages of edge computing, effectively reducing device energy consumption. In the context of the Internet of Things (IoT), performing task offloading requires effective task scheduling to optimize resource utilization, reduce latency, and save energy. However, efficient task scheduling in edge computing is challenging due to factors such as the different states, types, and sizes of arriving tasks, coupled with the heterogeneity and geographical dispersion of edge computing resources, as well as the diverse performance, stability, and cost requirements of different applications.
[0005] Existing research on task scheduling in edge clouds typically employs traditional strategies, such as heuristics and stochastic approaches. While these strategies are widely adopted, they may not guarantee the required quality of service, especially in dynamic edge computing environments where task response time is critical. Some research has explored the application of machine learning algorithms, but these may also have limitations, such as a lack of simultaneous optimization for energy consumption and cost.
[0006] The technical problem that needs to be solved is how to address the issues of long average response time, high energy consumption, and high cost in existing task scheduling. Summary of the Invention
[0007] The technical objective of this invention is to address the above-mentioned shortcomings by providing an edge cloud task scheduling method and system based on deep reinforcement learning, thereby solving the technical problems of long average response time, high energy consumption, and high cost in existing task scheduling methods.
[0008] In a first aspect, the present invention provides an edge cloud task scheduling method based on deep reinforcement learning, comprising the following steps:
[0009] For each edge node within the edge cloud, the task requests received by the edge node are stored in a task queue, and the task requests are pushed to other edge nodes, so that each edge node receives global task requests.
[0010] For each edge node in the edge cloud, task requests and virtual machine status information are collected as the environment status through the status monitor within the edge node.
[0011] For each edge node in the edge cloud, a pre-trained scheduling decision model is configured in the task scheduler of the edge node. The scheduling decision model is a network model built based on the DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state.
[0012] Edge nodes process task requests in the task queue through the task scheduler as follows:
[0013] Action evaluation: Taking the current environment state as input, the Q value of each virtual machine to perform the action is predicted and output through the main network. Based on the Q value, an action is selected, sent to the corresponding virtual machine and returned to the environment. The current environment state, action and reward, as well as the environment state of the next moment, are obtained from the environment as quaternary sample data. The sample data is stored in the experience replay pool.
[0014] Parameter optimization: Sample data is obtained from the experience replay pool. The environment state at the next time step is used as input. The Q value of each virtual machine's action is predicted by the target network, and a Q value is selected as the output. A loss function is constructed based on the Q value predicted by the main network and the Q value predicted by the target network. The parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold.
[0015] Preferably, during the action evaluation process, the Q-value of each virtual machine's action is predicted and output by the main network, and an action is selected based on the Q-value, including the following steps:
[0016] The environmental state s at time t t As input, the network predicts the output Q-value of each virtual machine's task scheduling, which is then used as an action;
[0017] The Q-values are converted into a probability distribution using the softmax regression method. The probability distribution is expressed as follows:
[0018]
[0019] Remove Q values with probabilities less than the threshold, and normalize the remaining probabilities using the following formula:
[0020]
[0021] For the normalized residual probability, the sum of the probabilities of all Q values is converted to 1, and the calculation formula is as follows:
[0022]
[0023] The action with the highest probability value is selected for output based on the probability distribution, and the Q value of the state-action pair is updated using the Bellman formula, as follows:
[0024] Q(s t ,a t )←Q(s t ,a t )+α[r t +γmax a Q(s t+1 ,a t )-Q(s t ,a t )]
[0025] Where α represents the learning rate and γ represents the learning factor, ranging from 0 to 1;
[0026] s t =s r +s x , where s r This indicates the status of a task request, including the CPU cycles required by the task and the amount of data consumed by the task. x It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine;
[0027] a t P represents the action corresponding to the state at time t; V represents the total number of actions; P represents the total number of actions remaining after the probability is less than the threshold Q value; Q represents the total number of actions remaining after the probability is less than the threshold Q value. max Q represents the maximum Q value. min This represents the minimum Q value.
[0028] Preferably, parameter optimization includes the following steps:
[0029] L100, set step size N;
[0030] After storing the environmental state, action, and action reward at time t200 and time t+1 as sample data in the experience replay pool, the sample data is read from the experience replay pool. Taking the environmental state at time t+1 as input, the Q value of each virtual machine's task scheduling is predicted through the target network, and the maximum Q value is selected as the output of the target network.
[0031] L300, Q(s) t ,a t ,θ) is used as the value function corresponding to the main network, and Q′(s) is used as the value function. t+1 ,a;θ′) as the value function corresponding to the target network, based on Q(s t ,a t ,θ) and Q′(s t+1 ,a;θ′ / Construct the loss function, the loss function is expressed as:
[0032] L(θ)=E[(r t+ γmax a Q′(s t+1 ,a;θ′)-Q(s t ,a;θ)) 2 ]
[0033] Where θ represents the network parameters of the evaluation network, and θ′ represents the network parameters of the target network;
[0034] L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula:
[0035]
[0036] L500, execute steps L200-L400 for multiple iterations. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters θ′ of the target network. Based on the optimized target network, execute steps L200-L500 for multiple iterations until the change in the network parameters of the evaluation network is less than the threshold.
[0037] Preferably, both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers, which work together to extract features from the environment state as input. There are also two fully connected layers, which work together to calculate the Q-value of each virtual machine's task scheduling from the features as input and output it as a vector.
[0038] In a second aspect, the present invention provides an edge cloud task scheduling system based on deep reinforcement learning, used for task scheduling via an edge cloud task scheduling method based on deep reinforcement learning as described in any of the first aspects. The system is applied to an edge cloud, which is configured with multiple edge nodes. Each edge node is configured with a task queue, a status monitor, a task scheduler, and multiple virtual machines. The system includes:
[0039] The task request processing module stores the task requests received by each edge node in the edge cloud into a task queue and pushes the task requests to other edge nodes, so that each edge node receives global task requests.
[0040] The environment status processing module is used to collect task requests and virtual machine status information as the environment status for each edge node in the edge cloud through the status monitor within the edge node.
[0041] The model building module is used to configure a pre-trained scheduling decision model in the task scheduler of each edge node in the edge cloud. The scheduling decision model is a network model built based on the DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state.
[0042] The task scheduling module, for each edge node within the edge cloud, processes task requests in the task queue through a task scheduler as follows:
[0043] Action evaluation: Taking the current environment state as input, the Q value of each virtual machine to perform the action is predicted and output through the main network. Based on the Q value, an action is selected, sent to the corresponding virtual machine and returned to the environment. The current environment state, action and reward, as well as the environment state of the next moment, are obtained from the environment as quaternary sample data. The sample data is stored in the experience replay pool.
[0044] Parameter optimization: Sample data is obtained from the experience replay pool. The environment state at the next time step is used as input. The Q value of each virtual machine's action is predicted by the target network, and a Q value is selected as the output. A loss function is constructed based on the Q value predicted by the main network and the Q value predicted by the target network. The parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold.
[0045] Preferably, during the action evaluation process, the task scheduling module performs the following actions to predict and output the Q-value of each virtual machine's action through the main network, and selects an action based on the Q-value:
[0046] The environmental state s at time t t As input, the network predicts the output Q-value of each virtual machine's task scheduling, which is then used as an action;
[0047] The Q-values are converted into a probability distribution using the softmax regression method. The probability distribution is expressed as follows:
[0048]
[0049] Remove Q values with probabilities less than the threshold, and normalize the remaining probabilities using the following formula:
[0050]
[0051] For the normalized residual probability, the sum of the probabilities of all Q values is converted to 1, and the calculation formula is as follows:
[0052]
[0053] The action with the highest probability value is selected for output based on the probability distribution, and the Q value of the state-action pair is updated using the Bellman formula, as follows:
[0054] Q(s t ,a t )←Q(s t ,a t )+α[r t +γmax a Q(s t+1 ,a t )-Q(s t ,a t )]
[0055] Where α represents the learning rate and γ represents the learning factor, ranging from 0 to 1;
[0056] s t =s r +s x , where s r This indicates the status of a task request, including the CPU cycles required by the task and the amount of data consumed by the task. x It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine;
[0057] a tP represents the action corresponding to the state at time t; V represents the total number of actions; P represents the total number of actions remaining after the probability is less than the threshold Q value; Q represents the total number of actions remaining after the probability is less than the threshold Q value. max Q represents the maximum Q value. min This represents the minimum Q value.
[0058] Preferably, during parameter optimization, the task scheduling module performs the following operations:
[0059] L100, set step size N;
[0060] After storing the environmental state, action, and action reward at time t200 and time t+1 as sample data in the experience replay pool, the sample data is read from the experience replay pool. Taking the environmental state at time t+1 as input, the Q value of each virtual machine's task scheduling is predicted through the target network, and the maximum Q value is selected as the output of the target network.
[0061] L300, Q(s) t ,a t ,θ) is used as the value function corresponding to the main network, and Q′(s) is used as the value function. t+1 ,a;θ′) as the value function corresponding to the target network, based on Q(s t ,a t ,θ) and Q′(s t+1 Construct a loss function for (a, θ′), which is expressed as:
[0062] L(θ)=E[(r t+ γmax a Q′(s t+1 ,a;θ′)-Q(s t ,a;θ)) 2 ]
[0063] Where θ represents the network parameters of the evaluation network, and θ′ represents the network parameters of the target network;
[0064] L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula:
[0065]
[0066] L500, execute steps L200-L400 for multiple iterations. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters θ′ of the target network. Based on the optimized target network, execute steps L200-L500 for multiple iterations until the change in the network parameters of the evaluation network is less than the threshold.
[0067] Preferably, both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers, which work together to extract features from the environment state as input. There are also two fully connected layers, which work together to calculate the Q-value of each virtual machine's task scheduling from the features as input and output it as a vector.
[0068] The edge cloud task scheduling method and system based on deep reinforcement learning of the present invention have the following advantages:
[0069] 1. In edge cloud, each edge node sends received task requests to the task queue and pushes them to other edge nodes, thus each edge node has global task requests. Edge nodes collect task requests and virtual machine status information as environment status through status monitors. Edge nodes schedule task requests in the task queue through task schedulers. The processing method is that a scheduling decision model is built in the task scheduler of each edge node. The scheduling decision model takes the environment status as input, analyzes the required status of the task request and the status of the virtual machine, selects an action based on the Q value of each virtual machine to execute the task, and sends the action to the corresponding virtual machine. This realizes task scheduling and distributes the computation process to edge nodes, reducing the average response time and energy consumption. By enabling virtual machine resource allocation to adaptively optimize when the task load changes, costs are further reduced.
[0070] 2. The scheduling decision model is a network model built on DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state. The above network model can continuously optimize the network parameters while performing action prediction, which improves the prediction efficiency and accuracy. Attached Figure Description
[0071] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0072] The invention will be further described below with reference to the accompanying drawings.
[0073] Figure 1 This is a structural block diagram of the edge node in an edge cloud task scheduling method based on deep reinforcement learning, as shown in Example 1.
[0074] Figure 2 This is a flowchart illustrating the task scheduling process of an edge cloud task scheduling method based on deep reinforcement learning, as shown in Example 1.
[0075] Figure 3 This is a network structure diagram of the main network and the target network in an edge cloud task scheduling method based on deep reinforcement learning, as shown in Example 1.
[0076] in, Figure 2 In this context, Environment represents the environment, state represents the environment state, Main Net represents the main network, Target Net represents the target network, Replay Cache represents the experience replay pool, a based on the probability represents the action selected based on probability, Task Queue represents the task queue, and Virtual Machine represents the virtual machine. Detailed Implementation
[0077] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0078] This invention provides an edge cloud task scheduling method and system based on deep reinforcement learning, which addresses the technical problems of long average response time, high energy consumption, and high cost in existing task scheduling.
[0079] Example 1:
[0080] This invention discloses an edge cloud task scheduling method based on deep reinforcement learning, comprising the following steps:
[0081] S100. For each edge node in the edge cloud, the task requests received by the edge node are stored in the task queue, and the task requests are pushed to other edge nodes, so that each edge node can obtain global task requests.
[0082] S200. For each edge node in the edge cloud, task requests and virtual machine status information are collected as the environment status through the status monitor within the edge node.
[0083] S300. For each edge node in the edge cloud, a pre-trained scheduling decision model is configured in the task scheduler of the edge node. The scheduling decision model is a network model built on DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state.
[0084] S400, edge nodes process task requests in the task queue through the task scheduler as follows:
[0085] Action evaluation: Taking the current environment state as input, the Q value of each virtual machine to perform the action is predicted and output through the main network. Based on the Q value, an action is selected, sent to the corresponding virtual machine and returned to the environment. The current environment state, action and reward, as well as the environment state of the next moment, are obtained from the environment as quaternary sample data. The sample data is stored in the experience replay pool.
[0086] Parameter optimization: Sample data is obtained from the experience replay pool. The environment state at the next time step is used as input. The Q value of each virtual machine's action is predicted by the target network, and a Q value is selected as the output. A loss function is constructed based on the Q value predicted by the main network and the Q value predicted by the target network. The parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold.
[0087] This embodiment has N edge nodes within an edge cloud, with each edge cloud consisting of N edge nodes responsible for processing user-submitted computing tasks. Each edge node is configured with a task queue, a status monitor, a task scheduler, and multiple virtual machines. The task queue, status monitor, and task scheduler work together to determine the appropriate virtual machine, taking into account factors such as user mobility. The status monitor collects the status information of all tasks and edge nodes as the environment state. The task scheduler outputs a task allocation solution. The task queue records tasks submitted by end users and allows the execution of various types of tasks. The execution flow is as follows: When a user requests to offload a task to an edge node, the status monitor simultaneously collects the status information of all tasks and edge nodes, and then sends it as input to the deep reinforcement learning-based task scheduler. The task scheduler outputs a scheduling decision based on the resources required by the task and the current resource state of each virtual machine in the edge node, and then forwards the task to the selected virtual machine according to the scheduling decision for task scheduling.
[0088] In this embodiment, both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers, which work together to extract features from the environment state as input. There are also two fully connected layers; these work together to calculate the Q-value for each virtual machine's task scheduling, using the features as input, and output it as a vector. The main network evaluates the state-action Q-value during execution and generates scheduling actions. The target network primarily assists training and prevents training instability.
[0089] This embodiment solves the task scheduling problem using the aforementioned main network and target network. The workflow is as follows: the state is passed to the main network, then an action is selected based on a probability distribution, and the process is returned to the environment to obtain the next state. When the state changes, the agent receives a reward, and this state-action-reward-next state tuple is stored in the replay experience pool for training the main network parameters. These parameters are also assigned to the target network every 50 steps to improve the algorithm's stability by reducing the correlation between the values (Q-values) of each evaluated virtual machine.
[0090] In a specific implementation, during the action evaluation process in step S400, the Q-value of each virtual machine's action is predicted and output by the main network, and an action is selected based on the Q-value, including the following steps:
[0091] (1) The environmental state s at time t t As input, the network predicts the output Q-value of each virtual machine's task scheduling, which is then used as an action;
[0092] (2) The Q-value is converted into a probability distribution using the softmax regression method. The probability distribution is expressed as:
[0093]
[0094] (3) Remove Q values with probabilities less than the threshold and normalize the remaining probabilities. The calculation formula is as follows:
[0095]
[0096] (4) For the normalized residual probability, the sum of the probabilities of all Q values is converted to 1, and the calculation formula is as follows:
[0097]
[0098] (5) Select the action with the highest probability value according to the probability distribution and output it. Update the Q value of the state-action pair using the Bellman formula. The calculation formula is as follows:
[0099] Q(s t ,a t )←Q(s t ,at )+α[r t +γmax a Q(s t+1 ,a t )-Q(s t ,a t )]
[0100] Where α represents the learning rate and γ represents the learning factor, ranging from 0 to 1, indicating the importance of future rewards;
[0101] s t =s r +s x , where s r This indicates the status of a task request, including the CPU cycles required by the task and the amount of data consumed by the task. x It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine;
[0102] a t P represents the action corresponding to the state at time t; V represents the total number of actions; P represents the total number of actions remaining after the probability is less than the threshold Q value; Q represents the total number of actions remaining after the probability is less than the threshold Q value. max Q represents the maximum Q value. min This represents the minimum Q value.
[0103] In the parameter optimization process, the value function is represented as Q(s). t ,a t If we have a loss function θ, then θ represents the value function after the neural network converges. Therefore, a key aspect of the entire process is determining the value function to approximate θ. The most classic approach is to use gradient descent to minimize the loss function and iteratively update the network weights.
[0104] In a specific implementation, the parameter optimization in step S400 includes the following steps:
[0105] L100, set step size N;
[0106] After storing the environmental state, action, and action reward at time t200 and time t+1 as sample data in the experience replay pool, the sample data is read from the experience replay pool. Taking the environmental state at time t+1 as input, the Q value of each virtual machine's task scheduling is predicted through the target network, and the maximum Q value is selected as the output of the target network.
[0107] L300, Q(s) t ,a t ,θ) is used as the value function corresponding to the main network, and Q′(s) is used as the value function. t+1 ,a;θ′) as the value function corresponding to the target network, based on Q(s t ,at ,θ) and Q′(s t+1 Construct a loss function for (a, θ′), which is expressed as:
[0108] L(θ)=E[(r t+ γmax a Q′(s t+1 ,a;θ′)-Q(s t ,a;θ)) 2 ]
[0109] Where θ represents the network parameters of the evaluation network, and θ′ represents the network parameters of the target network;
[0110] L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula:
[0111]
[0112] L500, execute steps L200-L400 for multiple iterations. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters θ′ of the target network. Based on the optimized target network, execute steps L200-L500 for multiple iterations until the change in the network parameters of the evaluation network is less than the threshold.
[0113] In the parameter optimization process of this embodiment, after adding the target network, the target Q value remains unchanged over time, which reduces the correlation between the evaluation Q values and improves the stability of the algorithm.
[0114] Example 2:
[0115] This invention discloses a task scheduling system for edge cloud based on deep reinforcement learning, which is applied to edge cloud. The edge cloud is configured with multiple edge nodes, and each edge node is configured with a task queue, a status monitor, a task scheduler, and multiple virtual machines. The task scheduling system includes a task request processing module, an environment status processing module, a model building module, and a task scheduling module. The system can perform task scheduling by executing the method disclosed in Embodiment 1.
[0116] For each edge node in the edge cloud, the task request processing module stores the task requests received by the edge node in the task queue and pushes the task requests to other edge nodes, so that each edge node receives global task requests.
[0117] For each edge node within the edge cloud, the environment status processing module is used to collect task requests and virtual machine status information as the environment status through the status monitor within the edge node.
[0118] For each edge node in the edge cloud, the model building module is used to configure the pre-trained scheduling decision model in the task scheduler of the edge node. The scheduling decision model is a network model built based on the DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state.
[0119] For each edge node within the edge cloud, the task scheduling module processes task requests in the task queue using the task scheduler as follows:
[0120] Action evaluation: Taking the current environment state as input, the Q value of each virtual machine to perform the action is predicted and output through the main network. Based on the Q value, an action is selected, sent to the corresponding virtual machine and returned to the environment. The current environment state, action and reward, as well as the environment state of the next moment, are obtained from the environment as quaternary sample data. The sample data is stored in the experience replay pool.
[0121] Parameter optimization: Sample data is obtained from the experience replay pool. The environment state at the next time step is used as input. The Q value of each virtual machine's action is predicted by the target network, and a Q value is selected as the output. A loss function is constructed based on the Q value predicted by the main network and the Q value predicted by the target network. The parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold.
[0122] In this edge cloud implementation, a task queue, a status monitor, and a task scheduler work together to determine appropriate virtual machines (VMs) while considering factors such as user mobility. The status monitor collects the status information of all tasks and edge nodes as the environment state. The task scheduler outputs a task allocation solution. The task queue records tasks submitted by end users and allows the execution of various task types. The execution flow is as follows: When a user requests to offload a task to an edge node, the status monitor simultaneously collects the status information of all tasks and edge nodes, and then sends this information as input to the deep reinforcement learning-based task scheduler. The task scheduler outputs a scheduling decision based on the resources required by the task and the current resource state of each VM in the edge node, and then forwards the task to the selected VM for task scheduling according to the scheduling decision.
[0123] In this embodiment, both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers, which work together to extract features from the environment state as input. There are also two fully connected layers; these work together to calculate the QQ value for task scheduling for each virtual machine, using the features as input, and output it as a vector. The main network evaluates the state-action QQ value during execution and generates scheduling actions. The target network primarily assists training and prevents training instability.
[0124] This embodiment of the system solves the task scheduling problem through the aforementioned main network and target network. The workflow is as follows: the state is passed to the main network, then an action is selected according to the probability distribution, and the system returns to the environment to obtain the next state. When the state changes, the agent receives a reward, and this state-action-reward-next state tuple is stored in the replay experience pool for training the main network parameters. These parameters are also assigned to the target network every 50 steps to improve the algorithm's stability by reducing the correlation between the values (QQ values) of each evaluated virtual machine.
[0125] In a specific implementation, during the action evaluation process, the task scheduling module performs the following operations:
[0126] (1) The environmental state s at time t t As input, the network predicts the output Q-value of each virtual machine's task scheduling, which is then used as an action;
[0127] (2) The Q-value is converted into a probability distribution using the softmax regression method. The probability distribution is expressed as:
[0128]
[0129] (3) Remove Q values with probabilities less than the threshold and normalize the remaining probabilities. The calculation formula is as follows:
[0130]
[0131] (4) For the normalized residual probability, the sum of the probabilities of all Q values is converted to 1, and the calculation formula is as follows:
[0132]
[0133] (5) Select the action with the highest probability value according to the probability distribution and output it. Update the Q value of the state-action pair using the Bellman formula. The calculation formula is as follows:
[0134] Q(s t ,a t )←Q(s t ,a t )+α[rt +γmax a Q(s t+1 ,a t )-Q(s t ,a t )]
[0135] Where α represents the learning rate and γ represents the learning factor, ranging from 0 to 1, indicating the importance of future rewards;
[0136] s t =s r +s x , where s r This indicates the status of a task request, including the CPU cycles required by the task and the amount of data consumed by the task. x It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine;
[0137] a t P represents the action corresponding to the state at time t; V represents the total number of actions; P represents the total number of actions remaining after the probability is less than the threshold Q value; Q represents the total number of actions remaining after the probability is less than the threshold Q value. max Q represents the maximum Q value. min This represents the minimum Q value.
[0138] In the parameter optimization process, the value function is represented as Q(s). t ,a t If we have a loss function θ, then θ represents the value function after the neural network converges. Therefore, a key aspect of the entire process is determining the value function to approximate θ. The most classic approach is to use gradient descent to minimize the loss function and iteratively update the network weights.
[0139] In a specific implementation, when performing parameter optimization, the task scheduling module performs the following operations:
[0140] L100, set step size N;
[0141] After storing the environmental state, action, and action reward at time t200 and time t+1 as sample data in the experience replay pool, the sample data is read from the experience replay pool. Taking the environmental state at time t+1 as input, the Q value of each virtual machine's task scheduling is predicted through the target network, and the maximum Q value is selected as the output of the target network.
[0142] L300, Q(s) t ,a t ,θ) is used as the value function corresponding to the main network, and Q′(s) is used as the value function. t+1 ,a;θ′) as the value function corresponding to the target network, based on Q(s t ,a t,θ) and Q′(s t+1 Construct a loss function for (a, θ′), which is expressed as:
[0143] L(θ)=E[(r t+ γmax a Q′(s t+1 ,a;θ′)-Q(s t ,a;θ)) 2 ]
[0144] Where θ represents the network parameters of the evaluation network, and θ′ represents the network parameters of the target network;
[0145] L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula:
[0146]
[0147] L500, execute steps L200-L400 for multiple iterations. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters θ′ of the target network. Based on the optimized target network, execute steps L200-L500 for multiple iterations until the change in the network parameters of the evaluation network is less than the threshold.
[0148] In the parameter optimization process of this embodiment, after adding the target network, the target Q value remains unchanged over time, which reduces the correlation between the evaluation Q values and improves the stability of the algorithm.
[0149] The present invention has been shown and described in detail above with reference to the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above embodiments, those skilled in the art will know that more embodiments of the present invention can be obtained by combining the means in the different embodiments described above, and these embodiments are also within the protection scope of the present invention.
Claims
1. A task scheduling method in an edge cloud based on deep reinforcement learning, characterized in that, Includes the following steps: For each edge node within the edge cloud, the task requests received by the edge node are stored in a task queue, and the task requests are pushed to other edge nodes, so that each edge node receives global task requests. For each edge node in the edge cloud, task requests and virtual machine status information are collected as the environment status through the status monitor within the edge node. For each edge node in the edge cloud, a pre-trained scheduling decision model is configured in the task scheduler of the edge node. The scheduling decision model is a network model built based on the DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state. Edge nodes process task requests in the task queue through the task scheduler as follows: Action evaluation: taking the environment state at the current time as input, predicting the value of each virtual machine executing action through the main network, and selecting an action based on the value, sending the action to the corresponding virtual machine and returning the environment, obtaining the environment state, action and reward at the current time and the environment state at the next time from the environment as four-tuple sample data, and storing the sample data to the experience replay pool; Parameter optimization: Sample data is obtained from the experience replay pool, and the environment state at the next time step is used as input to predict the actions to be performed by each virtual machine through the target network. Value, and select one The value is used as the output, based on the prediction of the main network. Values and target network predictions The loss function is constructed, and the parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold. In the action evaluation process, the main network predicts the output of each virtual machine to perform an action value, and selects an action based on value, including steps such as: by environmental state at any time As input, the network predicts the output of task scheduling for each virtual machine through evaluation. Values, virtual execution task scheduling as actions; Using the softmax regression method The values are converted into a probability distribution, which is represented as follows: , Remove those with a probability less than the threshold. The value is calculated, and the remaining probability is normalized using the following formula: , For the remaining probabilities after normalization, all The sum of the probabilities of the values is converted to 1, and the calculation formula is as follows: , The action with the highest probability value is selected for output based on the probability distribution, and the state-action pair is updated using the Bellman formula. The value is calculated using the following formula: , in, Indicates the learning rate. This represents the learning factor, ranging from 0 to 1; ,in, This indicates the status of the task request, including the CPU cycles required by the task and the amount of data consumed by the task. It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine; express The action corresponding to the current state; This represents the total number of all actions. This indicates that the probability is less than the threshold. The total number of actions remaining after the value is reached. Indicates maximum value, Minimum value.
2. The edge cloud task scheduling method based on deep reinforcement learning according to claim 1, characterized in that, Parameter optimization includes the following steps: L100, set step size N; L200 The corresponding environmental state, action, and action reward at any given moment After storing the environmental state corresponding to a given moment as sample data in the experience replay pool, the sample data is read from the experience replay pool. The environmental state at each given time is taken as input, and the target network is used to predict the task scheduling for each virtual machine. Value, and select the largest. The value is used as the output of the target network; L300, will As the value function corresponding to the main network, As the value function corresponding to the target network, based on and Construct the loss function, which is expressed as: , in, This indicates the network parameters being evaluated. Represents the network parameters of the target network; L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula: , L500, execute steps L200-L400 multiple times. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters of the target network. In the process, based on the optimized target network, steps L200-L500 are executed for multiple iterations until the changes in the network parameters of the evaluated network are less than the threshold.
3. The edge cloud task scheduling method based on deep reinforcement learning according to claim 1, characterized in that, Both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers; these two layers work together to extract features from the environment state as input. There are also two fully connected layers; these two layers work together to calculate the task scheduling for each virtual machine, using the features as input. The values are output as a vector.
4. An edge cloud task scheduling system based on deep reinforcement learning, characterized in that, The system is used for task scheduling via a deep reinforcement learning-based task scheduling method for edge clouds as described in any one of claims 1-3. The system is applied to an edge cloud, which is configured with multiple edge nodes. Each edge node is configured with a task queue, a status monitor, a task scheduler, and multiple virtual machines. The system includes: The task request processing module stores the task requests received by each edge node in the edge cloud into a task queue and pushes the task requests to other edge nodes, so that each edge node receives global task requests. The environment status processing module is used to collect task requests and virtual machine status information as the environment status for each edge node in the edge cloud through the status monitor within the edge node. The model building module is used to configure a pre-trained scheduling decision model in the task scheduler of each edge node in the edge cloud. The scheduling decision model is a network model built based on the DQN network, including a main network and a target network with the same structure. The main network is used to predict the output action with the current environmental state as input and return the action to the environment. The target network is used to optimize the parameters of the main network based on the current environmental state, action, action reward and the next environmental state. The task scheduling module, for each edge node within the edge cloud, processes task requests in the task queue using a task scheduler as follows: Action evaluation: Taking the current environment state as input, the main network predicts and outputs the actions to be performed by each virtual machine. Value, and based on Select an action, send the action to the corresponding virtual machine and return it to the environment. Obtain the current environment state, action and reward, and the environment state at the next moment from the environment as quaternary sample data, and store the sample data in the experience replay pool. Parameter optimization: Sample data is obtained from the experience replay pool, and the environment state at the next time step is used as input to predict the actions to be performed by each virtual machine through the target network. Value, and select one The value is used as the output, based on the prediction of the main network. Values and target network predictions The loss function is constructed, and the parameters of the main network are optimized based on the loss function. During the parameter optimization process, when the number of iterations reaches a predetermined step size, the network parameters of the main network are periodically copied to the target network until the change value of the network parameters of the main network is less than the threshold. During the action evaluation process, the task scheduling module performs the following actions to predict and output the actions to be performed by each virtual machine through the main network. The value is used to select an action based on the Q value: by environmental state at any time As input, the network predicts the output of task scheduling for each virtual machine through evaluation. Values, virtual execution task scheduling as actions; Using the softmax regression method The values are converted into a probability distribution, which is represented as follows: , Remove those with a probability less than the threshold. The value is calculated, and the remaining probability is normalized using the following formula: , For the remaining probabilities after normalization, all The sum of the probabilities of the values is converted to 1, and the calculation formula is as follows: , The action with the highest probability value is selected for output based on the probability distribution, and the state-action pair is updated using the Bellman formula. The value is calculated using the following formula: , in, Indicates the learning rate. This represents the learning factor, ranging from 0 to 1; ,in, This indicates the status of the task request, including the CPU cycles required by the task and the amount of data consumed by the task. It indicates the state of the virtual machine in each edge node, including the remaining CPU cycles and CPU cycle frequency on the virtual machine; express The action corresponding to the current state; This represents the total number of all actions. This indicates that the probability is less than the threshold. The total number of actions remaining after the value is reached. Indicates maximum value, Minimum value.
5. The edge cloud task scheduling system based on deep reinforcement learning according to claim 4, characterized in that, During parameter optimization, the task scheduling module performs the following operations: L100, set step size N; L200 The corresponding environmental state, action, and action reward at any given moment After storing the environmental state corresponding to a given moment as sample data in the experience replay pool, the sample data is read from the experience replay pool. The environmental state at each given time is taken as input, and the target network is used to predict the task scheduling for each virtual machine. Value, and select the largest. The value is used as the output of the target network; L300, will As the value function corresponding to the main network, As the value function corresponding to the target network, based on and Construct the loss function, which is expressed as: , in, This indicates the network parameters being evaluated. Represents the network parameters of the target network; L400, based on the loss function, updates the network parameters of the evaluation network using gradient descent, as shown in the following formula: , L500, execute steps L200-L400 multiple times. When the number of iterations reaches step size N, copy the network parameters of the evaluation network to the network parameters of the target network. In the process, based on the optimized target network, steps L200-L500 are executed for multiple iterations until the changes in the network parameters of the evaluated network are less than the threshold.
6. The edge cloud task scheduling system based on deep reinforcement learning according to claim 4, characterized in that, Both the main network and the target network include convolutional layers and fully connected layers. There are two convolutional layers; these two layers work together to extract features from the environment state as input. There are also two fully connected layers; these two layers work together to calculate the task scheduling for each virtual machine, using the features as input. The Q value is output as a vector.
