Deep reinforcement learning efficient exploration method based on action causality evaluation
Through the action causal evaluation network, the agent has a high causality in complex environments was screened. Combined with deep reinforcement learning and near-end strategy optimization algorithms, the problems of low exploration efficiency and long training time of agents are solved, and more efficient Strategy learning and optimization improve the adaptability and robustness of the model.
Patent Information
- Application Number
- CN202411149185.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-01
AI Technical Summary
The prior art has low exploration efficiency, long training time and poor adaptability in complex environments, especially in large-scale state action spaces, the difficulty of exploration caused by sparse rewards and random noise interference has not been effectively solved.
By training the action causal evaluation network, we evaluate the degree of impact of each action on the environment of the agent, screen out actions with higher causality, build the minimum action space, and combine deep reinforcement learning and near-end strategy optimization algorithms to optimize and explore strategies and improve Explore efficiency.
It significantly shortens the training time of the agent, improves exploration efficiency and learning speed, enhances the adaptability and robustness of the model, avoids falling into local optimal solutions, and improves the strategy learning and optimization capabilities in complex environments.
Smart Images

Figure CN118886446A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of environmental exploration, and in particular relates to an efficient exploration method for deep reinforcement learning based on action causality evaluation. Background Art
[0002] How to efficiently explore in some unknown environments has always been one of the research directions of researchers. In recent years, reinforcement learning has developed rapidly and has received widespread attention in the field of machine learning. Reinforcement learning aims to maximize rewards, obtains feedback through continuous interaction between the agent and the environment, and learns the optimal action strategy by trial and error. With the rapid rise of deep learning, deep reinforcement learning combines deep learning's powerful high-dimensional data representation ability to fit value functions or optimal strategies, and has performed well in solving the field of unknown environment exploration. It has also achieved performance that exceeds that of humans in the real world, such as games, robots, natural language processing, and autonomous driving.
[0003] In order to improve the exploration efficiency of intelligent agents in the environment, researchers have proposed simple random perturbation methods, frequency-based methods, etc., but these classic methods have many limitations, such as unguided exploration and difficulty in applying to complex environments such as actual scenarios with dynamics and uncertainty. In order to solve the exploration difficulties caused by sparse rewards, random noise interference, etc. in large-scale state-action spaces, researchers have proposed deep reinforcement learning exploration methods based on goals, uncertainty measures, and intrinsic motivation. Action causal evaluation refers to the evaluation of the causal relationship between the results or state changes caused by a specific action in a specific environment. Action causal evaluation helps to analyze the impact of data changes and make corresponding predictions. Therefore, action causal evaluation technology can be used to optimize the exploration strategy of reinforcement learning models and improve exploration efficiency. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide an efficient exploration method for deep reinforcement learning based on action causality evaluation in view of the deficiencies of the above-mentioned prior art. By training an action causal evaluation network, the degree of influence of each action of the intelligent agent on the environment is judged, so that the actions with greater influence are retained, and the actions with smaller influence are considered to have lower causality, that is, the degree of change in the state of the environment is small, and the action is not executed. The action space of the intelligent agent is screened to retain actions with higher causality, and then these actions are selected and executed through strategies, thereby improving the efficiency of the intelligent agent's exploration of unknown environments and effectively shortening the training time compared with other algorithms.
[0005] In order to achieve the above technical objectives, the present invention provides the following technical solutions:
[0006] An efficient exploration method for deep reinforcement learning based on action causality evaluation includes the following steps:
[0007] Step 1: In the first stage, in different environments, the inverse dynamic model is used to train the impact of the agent's actions on the environment to obtain the action causal evaluation network;
[0008] Step 2: According to the action causal evaluation network, input the current state and action to calculate the degree of influence of each action on the change of the environment state at the next moment;
[0009] Step 3: Set a threshold to filter the actions of the agent to obtain the minimum action space and redundant action space of the agent;
[0010] Step 4: Obtain the agent's environment information, input it into the deep reinforcement learning model together with the minimum action space, combine it with the proximal policy optimization algorithm, output the action performed by the agent and obtain feedback information from the environment until the training is completed;
[0011] Step 5: Evaluate the performance of the model and check whether it converges in different environments.
[0012] Furthermore, step 1 includes the following sub-steps:
[0013] Step 11: Create and configure the reinforcement learning environment to obtain the shape of the observation space;
[0014] Step 12: Select a strategy based on the shape of the environment's observation space and the parameters in the configuration file. If the dimension of the observation space is greater than 2, select the neural network strategy, otherwise select the multilayer perceptron strategy.
[0015] Step 13: Create an extended observation space (observation space), based on which, initialize the inverse dynamics model and the inverse dynamics model trainer (action_trainer); then create a new state observation space and state action space to form a combination space, based on which, initialize the action causal evaluation network and the action causal evaluation network trainer (causality_trainer);
[0016] Step 14: Create and initialize the deep reinforcement learning model, pass in the strategy, environment, action model trainer and action causal evaluation network trainer, start training, and save the obtained action causal evaluation network after training is completed.
[0017] More specifically, step 13 includes the following sub-steps:
[0018] Step 131: Initialize the inverse dynamic model trainer, and train the inverse dynamic model (action_model) according to the incoming training data batch (batch) and parameters;
[0019] Step 132: Use the action model network to predict the probability distribution of the action, and calculate the cross entropy loss between the predicted action probability and the actual action. The cross entropy loss is recorded as The formula is:
[0020]
[0021] Where N is the number of samples, i is the sample number, and y is the i is the true category label of the i-th sample, The probability of predicting the i-th sample as the j-th class;
[0022] Calculate the cross entropy loss between the predicted action distribution and the real action to update the parameters of the inverse dynamics model, including gradient clipping and back propagation, and record the training indicators;
[0023] Step 133: Initialize the action causal evaluation network trainer, set the initial parameter update counter, and whether it is a discrete action space;
[0024] Step 134: Use the inverse dynamic model to calculate the action probability p(a|s,s ′ ,π(s)), a represents the selected action, s represents the current state, s ′ represents the state at the next moment, and π(s) represents the action probability of the strategy;
[0025] Step 135: One-hot encode the action, take the current action and the one-hot encoded action as input, and calculate the action causality prediction value C(s,a) through the network;
[0026] Step 136: Calculate logπ(a|s), where a represents the action, s represents the current state, and π(a|s) represents the probability of outputting action a when the state is s under the current strategy; then compare it with the action probability p(a|s,s ′ ,π(s)) uses KL divergence to calculate the action causal target value c target , the formula is:
[0027] c target =logp(a|s,s ′ ,π(s))-logπ(a|s);
[0028] Then use the mean square error loss function to calculate the action causality prediction value C(s,a) and the action causality target value c target The loss between.
[0029] More specifically, step 14 includes the following sub-steps:
[0030] Step 141: Initialize the PPO algorithm based on the policy gradient method, including: strategy, environment, learning rate, number of training steps, and buffer size;
[0031] Step 142: at the beginning of each acquisition cycle, the trajectory buffer rollout_buffer is reset, and in a loop, the current policy network is used to select actions and interact with the environment; feedback from the environment, such as observations, actions, and a flag indicating whether the round is complete, is stored in the replay buffer replay_buffer, observations, actions, old value function estimates, old action probabilities, and other data are stored in the trajectory buffer rollout_buffer, and at the end of each cycle, the collected rewards and value function estimates are used to calculate the advantage function estimate and store it in the trajectory buffer rollout_buffer;
[0032] Step 143: Use the collected trajectory data to update the policy network and the value network, update the learning rate of the optimizer according to the current training progress, calculate the policy clipping range and the state value function clipping range; in each training cycle, obtain a batch of data from the trajectory buffer rollout_buffer and calculate the loss; the policy network loss is the negative mean of the smaller value of the unclipped and clipped losses, and the value network loss is the mean square error loss function and the entropy loss. The total loss is obtained by weighted summing the policy network loss, the value network loss and the entropy loss;
[0033] Step 144: Use KL divergence to calculate the trained action causality value C(s t ,a i ), the formula is:
[0034] C(s t ,a i )=D KL (P(s t+1 |s t ,a i )‖P π (s t+1 |s t ));
[0035] Among them, a i Denoted as the i-th action, D KL represents KL divergence, P(s t+1 |s t ,a i ) means in state s t At this moment, perform action a i The next state after t+1 The probability distribution of π (s t+1 |s t) means that under the strategy π, the state changes from s t Transfer to t+1 The probability distribution of the moment; after reaching the total number of training steps or meeting other stopping conditions, the final action causal evaluation network is obtained.
[0036] Furthermore, step 2 includes the following sub-steps:
[0037] Step 21: Get the size of the action space of the environment and the action causal evaluation network obtained in step 1, and use the torch.no_grad() method to ensure that the gradient is not recorded during the calculation process;
[0038] Step 22: In a loop, the one-hot encoded action and current state observation values of each action are passed into the model, and the model's predicted output for the current state and action is obtained through forward propagation. The predicted output is then averaged along the batch dimension, and the above average is recorded until the end of the loop to obtain the average predicted value of each action, i.e., the action causality value.
[0039] Furthermore, step 3 includes the following sub-steps:
[0040] Step 31: For the actions that have been classified, obtain the causality value of each action based on the current state observation value of the environment and the action of the agent passed in step 2 above;
[0041] Step 32: In view of the different action causality values of each environment, firstly perform a softmax function operation on all action causality values to normalize them, and map all action causality values to between 0 and 1 for subsequent adjustment of the threshold value;
[0042] Step 33: Set a threshold α to filter actions, add actions with action causality values greater than the threshold α to the minimum action space, and actions with action causality values less than the threshold enter the redundant action space, until the actions in each action category are filtered out, and the minimum action space and redundant action space are obtained.
[0043] Furthermore, step 4 includes the following sub-steps:
[0044] Step 41: Initialize the PPO algorithm parameters, including the environment, learning rate, number of steps, batch size, discount factor, and pass these parameters into the action causal evaluation network obtained in step 1;
[0045] Step 42: Extract features from the state observations returned by the environment, calculate the latent vector latent_pi through the policy network and the value network, and use the value network to calculate the value of the current state observation;
[0046] Step 43: Generate the final action distribution based on the given latent vector latent_pi and the possible redundant action list redundant_actions_list; for the policy gradient method, when calculating the probability of each action, set the probability of the action in the redundant action space to a very small value to ensure that the probability of these actions being sampled is close to 0, and renormalize them so that the actions that the agent can choose only contain the minimum action space; the new strategy π after action screening causality The formula for (a|s) is:
[0047]
[0048] Among them, π(a|s) is the original strategy for selecting action a in state s, A redundancy is a redundant action space;
[0049] Step 44: Input the minimum action space into the PPO algorithm model to obtain the output action a t , execute output action a t Get feedback information, including the next state s t+1 , Reward t , whether the round is completed; store the above feedback information, if the round is over, obtain all the stored information, input the state into the value network to calculate the state value, and calculate the advantage function and value network loss, and back propagate to update the value network; input the stored state and action into the policy network, calculate the policy network loss based on the advantage function, and back propagate to update the policy network; repeat the above update process until the training is completed.
[0050] Furthermore, the specific process of step 5 is:
[0051] A count-based reward mechanism is used to encourage the agent to explore more in the environment. The reward is set as:
[0052]
[0053] Among them, new_count is the number of visits of the agent at the current position, and bonus is the reward value at the current position. After the training is completed, check the convergence of the model and compare the effect with the original strategy to verify the advantages of this method.
[0054] The present invention has the following beneficial effects:
[0055] By introducing the action causal evaluation network, the present invention enables the agent to better understand the impact of its actions on the environment, thereby conducting more efficient exploration. The action causal evaluation network evaluates the magnitude of the change in environmental state caused by different actions, helping the agent focus on valuable action choices during the learning process and avoiding ineffective exploration. In the first stage, the action causal evaluation network is trained according to the state of the environment and the action of the agent to understand the extent of the impact of the agent's actions on the environment, and then the overall training strategy is guided by the model. This method filters out redundant actions and constructs a minimum action space based on the causal value of each action of the agent in different states. This optimization process reduces the decision space of the agent, making the agent more efficient when performing tasks and improving the speed and accuracy of learning and decision-making.
[0056] The method of the present invention shows good adaptability in different environments. Through the combination of the action causal evaluation network and the PPO algorithm, the intelligent agent can quickly adapt to and achieve effective strategy learning and optimization in different complex environments, which improves the versatility and robustness of the model. The action causal evaluation network has been trained and verified in different environments and shows good generalization ability. By testing and optimizing in different environments, it is ensured that the model can work stably in a variety of complex scenarios, making the method more generalizable.
[0057] In order to further improve the training efficiency and model performance, a reward mechanism is set to encourage the agent to conduct more exploration during the training process, thereby optimizing the reward sparsity problem in complex environments. This mechanism enables the agent to obtain effective strategies more quickly and avoid falling into local optimal solutions, thereby improving the training efficiency and the performance of the final model. The present invention effectively solves the problems of low exploration efficiency, long training time and poor adaptability in traditional methods by combining action causal evaluation with deep reinforcement learning, and provides an efficient, flexible and adaptable deep reinforcement learning exploration method, which provides strong support for the application of agents in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a flow chart of the efficient exploration method of deep reinforcement learning based on action causality evaluation of the present invention;
[0059] Figure 2 It is a schematic diagram of the experimental environment Unlockpickupar of the present invention;
[0060] Figure 3 It is a schematic diagram of the experimental environment GoToR3BlueKeyAddPositionBonus of the present invention;
[0061] Figure 4 This is the reward curve diagram of Unlockpickupar training in the experimental environment of the present invention;
[0062] Figure 5 This is a training reward curve diagram of the experimental environment GoToR3BlueKeyAddPositionBonus of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0064] Although the steps in the present invention are arranged with numbers, they are not used to limit the order of the steps. Unless the order of the steps is clearly stated or the execution of a certain step requires other steps as a basis, the relative order of the steps can be adjusted. It is understood that the term "and / or" used in this article involves and covers any and all possible combinations of one or more of the associated listed items.
[0065] like Figure 1 As shown, the present invention is an efficient exploration method for deep reinforcement learning based on action causal evaluation. Because the intelligent agent continuously performs actions to interact with the environment to obtain feedback information, the importance of the effect of the action on the change of the environmental state is obvious. The present invention first trains an action causal evaluation network, which is used to obtain the degree of influence of the intelligent agent's action on the change of the environmental state. The minimum action space is selected according to the degree of influence, and the redundant redundant actions are eliminated, which greatly improves the efficiency of exploration. The first part first obtains environmental information and inputs it into the deep reinforcement learning model. This stage is training without rewards to obtain an action causal evaluation network; the second part first initializes to obtain environmental information, and inputs the state information of the environment and the action of the intelligent agent into the action causal evaluation network to obtain a selectable minimum action space, which is then input into the PPO algorithm model to output action a t , the agent performs action a t Get feedback information, including the next state s t+1 , Reward t , whether the round is completed, etc., store all feedback information, and if the round is completed, use the stored feedback information to update the strategy network and value network; repeat the above process until the training is completed. Finally, check the convergence of the entire model and evaluate the performance of the model. The method proposed in the present invention specifically includes the following steps:
[0066] Step 1: In the first stage, in different environments, the inverse dynamic model is used to train the impact of the agent's actions on the environment to obtain the action causal evaluation network;
[0067] As a preferred implementation of step 1, it specifically includes the following sub-steps:
[0068] Step 11: Create and configure the reinforcement learning environment to obtain the shape of the observation space;
[0069] Step 12: Select a strategy based on the shape of the environment's observation space and the parameters in the configuration file. If the dimension of the observation space is greater than 2, select the neural network strategy, otherwise select the multilayer perceptron strategy.
[0070] Step 13: Create an extended observation space (observation space), based on which, initialize the inverse dynamics model and the inverse dynamics model trainer (action_trainer); then create a new state observation space and state action space to form a combination space, based on which, initialize the action causal evaluation network and the action causal evaluation network trainer (causality_trainer);
[0071] Furthermore, step 13 includes the following sub-steps:
[0072] Step 131: Initialize the inverse dynamic model trainer, and train the inverse dynamic model (action_model) according to the incoming training data batch (batch) and parameters;
[0073] Step 132: Use the action model network to predict the probability distribution of the action, and calculate the cross entropy loss between the predicted action probability and the actual action. The cross entropy loss is recorded as The formula is:
[0074]
[0075] Where N is the number of samples, i is the sample number, and y is the i is the true category label of the i-th sample, The probability of predicting the i-th sample as the j-th class;
[0076] Calculate the cross entropy loss between the predicted action distribution and the real action to update the parameters of the inverse dynamics model, including gradient clipping and back propagation, and record the training indicators;
[0077] Step 133: Initialize the action causal evaluation network trainer, set the initial parameter update counter, and whether it is a discrete action space;
[0078] Step 134: Use the inverse dynamic model to calculate the action probability p(a|s,s ′ ,π(s)), a represents the selected action, s represents the current state, s ′ represents the state at the next moment, and π(s) represents the action probability of the strategy;
[0079] Step 135: One-hot encode the action, take the current action and the one-hot encoded action as input, and calculate the action causality prediction value C(s,a) through the network;
[0080] Step 136: Calculate logπ(a|s), where a represents the action, s represents the current state, and π(a|s) represents the probability of outputting action a when the state is s under the current strategy; then compare it with the action probability p(a|s,s ′ ,π(s)) uses KL divergence to calculate the action causal target value c target , the formula is:
[0081] c target =logp(a|s,s ′ ,π(s))-logπ(a|s);
[0082] Then use the mean square error loss function to calculate the action causality prediction value C(s,a) and the action causality target value c target Losses between
[0083] Step 14: Create and initialize the deep reinforcement learning model, pass in the strategy, environment, action model trainer and action causal evaluation network trainer, start training, and save the obtained action causal evaluation network after training is completed;
[0084] Furthermore, step 14 includes the following sub-steps:
[0085] Step 141: Initialize the PPO algorithm based on the policy gradient method, including: strategy, environment, learning rate, number of training steps, and buffer size;
[0086] Step 142: at the beginning of each acquisition cycle, the trajectory buffer rollout_buffer is reset, and in a loop, the current policy network is used to select actions and interact with the environment; feedback from the environment, such as observations, actions, and a flag indicating whether the round is complete, is stored in the replay buffer replay_buffer, observations, actions, old value function estimates, old action probabilities, and other data are stored in the trajectory buffer rollout_buffer, and at the end of each cycle, the collected rewards and value function estimates are used to calculate the advantage function estimate and store it in the trajectory buffer rollout_buffer;
[0087] Step 143: Use the collected trajectory data to update the policy network and the value network, update the learning rate of the optimizer according to the current training progress, calculate the policy clipping range and the state value function clipping range; in each training cycle, obtain a batch of data from the trajectory buffer rollout_buffer and calculate the loss; the policy network loss is the negative mean of the smaller value of the unclipped and clipped losses, and the value network loss is the mean square error loss function and the entropy loss. The total loss is obtained by weighted summing the policy network loss, the value network loss and the entropy loss;
[0088] Step 144: Use KL divergence to calculate the trained action causality value C(s t ,a i ), the formula is:
[0089] C(s t ,a i )=D KL (P(s t+1 |s t ,a i )‖P π (s t+1 |s t ));
[0090] Among them, a i Denoted as the i-th action, D KL represents KL divergence, P(s t+1 |s t ,a i ) means in state s t At this moment, perform action a i The next state after t+1 The probability distribution of π (s t+1 |s t ) means that under the strategy π, the state changes from s t Transfer to t+1 The probability distribution of the moment; after reaching the total number of training steps or meeting other stopping conditions, the final action causal evaluation network is obtained.
[0091] Step 2: According to the action causal evaluation network, input the current state and action to calculate the degree of influence of each action on the change of the environment state at the next moment;
[0092] As a preferred implementation of step 2, it specifically includes the following sub-steps:
[0093] Step 21: Get the size of the action space of the environment and the action causal evaluation network obtained in step 1, and use the torch.no_grad() method to ensure that the gradient is not recorded during the calculation process to save memory and computing resources;
[0094] Step 22: In a loop, the one-hot encoded action and current state observation values of each action are passed into the model, and the model's predicted output for the current state and action is obtained through forward propagation. The predicted output is then averaged along the batch dimension, and the above average is recorded until the end of the loop to obtain the average predicted value of each action, i.e., the action causality value.
[0095] Step 3: Set a threshold to filter the actions of the agent to obtain the minimum action space and redundant action space of the agent;
[0096] As a preferred implementation of step 3, it specifically includes the following sub-steps:
[0097] Step 31: For the actions that have been classified, obtain the causality value of each action based on the current state observation value of the environment and the action of the agent passed in step 2 above;
[0098] Step 32: In view of the different action causality values of each environment, firstly perform a softmax function operation on all action causality values to normalize them, and map all action causality values to between 0 and 1 for subsequent adjustment of the threshold value;
[0099] Step 33: Set a threshold α to filter actions, add actions with action causality values greater than the threshold α to the minimum action space, and actions with action causality values less than the threshold enter the redundant action space, until the actions in each action category are filtered out, and the minimum action space and redundant action space are obtained.
[0100] Step 4: Obtain the agent's environment information, input it into the deep reinforcement learning model together with the minimum action space, combine it with the proximal policy optimization algorithm, output the action performed by the agent and obtain feedback information from the environment until the training is completed;
[0101] As a preferred implementation of step 4, it specifically includes the following sub-steps:
[0102] Step 41: Initialize the PPO algorithm parameters, including the environment, learning rate, number of steps, batch size, discount factor, and pass these parameters into the action causal evaluation network obtained in step 1;
[0103] Step 42: Extract features from the state observations returned by the environment, calculate the latent vector latent_pi through the policy network and the value network, and use the value network to calculate the value of the current state observation;
[0104] Step 43: Generate the final action distribution based on the given latent vector latent_pi and the possible redundant action list redundant_actions_list; for the policy gradient method, when calculating the probability of each action, set the probability of the action in the redundant action space to a very small value to ensure that the probability of these actions being sampled is close to 0, and renormalize them so that the actions that the agent can choose only contain the minimum action space; the new strategy π after action screening causality The formula for (a|s) is:
[0105]
[0106] Among them, π(a|s) is the original strategy for selecting action a in state s, A redundancy is a redundant action space;
[0107] Step 44: Input the minimum action space into the PPO algorithm model to obtain the output action a t , execute output action a t Get feedback information, including the next state s t+1 , Reward t , whether the round is completed; store the above feedback information, if the round is over, obtain all the stored information, input the state into the value network to calculate the state value, and calculate the advantage function and value network loss, and back propagate to update the value network; input the stored state and action into the policy network, calculate the policy network loss based on the advantage function, and back propagate to update the policy network; repeat the above update process until the training is completed.
[0108] Step 5: Evaluate the performance of the model and check whether it converges in different environments.
[0109] As a preferred implementation of step 5, the specific process is:
[0110] A count-based reward mechanism is used to encourage the agent to explore more in the environment. The reward is set as:
[0111]
[0112] Among them, new_count is the number of visits of the agent at the current position, and bonus is the reward value at the current position. After the training is completed, check the convergence of the model and compare the effect with the original strategy to verify the advantages of this method.
[0113] In this embodiment, Figure 2 , 3As shown in the figure, two experimental environments for efficient exploration methods of deep reinforcement learning based on action causality evaluation are given. Both experimental environments use the Minigrid environment, which is a simple and easy-to-configure grid environment that is mostly used in the field of reinforcement learning. The environment contains a series of 2D grid world environments with goal-oriented tasks. A triangle is used in the environment to represent the agent, and the action space is a discrete action space. The tasks include solving different tasks in different maze environments. The agent needs to interact with objects, such as opening some closed doors, picking up and putting down boxes, etc., to complete tasks such as reaching the target point and picking up objects.
[0114] Figure 2 The experimental environment shown is Unlockpickupar, in which the agent is required to explore the environment. The first step is to pick up the key, the second step is to use the key to open the locked door, and the third step is to pick up the purple box. Only then is the task considered successful and the agent can get a reward.
[0115] Figure 3 The experimental environment shown is GoToR3BlueKeyAddPositionBonus. In this environment, the task of the agent is to fully explore a 3×3 maze environment and reach the blue ball to complete the task. There are other obstacles in this environment, such as balls of different colors, keys, and boxes.
[0116] In the first stage, when training the action causal evaluation network, the agent interacts with the environment continuously to obtain feedback information. The parameters of the deep reinforcement learning model are set as follows: the learning rate of the policy network and the value network are both 0.0003, the hidden layer size is [64,64], the value network update period T is 1, the optimizer uses the Adam optimizer, the discount factor Υ is 0.99, the entropy coefficient is 0.2, the parameter update rate d is 2048, the activation function uses the Tanh function, the batch size is 64, the experience replay buffer is set to 50000, the number of training steps is set to 2000000 steps, and the causality threshold α is set to 0.8. The parameters of the formal training stage are basically the same as those of the action causal evaluation network, and the number of training steps is set to 500000 steps to converge.
[0117] The present invention uses the deep reinforcement learning algorithm PPO to train the intelligent agent. The training results obtained after training in different experimental environments are as follows: Figure 4 , Figure 5 As shown in the figure. The horizontal axis represents the number of training steps, the vertical axis represents the reward obtained by the agent, the dotted line is the algorithm proposed by this invention, and the solid line is the traditional PPO algorithm. Figure 4It can be seen that when the number of steps reaches 100,000, the reward of the algorithm proposed in the present invention begins to rise significantly and begins to converge at 250,000 steps, while the traditional PPO algorithm curve begins to rise at 400,000 steps and is relatively slow. Figure 5 It shows that the reward of the present invention starts to rise at about 100,000 steps and starts to converge at 200,000 steps. From the animation effect of environment rendering, when the algorithm proposed by the present invention reaches convergence, the paths taken by the agent are all the shortest paths, while the task completion rate of the traditional PPO algorithm is very low. Whether from the reward curve or the animation effect, the algorithm of the present invention greatly improves the convergence speed, improves the exploration rate of the environment, and has a good effect on exploration.
[0118] In summary, by introducing the action causal evaluation network, the present invention enables the intelligent agent to better understand the impact of its actions on the environment, thereby conducting more efficient exploration; by screening out the minimum action space, the decision space of the intelligent agent is reduced, making the intelligent agent more efficient when performing tasks, and improving the speed and accuracy of learning and decision-making; at the same time, through the combination of the action causal evaluation network and the PPO algorithm, the intelligent agent can quickly adapt to and achieve effective strategy learning and optimization in different complex environments, thereby improving the versatility and robustness of the model; in addition, by setting a reward mechanism, the reward sparsity problem in complex environments is optimized to avoid falling into local optimal solutions, thereby improving the training efficiency and the performance of the final model. Therefore, the present invention effectively solves the problems of low exploration efficiency, long training time and poor adaptability in traditional methods through the combination of action causal evaluation and deep reinforcement learning, and provides an efficient, flexible and adaptable deep reinforcement learning exploration method, which provides strong support for the application of intelligent agents in complex environments.
[0119] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0120] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. An efficient exploration method for deep reinforcement learning based on action causality evaluation, characterized in that: The following steps are involved: Step 1: In the first stage, in different environments, the inverse dynamic model is used to train the impact of the agent's actions on the environment to obtain the action causal evaluation network; Step 2: According to the action causal evaluation network, input the current state and action to calculate the degree of influence of each action on the change of the environment state at the next moment; Step 3: Set a threshold to filter the actions of the agent to obtain the minimum action space and redundant action space of the agent; Step 4: Obtain the agent's environment information, input it into the deep reinforcement learning model together with the minimum action space, combine it with the proximal policy optimization algorithm, output the action performed by the agent and obtain feedback information from the environment until the training is completed; Step 5: Evaluate the performance of the model and check whether it converges in different environments.
2. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 1, characterized in that: The step 1 includes the following sub-steps: Step 11: Create and configure the reinforcement learning environment to obtain the shape of the observation space; Step 12: Select a strategy based on the shape of the environment's observation space and the parameters in the configuration file. If the dimension of the observation space is greater than 2, select the neural network strategy, otherwise select the multilayer perceptron strategy. Step 13: Create an extended observation space (observation space), based on which, initialize the inverse dynamics model and the inverse dynamics model trainer (action_trainer); then create a new state observation space and state action space to form a combination space, based on which, initialize the action causal evaluation network and the action causal evaluation network trainer (causality_trainer); Step 14: Create and initialize the deep reinforcement learning model, pass in the strategy, environment, action model trainer and action causal evaluation network trainer, start training, and save the obtained action causal evaluation network after training is completed.
3. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 2, characterized in that: The step 13 includes the following sub-steps: Step 131: Initialize the inverse dynamic model trainer, and train the inverse dynamic model (action_model) according to the incoming training data batch (batch) and parameters; Step 132: Use the action model network to predict the probability distribution of the action, and calculate the cross entropy loss between the predicted action probability and the actual action. The cross entropy loss is recorded as The formula is: Where N is the number of samples, i is the sample number, and y is the i is the true category label of the i-th sample, The probability of predicting the i-th sample as the j-th class; Calculate the cross entropy loss between the predicted action distribution and the real action to update the parameters of the inverse dynamics model, including gradient clipping and back propagation, and record the training indicators; Step 133: Initialize the action causal evaluation network trainer, set the initial parameter update counter, and whether it is a discrete action space; Step 134: Use the inverse dynamic model to calculate the action probability p(a|s,s ′ ,π(s)), a represents the selected action, s represents the current state, s ′ represents the state at the next moment, and π(s) represents the action probability of the strategy; Step 135: One-hot encode the action, take the current action and the one-hot encoded action as input, and calculate the action causality prediction value C(s,a) through the network; Step 136: Calculate logπ(a|s), where a represents the action, s represents the current state, and π(a|s) represents the probability of outputting action a when the state is s under the current strategy; then compare it with the action probability p(a|s,s ′ ,π(s)) uses KL divergence to calculate the action causality target value c target , the formula is: c target =logp(a|s,s ′ ,π(s))-logπ(a|s); Then use the mean square error loss function to calculate the action causality prediction value C(s,a) and the action causality target value c target The loss between.
4. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 2, characterized in that: Step 14 includes the following sub-steps: Step 141: Initialize the PPO algorithm based on the policy gradient method, including: strategy, environment, learning rate, number of training steps, and buffer size; Step 142: at the beginning of each acquisition cycle, the trajectory buffer rollout_buffer is reset, and in a loop, the current policy network is used to select actions and interact with the environment; feedback from the environment, such as observations, actions, and a flag indicating whether the round is complete, is stored in the replay buffer replay_buffer, observations, actions, old value function estimates, old action probabilities, and other data are stored in the trajectory buffer rollout_buffer, and at the end of each cycle, the collected rewards and value function estimates are used to calculate the advantage function estimate and store it in the trajectory buffer rollout_buffer; Step 143: Use the collected trajectory data to update the policy network and the value network, update the learning rate of the optimizer according to the current training progress, calculate the policy clipping range and the state value function clipping range; in each training cycle, obtain a batch of data from the trajectory buffer rollout_buffer and calculate the loss; the policy network loss is the negative mean of the smaller value of the unclipped and clipped losses, and the value network loss is the mean square error loss function and the entropy loss. The total loss is obtained by weighted summing the policy network loss, the value network loss and the entropy loss; Step 144: Use KL divergence to calculate the trained action causality value C(s t ,a i ), the formula is: C(s t ,a i )=D KL (P(s t+1 |s t ,a i )‖P π (s t+1 |s t )); Among them, a i Denoted as the i-th action, D KL represents KL divergence, P(s t+1 |s t ,a i ) means in state s t At this moment, perform action a i The next state after t+1 The probability distribution of π (s t+1 |s t ) means that under the strategy π, the state changes from s t Transfer to t+1 The probability distribution of the moment; after reaching the total number of training steps or meeting other stopping conditions, the final action causal evaluation network is obtained.
5. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 1, characterized in that: Step 2 includes the following sub-steps: Step 21: Get the size of the action space of the environment and the action causal evaluation network obtained in step 1, and use the torch.no_grad() method to ensure that the gradient is not recorded during the calculation process; Step 22: In a loop, the one-hot encoded action and current state observation values of each action are passed into the model, and the model's predicted output for the current state and action is obtained through forward propagation. The predicted output is then averaged along the batch dimension, and the above average is recorded until the end of the loop to obtain the average predicted value of each action, i.e., the action causality value.
6. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 1, characterized in that: Step 3 includes the following sub-steps: Step 31: For the actions that have been classified, obtain the causality value of each action based on the current state observation value of the environment and the action of the agent passed in step 2 above; Step 32: In view of the different action causality values of each environment, firstly perform a softmax function operation on all action causality values to normalize them, and map all action causality values to between 0 and 1 for subsequent adjustment of the threshold value; Step 33: Set a threshold α to filter actions, add actions with action causality values greater than the threshold α to the minimum action space, and actions with action causality values less than the threshold enter the redundant action space, until the actions in each action category are filtered out, and the minimum action space and redundant action space are obtained.
7. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 1, characterized in that: The step 4 includes the following sub-steps: Step 41: Initialize the PPO algorithm parameters, including the environment, learning rate, number of steps, batch size, discount factor, and pass these parameters into the action causal evaluation network obtained in step 1; Step 42: Extract features from the state observations returned by the environment, calculate the latent vector latent_pi through the policy network and the value network, and use the value network to calculate the value of the current state observation; Step 43: Generate the final action distribution based on the given latent vector latent_pi and the possible redundant action list redundant_actions_list; for the policy gradient method, when calculating the probability of each action, set the probability of the action in the redundant action space to a very small value to ensure that the probability of these actions being sampled is close to 0, and renormalize them so that the actions that the agent can choose only contain the minimum action space; the new strategy π after action screening causality The (a|s) formula is expressed as: Among them, π(a|s) is the original strategy for selecting action a in state s, A redundancy is a redundant action space; Step 44: Input the minimum action space into the PPO algorithm model to obtain the output action a t , execute output action a t Get feedback information, including the next state s t+1 , Reward t , whether the round is completed; store the above feedback information, if the round is over, obtain all the stored information, input the state into the value network to calculate the state value, and calculate the advantage function and value network loss, and back propagate to update the value network; input the stored state and action into the policy network, calculate the policy network loss based on the advantage function, and back propagate to update the policy network; repeat the above update process until the training is completed.
8. The efficient exploration method for deep reinforcement learning based on action causality evaluation according to claim 1, characterized in that: The specific steps of step 5 are as follows: A count-based reward mechanism is used to encourage the agent to explore more in the environment. The reward is set as: Among them, new_count is the number of visits of the agent at the current position, and bonus is the reward value at the current position. After the training is completed, check the convergence of the model and compare the effect with the original strategy to verify the advantages of this method.
Citation Information
Cited By
Discrete manufacturing system toughness enhancing method and system based on Petri net
CN120338457A
Dynamic catalytic process simulation method and device under working condition reaction condition and medium
CN121054119A
Multi-subgraph fusion reinforcement learning control method and system for multi-input multi-output system
CN121721968A
Robot motion control method and system based on cerebellum reinforcement learning
CN121756368A
First node, second node and methods performed thereby for handling actions in reinforcement learning
WO2026226073A1
