A reinforcement learning method and system based on safe feedback driving

By constructing trigger feature vectors in reinforcement learning and feeding them back to the policy network, and combining security constraint policies and hierarchical penalties for triggering reasons, the security risk problem of reinforcement learning models in uncovered scenarios is solved, thereby improving the security of the policy network and increasing learning efficiency.

CN123159447APending Publication Date: 2026-11-24BEIJING ELECTRIC VEHICLE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611376470.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In existing technologies, reinforcement learning models tend to output candidate game actions that pose safety risks when faced with uncovered traffic scenarios. Furthermore, the safety constraint policy is disconnected from the policy network, lacking a complete training loop, which leads to low learning efficiency of the policy network for safety boundaries.

Method used

By acquiring environmental state and opponent behavior features in real time during reinforcement learning, a trigger feature vector is constructed and fed back to the policy network for parameter updates. The candidate game actions are corrected by combining safety constraint policies, and a complete training closed loop is formed by adopting hierarchical safety penalties for trigger reasons and high-sampling weight replay.

Benefits of technology

Policy networks can learn the reasons why actions are blocked during training, and proactively avoid dangerous actions, thus improving the security of policy networks and their learning efficiency of safety boundaries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123159447A_ABST
    Figure CN123159447A_ABST
Patent Text Reader

Abstract

This application relates to the field of autonomous driving decision-making technology, and in particular to a reinforcement learning method and system based on safety feedback. The method includes: inputting first environmental state data and first opponent behavior feature data into an initial policy model to obtain candidate game actions corresponding to the simulated vehicle based on a first trigger feature vector; performing safety checks on the candidate game actions based on a safety constraint policy; constructing a trigger cause and correcting the candidate game actions when the safety check fails, thus obtaining an action to be executed; constructing a second trigger feature vector to replace the first trigger feature vector based on the action to be executed, the candidate game actions, and the trigger cause; driving the simulated vehicle to execute the action to be executed, constructing a reward value, and performing reinforcement learning on the initial policy model based on the action to be executed and the reward value; repeating the above steps until a trained reinforcement policy model is obtained. This significantly improves policy training efficiency while ensuring driving safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of autonomous driving decision-making technology, and in particular to a reinforcement learning method and system based on safety feedback. Background Technology

[0002] Autonomous vehicles need to engage in interactive games with surrounding traffic participants in complex traffic scenarios. Multi-agent reinforcement learning (MARL), with its ability to model the interactive game relationships among multiple agents, is widely used in training autonomous driving decision-making strategies. Existing solutions often use behavior cloning to pre-train the policy network of the MARL framework, using environmental states and opponent behavior data labeled with game actions to complete the construction of an initial policy model, enabling the initial model to have basic interactive decision-making capabilities.

[0003] However, reinforcement learning models are essentially data-driven black-box models. Even after pre-training with behavior cloning, the initial policy model can still easily output candidate game actions with safety risks when faced with out-of-distribution (OOD) traffic scenarios not covered by the training set. To address the issue of unsafe policy output actions, existing technologies have proposed various safety constraint filtering methods. For example, they utilize safety constraint strategies such as obstacle control functions, collision detection, and traffic rule verification to perform post-processing filtering on the actions output by reinforcement learning. This modifies dangerous actions at the action level and outputs actions that meet safety conditions for vehicles to execute, thereby achieving a safety fallback protection.

[0004] However, the aforementioned safety constraint filtering methods are essentially one-way fallback mechanisms. That is, the safety constraint strategy only intercepts or corrects dangerous actions at the action output end, while trigger information such as the triggering reason, the original action being corrected, the corrected alternative action, and the magnitude of the correction are discarded after the action is executed and not fed back into the policy network for training. This results in the policy network being unable to know why its output candidate game actions were intercepted, leading to repeated generation of similar dangerous actions in similar scenarios, and the policy's safety cannot be improved through training. Secondly, existing technologies lack a complete closed loop of action generation, safety correction, trigger encoding, and training feedback: trigger information is not encoded as a feature usable by the policy network; trigger samples are sampled with equal probability as ordinary samples in experience replay; and reward signals are not graded according to triggering reasons such as collision risk and poor comfort, resulting in low learning efficiency of the policy network for safety boundaries. Summary of the Invention

[0005] (a) Technical problems to be solved In view of the above-mentioned shortcomings and deficiencies of the prior art, this application provides a reinforcement learning method and system based on safety feedback, which solves the technical problems in the prior art where the triggering information of the safety constraint policy is discarded after the action is executed and cannot be fed back to the policy network for training, resulting in the policy network repeatedly generating the same dangerous actions in similar scenarios and the safety of the policy itself not improving with training; and the technical problems where the safety constraint policy and the policy network are isolated from each other and lack a complete training closed loop, resulting in the low efficiency of the policy network in learning the safety boundary.

[0006] (II) Technical Solution To achieve the above objectives, the main technical solutions adopted in this application include: In a first aspect, embodiments of this application provide a reinforcement learning method based on security feedback, comprising: Real-time acquired environmental state data and actual opponent vehicle behavior characteristic data are input into a pre-trained reinforcement strategy model to obtain actual game actions to guide the vehicle's autonomous driving; the reinforcement strategy model is trained through the following steps: S1. Obtain the first environmental state data and the first opponent's behavioral feature data of the simulated vehicle in the simulation environment. Input the first environmental state data and the first opponent's behavioral feature data into the pre-trained initial strategy model to obtain the candidate game action corresponding to the simulated vehicle based on the first environmental state data, the first opponent's behavioral feature data, and the first trigger feature vector deployed by the model. S2. Based on the pre-set security constraint strategy, perform security checks on candidate game actions. When a candidate game action fails the security check, construct the triggering reason for the failure. Based on the pre-set constraint objective function, modify the candidate game action to obtain the corresponding safe alternative action as the action to be executed. The objective function is used to minimize the action deviation between the safe alternative action and the candidate game action as the optimization objective, and to solve for the safe alternative action within the feasible domain defined by the security constraint strategy. S3. Based on the action to be executed, candidate game actions, and triggering reasons, construct a second triggering feature vector to replace the first triggering feature vector; S4. Drive the simulated vehicle in the simulation environment to perform the action to be performed in order to obtain the corresponding reward value, and update and train the initial policy model based on the action to be performed and the corresponding reward value. S5. Randomly reset the first environmental state data and the first opponent behavior feature data of the simulated vehicle in the simulation environment, and repeat steps S1-S5 until the pre-set reinforcement training termination condition is met to obtain the reinforcement strategy model that has been trained.

[0007] Optionally, the constraints corresponding to the safety constraint strategy include traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints. Based on pre-set security constraint strategies, security checks are performed on candidate game actions. When a candidate game action fails the security check, a triggering reason for the failure is constructed, including: S2-1. Based on a pre-set safety constraint strategy, candidate game actions are sequentially tested for traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints to determine whether the safety test of the candidate game action passes. Specifically, the traffic rule compliance test determines whether the candidate game action violates traffic rules; the dynamic feasible region test determines whether the candidate game action is within the vehicle's dynamic feasible region; the collision envelope test determines whether the candidate game action will cause the simulated vehicle to collide with surrounding objects; and the control obstacle function constraint test determines whether the candidate game action violates pre-set safety invariant set constraints. S2-2. When it is determined that the security detection of the candidate game action fails, the reasons corresponding to the failed detection items are constructed as the triggering reasons. When the safety detection of a candidate game action is passed, the triggering reason is a zero vector.

[0008] Optionally, both the candidate game action and the safe alternative action include longitudinal acceleration and steering angle; Based on a pre-set constraint objective function, candidate game actions are modified to obtain corresponding safe alternative actions, which are then used as actions to be executed, including: S2-3. Using the longitudinal acceleration and steering angle of the safety substitution action as decision variables, and minimizing the action deviation between the safety substitution action and the candidate game action as the optimization objective, construct the constraint objective function; S2-4. Using all the constraints corresponding to the security constraint strategy as the constraints of the constraint objective function, and performing constraint optimization to solve the constraint objective function within the feasible domain defined by the constraints of the constraint objective function; S2-5. When a solution exists within the feasible domain, the longitudinal acceleration and steering angle with the smallest action deviation are determined as the safe alternative action and used as the action to be executed. When the feasible domain is empty, a pre-set safety fallback action is output as the action to be executed.

[0009] Optionally, based on the action to be executed, candidate game actions, and triggering reasons, a second triggering feature vector is constructed, including: S3-1. Encode the triggering cause to obtain the corresponding cause component; S3-2. Record the longitudinal acceleration and turning angle of the candidate game action as the original action component, and record the longitudinal acceleration and turning angle of the action to be executed as the modified action component. S3-3. Based on the candidate game action and the action to be executed, calculate the longitudinal acceleration deviation and steering angle deviation between the candidate game action and the action to be executed, so as to construct the correction amplitude component; S3-4. The cause component, the original action component, the modified action component, and the modified amplitude component are concatenated in a preset order to form a feature vector of fixed dimensions, which is used as the second trigger feature vector.

[0010] Optionally, S1 includes: S1-1. Obtain road environment data and vehicle motion state data in the simulation environment to construct the first environment state data; S1-2. Obtain the position, speed, heading angle and historical driving trajectory of each opposing vehicle within a preset range around the simulated vehicle in the simulation environment. Based on the position, speed, heading angle and historical driving trajectory of each opposing vehicle, as well as the pre-set trajectory prediction algorithm, obtain the predicted trajectory of each opposing vehicle in the prediction time domain. Construct the first opposing vehicle behavior feature data based on the position, speed, heading angle, historical driving trajectory and predicted trajectory of each opposing vehicle. S1-3. Encode the first environmental state data and the first opponent behavior feature data to obtain the corresponding state features, and concatenate the state features with the first trigger feature vector to construct enhanced state input features; wherein, the first trigger feature vector is the second trigger feature vector constructed in the previous decision round, and the first trigger feature vector in the first decision round is a zero vector with a value of zero. S1-4. Input the enhanced state input features into the initial policy model for forward reasoning to obtain candidate game actions corresponding to the simulated vehicle.

[0011] Optionally, S4 includes: S4-1. Drive the simulated vehicle in the simulation environment to execute the action to be executed, so that the simulation environment performs a state transition based on the simulated vehicle executing the action to be executed, and obtains the corresponding reward value, as well as the second environment state data and the second opponent behavior feature data after executing the action to be executed. S4-2. The first environmental state data, the first opponent behavior feature data and the first trigger feature vector are concatenated to form the first enhanced state data, and the second environmental state data, the second opponent behavior feature data and the second trigger feature vector are concatenated to form the second enhanced state data. S4-3: Use the second environment state data as the first environment state data, use the second opponent's behavior feature data as the first opponent's behavior feature data, return to S1, and repeat until the preset number of times. S4-4. Based on the reward value corresponding to each decision step within a preset number of times, the first augmented state data and the second augmented state data, and the pre-set reinforcement learning algorithm, perform parameter update training on the initial policy model to update the policy network parameters of the initial policy model.

[0012] Optionally, S4-4 includes: Based on a pre-set discount factor, the reward value corresponding to each decision step within a preset number of times is discounted and accumulated to obtain the cumulative return for each decision step. Input the first enhanced state data and the second enhanced state data of each decision step within a preset number of times into a pre-set value network to obtain the first state value corresponding to the first enhanced state data and the second state value corresponding to the second enhanced state data in each decision step. Based on the discount factor, and the reward value, first state value and second state value corresponding to each decision step, an advantage function and temporal difference error corresponding to each decision step are constructed, and the value network loss is calculated based on the temporal difference error corresponding to each decision step; the advantage function is used to characterize the superiority or inferiority of the corresponding candidate game action, and the temporal difference error is used to characterize the degree of deviation between the estimated state value of the value network and the actual return. The first augmented state data corresponding to each decision step is re-input into the initial policy model to construct the action output distribution corresponding to each decision step, and the policy network loss is calculated based on the action output distribution and advantage function corresponding to each decision step. The network parameters of the value network are updated using gradients based on the value network loss, and the policy network parameters of the initial policy model are updated using gradients based on the policy network loss.

[0013] Optionally, based on the discount factor, and the reward value, first state value, and second state value corresponding to each decision step, an advantage function and temporal difference error corresponding to each decision step are constructed, and the value network loss is calculated based on the temporal difference error corresponding to each decision step, including: Based on the reward value, discount factor, and second state value corresponding to each decision step, a temporal difference objective is constructed for each decision step; wherein, the temporal difference objective for any decision step is the sum of the product of the discount factor and the second state value corresponding to that decision step and the reward value of that decision step. Based on the temporal difference objective and the first state value corresponding to each decision step, a temporal difference error corresponding to each decision step is constructed; wherein, the temporal difference error of any decision step is the difference between the temporal difference objective and the first state value corresponding to that decision step. Based on the cumulative reward and the first state value corresponding to each decision step, an advantage function is constructed for each decision step; wherein, the advantage function for any decision step is the difference between the cumulative reward and the first state value corresponding to that decision step. A value network loss is constructed based on the temporal difference errors corresponding to all decision steps within a preset number of iterations; wherein the value network loss is the ratio of the sum of squares of the temporal difference errors corresponding to each decision step within the preset number of iterations to the preset number of iterations.

[0014] Optionally, after step S5, the method further includes: S6. Statistically analyze the correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions during the reinforcement training process, and conduct an online security review of the strategy model based on the correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions.

[0015] Secondly, this application provides a security feedback-driven reinforcement learning system, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the aforementioned security feedback-driven reinforcement learning method.

[0016] (III) Beneficial Effects This application presents a reinforcement learning method based on security feedback. When a security constraint policy modifies candidate game actions, it encodes the triggering cause, candidate game action, safe alternative action, and correction magnitude into a triggering feature vector. This triggering feature vector is then fed back into the policy network's decision input and parameter update training process. Combined with security penalties tiered according to triggering causes, priority replay of trigger samples with high sampling weights, and monitoring and reward shaping of the security shield intervention rate, this method overcomes the limitations of existing technologies where security constraint policies only provide one-way fallback and triggering information is discarded after action execution. It enables the policy network to learn during training why and under what circumstances candidate game actions are intercepted, and gradually learns to proactively avoid dangerous actions that will be modified or fallbacked by the security constraint policy during the candidate game action generation stage. This transforms the security constraint policy from a high-frequency last line of defense into a rarely intervened safety net, thereby continuously improving the policy's security with training and significantly increasing the policy network's learning efficiency of the security boundary. Attached Figure Description

[0017] Figure 1A schematic diagram of a security feedback-driven reinforcement learning method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the candidate game action generation process provided in an embodiment of this application; Figure 3 This is a schematic diagram of the trigger cause generation process provided in an embodiment of this application; Figure 4 This is a schematic diagram of the process for constructing actions to be executed, provided in an embodiment of this application. Figure 5 This is a schematic diagram of the second trigger feature vector construction process provided in the embodiments of this application; Figure 6 This is a schematic diagram of the initial strategy model parameter update training process provided in the embodiments of this application. Detailed Implementation

[0018] To better explain and facilitate understanding of this application, the following detailed description of the application is provided in conjunction with the accompanying drawings and specific embodiments.

[0019] Autonomous vehicles need to interact and engage in games with surrounding participants in complex traffic scenarios. Multi-agent reinforcement learning (MARL), adept at modeling multi-agent games, is used for autonomous driving decision training. Current methods typically involve behavioral cloning, using game-labeled environment and opponent behavior data to pre-train an initial policy model with basic decision-making capabilities. However, this model is a data-driven black-box model, prone to outputting risky actions in out-of-distribution scenarios. To address this, existing methods introduce safety constraints such as control obstacle functions and collision detection as post-processing fallbacks. However, these methods are one-way fallbacks; safety trigger information is discarded after execution and not fed back into the training, leading to repeated outputs of dangerous actions. Furthermore, the lack of a complete training loop means that trigger information is not encoded as usable features, samples are not differentiated, and rewards are not graded, resulting in low efficiency in learning the safety boundaries of the policy.

[0020] Therefore, this application provides a reinforcement learning method based on security feedback, which combines security penalties tiered by trigger cause, priority replay of trigger samples with high weights, security shield intervention rate monitoring, and reward shaping to overcome the shortcomings of traditional one-way safety constraints and direct discarding of trigger information. This allows the policy network to understand the scenario and reason for action interception, prompting the model to proactively avoid dangerous behaviors when generating candidate game actions. This transforms security constraints from a high-frequency last line of defense to a low-frequency safety net, enabling the policy's own security to improve with training iterations and effectively enhancing the policy network's learning efficiency of security boundaries.

[0021] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application can be understood more clearly and thoroughly, and that the scope of this application can be fully conveyed to those skilled in the art.

[0022] This application provides a reinforcement learning method based on safety feedback, implemented in a pre-deployed autonomous driving simulation environment, including: Real-time acquired environmental state data and actual opponent vehicle behavior characteristic data are input into a pre-trained reinforcement strategy model to obtain actual game actions to guide the vehicle's autonomous driving; such as Figure 1 As shown, the reinforcement strategy model is trained through the following steps: S1. Obtain the first environmental state data and the first opponent's behavioral feature data of the simulated vehicle in the simulation environment, and input the first environmental state data and the first opponent's behavioral feature data into the pre-trained initial policy model, so as to obtain the candidate game action corresponding to the simulated vehicle based on the first environmental state data, the first opponent's behavioral feature data, and the pre-set first trigger feature vector; wherein, the initial policy model includes the policy model obtained by pre-training the policy network of the multi-agent reinforcement learning framework with behavior cloning using environmental state training data and opponent behavior training data with known game action labels; S2. Based on a pre-set security constraint strategy, security checks are performed on candidate game actions. When a candidate game action fails the security check, a triggering reason for the failure is constructed. Based on a pre-set constraint objective function, the candidate game action is modified to obtain a corresponding safe alternative action as the action to be executed. The objective function is used to minimize the action deviation between the safe alternative action and the candidate game action as the optimization objective, and the safe alternative action is solved within the feasible domain defined by the security constraint strategy. S3. Based on the action to be executed, candidate game actions, and triggering reasons, construct a second triggering feature vector to replace the first triggering feature vector; S4. Drive the simulated vehicle in the simulation environment to perform the action to be performed in order to obtain the corresponding reward value, and update and train the initial policy model based on the action to be performed and the corresponding reward value. S5. Randomly reset the first environmental state data and the first opponent behavior feature data of the simulated vehicle in the simulation environment, and repeat steps S1-S5 until the pre-set reinforcement training termination condition is met to obtain the reinforcement strategy model that has been trained.

[0023] This application presents a reinforcement learning method based on security feedback. When a security constraint policy modifies candidate game actions, it encodes the triggering cause, candidate game action, safe alternative action, and correction magnitude into a triggering feature vector. This triggering feature vector is then fed back into the policy network's decision input and parameter update training process. Combined with security penalties tiered according to triggering causes, priority replay of trigger samples with high sampling weights, and monitoring and reward shaping of the security shield intervention rate, this method overcomes the limitations of existing technologies where security constraint policies only provide one-way fallback and triggering information is discarded after action execution. It enables the policy network to learn during training why and under what circumstances candidate game actions are intercepted, and gradually learns to proactively avoid dangerous actions that will be modified or fallbacked by the security constraint policy during the candidate game action generation stage. This transforms the security constraint policy from a high-frequency last line of defense into a rarely intervened safety net, thereby continuously improving the policy's security with training and significantly increasing the policy network's learning efficiency of the security boundary.

[0024] Furthermore, the simulation environment is equipped with simulated vehicles (autonomous vehicles) and multiple adversary vehicles, which are controlled by a pre-set driving behavior model. The autonomous vehicle's decisions are executed discretely according to a fixed decision cycle (i.e., one decision round, which contains multiple decision steps, each decision step lasting 0.5 seconds), and each decision cycle is recorded as one decision round.

[0025] Furthermore, an autonomous driving simulation environment is pre-deployed to construct a signalless crossroads scenario: vehicle E travels straight from west to east, while the opposing vehicle O turns left from east to south, and the trajectories of the two vehicles intersect at the conflict point C.

[0026] Furthermore, taking the 0th decision round (t=0) as an example, the preset state is: vehicle speed v E =8.0m / s, distance d from the conflict point E =24m; Opponent's vehicle speed v O =6.0m / s, distance d from the conflict point O =18m; Road surface adhesion coefficient μ=0.8; Road speed limit v lim =13.9 m / s (50 km / h); the comfort range for longitudinal acceleration is [-3.0, +2.5] m / s². 2 The pre-set safety backup action is emergency braking, with a braking deceleration of a. fb =-5.5m / s 2 Its absolute value of 5.5 is less than the adhesion limit μg≈7.8m / s². The opposing vehicle O is controlled by an aggressive driving behavior model (yielding rate 20%), and its average acceleration over the past 3 seconds is +0.9m / s². 2 The trajectory prediction algorithm outputs the predicted acceleration a. O =+1.5m / s 2 .

[0027] Furthermore, expert driving demonstration data is pre-collected as training data for both environmental states and opponent behavior. Each sample includes environmental state data, opponent behavior feature data, and labels for the game actions performed by the expert in that state. Game action labels include longitudinal acceleration, steering angle, and game intent labels (probing forward, slowing down to yield, accelerating through). Using the training data containing known game action labels, the policy network of the multi-agent reinforcement learning framework undergoes behavioral cloning pre-training: supervised training is performed using the cross-entropy between the labels and network output (intent labels) and negative log-likelihood (continuous control input) as losses until the validation set accuracy converges, obtaining the initial policy model. Behavioral cloning pre-training enables the initial policy model to possess basic interactive decision-making capabilities, avoiding the output of numerous dangerous actions during the subsequent cold start phase of reinforcement learning.

[0028] In this embodiment, the policy network adopts the following structure: the vehicle's motion state and road environment data are encoded by a multilayer perceptron; the historical driving trajectory of each opponent vehicle is encoded by a recurrent neural network and then converged into opponent behavior features by an attention mechanism; the above features and trigger feature vectors are concatenated and processed by a fusion backbone network. The output layer includes a discrete intent output head (outputting the probability of each game intent label via softmax) and a continuous control output head (outputting the distribution parameters of longitudinal acceleration and steering angle). The value network and policy network are set up in parallel, using enhanced state data as input and outputting state value. The value network is only used during the parameter update training phase and is discarded after policy deployment.

[0029] Optionally, in a specific embodiment, S1 is as follows: Figure 2 As shown, it includes: S1-1. Obtain road environment data and vehicle motion state data in the simulation environment to construct the first environmental state data; S1-2. Obtain the position, speed, heading angle and historical driving trajectory of each opposing vehicle within a preset range around the simulated vehicle in the simulation environment. Based on the position, speed, heading angle and historical driving trajectory of each opposing vehicle, as well as the pre-set trajectory prediction algorithm, obtain the predicted trajectory of each opposing vehicle in the prediction time domain. Construct the first opposing vehicle behavior feature data based on the position, speed, heading angle, historical driving trajectory and predicted trajectory of each opposing vehicle. S1-3. Encode the first environmental state data and the first opponent behavior feature data to obtain the corresponding state features, and concatenate the state features with the first trigger feature vector to construct the enhanced state input features; wherein, the first trigger feature vector is the second trigger feature vector constructed in the previous decision round, and the first trigger feature vector of the first decision round is a zero vector with a value of zero; S1-4. Input the enhanced state input features into the initial policy model for forward reasoning to obtain the candidate game actions corresponding to the simulated vehicle.

[0030] Specifically, the simulation environment opens the state interface in each decision round to obtain road environment data and vehicle motion state data, which together construct the first environmental state data.

[0031] The road environment data includes static road information and dynamic traffic facility information, including but not limited to: road topology, stop line location, conflict point location, traffic light phase, road speed limit, and road surface adhesion coefficient. Specifically, road topology represents the intersection type, number of lanes, and connection relationships; at t=0, a cross intersection is used, with the vehicle in the straight lane. Lane line type indicates whether the lane dividers are solid or dashed; at t=0, both sides of the vehicle's lane are dashed. Stop line location indicates the position of each approach lane's stop line relative to the vehicle; at t=0, there is no traffic signal control and no stop line constraints. Conflict point location indicates the relative position of the intersection point C between the vehicle's planned path and the opponent's path; at t=0, conflict point C is located 24m ahead of the vehicle. Traffic light phase indicates the current light color and remaining time; at t=0, this field is empty as there is no traffic light control. Road speed limit indicates the current road segment's speed limit value; at t=0, the speed limit is... lim =13.9m / s (50km / h); the road adhesion coefficient is determined by the road type and weather conditions. At t=0, μ=0.8 (dry asphalt).

[0032] Vehicle motion data, including: vehicle speed v E The data includes position (global coordinates x, y), heading angle, current acceleration, lane number, and turn signal status. The value at step t=0 is v. E =8.0m / s, distance d from the conflict point E =24m, heading angle along the lane direction, current acceleration is 0.

[0033] In the above data, static road information is acquired and cached once when the scene is loaded, while dynamic information is refreshed in each decision round; each numerical data item is normalized according to preset normalization parameters (dimensions, value range) and then used for feature encoding.

[0034] Obtain behavioral characteristic data of the first opponent: Centered on the vehicle, identify traffic participants within a preset range around the simulated environment (in this embodiment, a fan-shaped perception area with a radius of 80m). In this decision round, the opposing vehicle O (turning left from east to south) is selected, while other distant vehicles are not included.

[0035] For each opposing vehicle, its current position, speed, heading angle, and historical driving trajectory recorded over a preset time period (3 seconds in this embodiment) at a preset sampling frequency (10 Hz in this embodiment, i.e., 30 trajectory points) are obtained. Vehicle O's historical data shows its average acceleration over the past 3 seconds is +0.9 m / s². 2 It is accelerating towards the point of conflict.

[0036] The position, speed, heading angle, and historical trajectory of the opposing vehicle are input into a pre-set trajectory prediction algorithm to obtain its predicted trajectory within the prediction time domain (5 seconds in this embodiment). The trajectory prediction algorithm in this embodiment employs a physical prediction method combining a constant turning rate and acceleration model (CTRA) with driving style parameters: based on the aggressive driving behavior model of vehicle O (with a yield rate of 20%), the predicted acceleration α is output. O =+1.5m / s 2 The time t when vehicle O arrives at the conflict point is calculated. O The time to conflict point is approximately 2.32 s, and considering the uncertainty of prediction, the window of conflict points is [2.1, 3.1] s. Alternatively, the trajectory prediction algorithm can adopt a learning-based prediction model based on recurrent neural networks to output multimodal predicted trajectories with probability distributions.

[0037] The position, speed, heading angle, historical driving trajectory, and predicted trajectory of each opponent vehicle are combined to construct the first opponent behavior feature data; when there are multiple opponent vehicles, they are arranged in a preset order, and if the number of opponents is less than the preset upper limit, they are filled with a mask to ensure that the input dimensions are fixed.

[0038] Then, feature encoding is performed on the first environmental state data and the first opponent behavior feature data respectively to obtain state features: The vehicle motion state data and road environment data are concatenated and encoded into a vehicle-road feature vector by a multilayer perceptron (two layers in this embodiment, 64 neurons per layer); The historical driving trajectory sequence (30 trajectory points) of each opponent vehicle is encoded point by point by a recurrent neural network (GRU with a hidden dimension of 64 in this embodiment) to output sequence features; the sequence features of each opponent vehicle are converged by a multi-head attention mechanism - the attention weights are allocated according to the potential conflict degree between each opponent and the own vehicle (such as the time difference and distance to the conflict point), and the opponent with the more urgent conflict with the own vehicle receives a higher weight, outputting the opponent behavior feature vector; the predicted trajectory is encoded and used as an additional component of the opponent features.

[0039] Secondly, the state features are concatenated with the first trigger feature vector to construct enhanced state input features. The first trigger feature vector is the second trigger feature vector constructed in the previous decision round (i.e., the encoding of the security constraint policy detection result in the previous decision round, the structure of which is shown in Section 5 of Example 1: trigger flag, cause component, original action component, modified action component, and modified magnitude component are concatenated in a fixed order with fixed dimensions); the first decision round does not have a previous decision round, so the first trigger feature vector is a zero vector with a value of zero. The trigger feature vector is directly concatenated after the state features, allowing the policy network to refer to the most recent security constraint intervention during inference.

[0040] Finally, the enhanced state input features are processed by the fusion backbone network (in this embodiment, a two-layer multilayer perceptron with 256 neurons per layer), and the output layer outputs candidate game actions through forward inference. The output layer includes two output heads: Discrete Intent Output Header: Outputs the probability distribution of each game intent label via softmax. The game intent labels include "probing forward", "slowing down to give way", and "speeding up to pass". The one with the highest probability is selected as the candidate game intent. Continuous control output head: outputs Gaussian distribution parameters (mean and logarithmic standard deviation) of longitudinal acceleration and steering angle, sampled and scaled to the physical range using tanh (in this embodiment, longitudinal acceleration a). x ∈[-5.5,+2.5]m / s 2 The steering angle δ∈[-30°,+30°] is used to obtain the candidate continuous control quantity.

[0041] Inference results at t=0 steps: The discrete intention output head outputs a probability of 0.62 for "tentative advance", 0.28 for "decelerate and yield", and 0.10 for "accelerate through". The candidate game intention is "tentative advance". The continuous control output head outputs a longitudinal acceleration a. raw =+2.0m / s 2 Steering angle δ raw =0. Candidate game action (a) raw =+2.0m / s 2 δ raw =0, intention: tentative exploration) and then sent to S2 security detection.

[0042] This embodiment obtains information by classifying environmental state data and opponent behavior feature data, and filters opponent vehicles through perception range and extracts historical trajectory windows, ensuring that the input information of the policy network is complete and has fixed dimensions, making it suitable for batch training. The opponent's historical trajectory is encoded by a recurrent neural network and converged by an attention mechanism according to the urgency of the conflict, enabling the policy network to focus on key interaction objects in multi-opponent scenarios, resulting in more accurate judgment of game intent. Furthermore, the first trigger feature vector is concatenated with the state feature to form an enhanced state input feature, allowing the security constraint intervention information from the previous decision round to directly enter the reasoning of the current decision round. The policy network can adjust the action generation based on recent interception situations, providing an input-side path for "trigger information back training". Finally, the dual-head output of discrete intent and continuous control ensures that candidate game actions simultaneously possess semantically interpretable game intent and executable control quantity, and the game intent label can be directly used for subsequent trigger encoding and correction magnitude evaluation.

[0043] In addition, road environment data can also include weather conditions, lighting conditions, and construction area information; vehicle motion state data can also include yaw rate, tire status, etc.; the opponent selection range and historical trajectory window duration can be calibrated according to the scenario; the trajectory prediction algorithm can adopt a constant velocity model, a constant acceleration model, a CTRA model, a learning model based on GRU / Transformer, or a combination thereof, and the predicted trajectory can be a single-modal deterministic trajectory or a multi-modal probabilistic trajectory; in the feature encoding network, the vehicle branch and the opponent branch can share the encoder, the recurrent neural network can use LSTM or a temporal convolutional network to replace GRU, and the attention mechanism can use multi-head attention or simplified weighted pooling; the number of layers and neurons in the fusion backbone network can be adjusted; the continuous control output head can directly output deterministic values ​​instead of Gaussian distributed parameters; the set of game intent labels for candidate game actions can be expanded according to the scenario (such as "waiting while following" or "changing lanes to bypass"); the concatenation position of the trigger feature vector and the state feature can be before or after the fusion backbone, and the dimension can remain fixed.

[0044] Optionally, in a specific embodiment, the constraints corresponding to the safety constraint strategy include traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints; Based on pre-set security constraint strategies, security checks are performed on candidate game actions. When a candidate game action fails the security check, a triggering reason for the failure is constructed, such as... Figure 3 As shown, it includes: S2-1. Based on a pre-set safety constraint strategy, candidate game actions are sequentially tested for traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints to determine whether the candidate game action passes the safety test. Among them, traffic rule compliance detection is used to determine whether the candidate game action violates traffic rules, dynamic feasible region detection is used to determine whether the candidate game action is within the vehicle's dynamic feasible region, collision envelope detection is used to determine whether the candidate game action will cause the simulated vehicle to collide with surrounding objects, and control obstacle function constraint detection is used to determine whether the candidate game action violates the pre-set safety invariant set constraints. S2-2. When it is determined that the safety detection of the candidate game action fails, the reasons corresponding to the failed detection items are constructed as triggering reasons. When the safety check of the candidate game action is passed, the trigger reason is the zero vector.

[0045] Furthermore, based on a pre-set constraint objective function, candidate game actions are modified to obtain corresponding safe alternative actions, which are then used as actions to be executed, such as... Figure 4 As shown, it includes: S2-3. Using the longitudinal acceleration and steering angle of the safe alternative action as decision variables, and the minimum action deviation between the safe alternative action and the candidate game action as the optimization objective, construct a constrained objective function. S2-4. Using all the constraints corresponding to the safety constraint strategy as the constraints of the objective function, the objective function is optimized within the feasible domain defined by the constraints of the objective function. S2-5. When a solution exists within the feasible domain, the longitudinal acceleration and steering angle with the smallest action deviation are determined as safe alternative actions and used as actions to be executed. When the feasible domain is empty, output the pre-set safety fallback action as the action to be executed.

[0046] Specifically, using the same example of a crossroads without signal control (vehicle E travels straight through the intersection, while oncoming vehicle O turns left and crosses its path; their paths conflict at point C; decision step size Δt = 0.5s, prediction time T = 3s, trajectory extrapolation step size 0.1s), the input conditions and strategy output of the decision round at t = 0 are used: vehicle speed v E =8.0m / s, the path distance d from the front of the vehicle to the conflict point C E =24m; Opponent's vehicle speed v O =6.0m / s, distance d from the conflict point along the left-turn arc path O =18m, trajectory prediction gives its predicted acceleration a O =+1.5m / s 2The road surface adhesion coefficient μ=0.8, and the road speed limit v lim =13.9 m / s (50 km / h). The candidate game action output by the forward inference of the initial strategy model is: game intention "probing" (confidence level 0.62), and the candidate longitudinal acceleration a of the continuous control variable. raw =+2.0m / s 2 Candidate steering angle δ raw =0°.

[0047] The security constraint strategy described in this embodiment is a non-learning white-box security filter layer. Its detection criteria and correction rules are pre-calibrated before training begins and frozen throughout the training process, and do not participate in gradient updates. From the perspective of reinforcement learning modeling, the security constraint strategy and the simulation environment together constitute the "environment" for policy network interaction. The policy network only perceives its existence through reward values ​​and state transitions.

[0048] The security constraint strategy receives candidate game action u raw =(a raw ,δ raw After setting )=(+2.0,0°), perform the four tests sequentially according to the hierarchical order of "regularity first, optimization second": Traffic rule compliance constraint detection (rule-based): Determines whether a candidate action results in traffic rule violations such as speeding, running a red light, or crossing a solid line; Dynamic feasible domain constraint detection (rule-based): Determine whether candidate actions exceed the boundaries of road surface adhesion, vehicle physical limits, and comfort. Collision envelope constraint detection (optimization): Based on the vehicle dynamics model, the future pose sequence of both parties is deduced, and it is determined whether the spatiotemporal envelopes intersect. Control Barrier Function (CBF) Constraint Detection (Optimization): Based on the theory of safety invariant sets, calculate whether the continuous safety margin and its rate of change satisfy forward invariance.

[0049] Regularity checks require minimal computation and no trajectory derivation, allowing for rapid rejection when performed as a pre-processor. Optimization checks, which require dynamic derivation, are executed after regularity checks have passed. If any check fails, its corresponding identifier is recorded. This can be implemented using short-circuit evaluation (entering a correction process immediately upon failure of a regularity check to reduce latency) or by completing all checks to fully record the triggering cause. In this example, both regularity checks passed, so all four checks were executed. The total time for single-step detection and solution of the safety constraint strategy is in the millisecond range, meeting the real-time requirements of online decision-making. The specific steps are as follows: Traffic rule compliance detection extrapolates the vehicle's motion state for a future decision round (extending to the entire prediction time domain if necessary) based on candidate actions, and verifies traffic rule constraints item by item: Final vehicle speed in the deduction decision step: v'=v E +ax Δt = 8.0 + 2.0 × 0.5 = 9.0 m / s; The condition for judgment is v'≤v lim In this embodiment, 9 < 13.9, so the overspeed determination is passed.

[0050] Based on the traffic light phase, lane type, and the projected trajectory (including the driving curvature corresponding to the steering angle δ) from the first environmental state data, it is determined whether the projected trajectory crosses the stop line and runs a red light, or whether it crosses a solid line to change lanes. This example is for an unsignalized intersection where the vehicle is traveling straight along its lane, δ... raw =0°, the projected trajectory coincides with the lane centerline, red light / solid line indicates passage.

[0051] Test result: The traffic rule compliance test has been passed.

[0052] Dynamic feasible domain detection, based on the current vehicle speed, road surface adhesion coefficient, and vehicle physical limits, verifies whether the acceleration vector and steering angle of candidate actions are within the range achievable by the vehicle and acceptable for ride comfort. Tire adhesion circle constraint: longitudinal acceleration a x With lateral acceleration a y The combined acceleration must not exceed the maximum acceleration provided by the road surface adhesion: ; Where g = 9.8 m / s 2 μg = 0.8 × 9.8 ≈ 7.8 m / s 2 Lateral acceleration is calculated from the steering angle using a bicycle model. y ≈v E 2 ·δ / L (L is the wheelbase). In this example, δ raw =0°so a y ≈0, the resultant acceleration is 2.0 m / s². 2 <7.8m / s 2 The attachment constraints are satisfied.

[0053] Turning to physical limit constraint: |δ|≤δ max δ max =30°. In this embodiment, |δ|=0°, which is satisfied.

[0054] Speed ​​feasibility constraint: The final vehicle speed in the simulation step satisfies 0 ≤ v' ≤ v lim (Reverse driving or speeding is not allowed). In this example, v'=9.0m / s, which is satisfied.

[0055] Comfort boundary constraints: The candidate longitudinal acceleration is within the preset comfort acceleration range [a comf,min ,a comf,max ]: a comf,min ≤a x ≤a comf,max ,Right now 3.0≤a x ≤+2.5m / s 2 ; This calculation example a raw =+2.0m / s 2 It is within the comfort zone and meets the requirements.

[0056] Test result: The dynamic feasible domain test passed.

[0057] Collision envelope constraint detection: The collision envelope constraint detection is based on the vehicle dynamics model (in this embodiment, the CTRA constant curvature and acceleration model is used), and the pose sequence of the self-vehicle and each opposing vehicle in the prediction time domain T=3s is derived with a step size of 0.1s; for each pose, an expansion safety margin d is applied to the vehicle profile (length 4.8m × width 2.0m). safe =0.3m generates a spatiotemporal occupancy envelope, and determines whether the vehicular envelope intersects with the envelope of any opposing vehicle in the prediction time domain.

[0058] For intersection conflict scenarios, the envelope intersection determination is simplified to the time window overlap determination of conflict points: The time window in which the opposing vehicle O enters the conflict point C area along the left-turn arc: d O =18m、v O =6.0m / s, a O =+1.5m / s 2 According to s=vO·t+(1 / 2)a O ·t 2 The time window for the O vehicle's envelope (including vehicle length and expansion margin) to intrude into the conflict zone is calculated as [t]. O,in ,t O,out = [2.1s, 3.1s] (Center arrival time is approximately 2.32s); Vehicle E in candidate action (a) raw =+2.0m / s 2 ) below, with d E =v E ·t+(1 / 2)a x ·t 2 That is 24=8t+t 2 The time window for the vehicle's envelope to intrude into the conflict zone is calculated as [t]. E,in ,t E,out = [2.1s, 2.6s] (Center arrival time is approximately 2.32s).

[0059] The two time windows overlap by a segment [2.1s, 2.6s], with an overlap duration Δt.overlap =0.5s indicates that if both vehicles move along the predicted trajectory, the vehicle and the opponent vehicle will collide in the conflict zone.

[0060] For longitudinal interaction scenarios such as following other vehicles and cutting in, collision envelope detection simultaneously calculates the collision time-to-collision (TTC). TTC=d rel / v rel ; Where d rel v represents the longitudinal spacing within the same lane. rel The approach speed of the vehicle relative to the vehicle in front; when TTC <TTC thr (In this embodiment, 2.0s is taken) and the test is deemed unsuccessful.

[0061] Detection conclusion: The time windows of the conflict points overlap by 0.5s under the candidate actions, and the collision envelope detection fails.

[0062] Control Barrier Function (CBF) Constraint Detection: Control barrier function constraint detection is based on control barrier function theory, defining a continuously differentiable safety margin function h(x), with the safety invariant set C=x:h(x)≥0, and candidate actions u must simultaneously satisfy: h(x,u)≥0, and (x,u)≥ α(h(x)); Where α(·) is a preset K-type function (in this embodiment, α(h) = k·h, k = 1.0), and the second term is the forward invariance condition, requiring that the safety margin must not be faster than The rate of α(h) decays. (x,u) is the reciprocal of the time of h(x,u), and its calculation formula is: ; That is, the control variable u enters through the system dynamics f(x,u). of.

[0063] For different interaction configurations, the specific form of the safety margin function h(x) is as follows: Following the car / entering the scene: h(x)=d rel v rel 2 / (2μg) d safe This refers to the remaining margin after deducting the limit braking distance and the static safety margin from the current distance; Intersection conflict scenario: h(x) is the spatiotemporal separation margin at the conflict point. When the time windows of the two sides' envelopes do not overlap, h is the spatial interval of the time interval converted according to the speed of the vehicle passing through; when the time windows overlap, h is the negative mutual intrusion depth of the envelopes (calculated by multiplying the time window overlap duration by the lateral conversion relative speed at the conflict point).

[0064] In this example, under the candidate actions, the time window overlap is 0.5s, the relative passing speed at the collision point is approximately 1.2m / s, and the mutual invasion depth of the envelopes is approximately 0.6m. Therefore: h eff ≈ 0.6m<0 The safety margin is negative and the forward invariance condition is not met, so the control obstacle function constraint check fails.

[0065] Summary of the four tests: Passed the traffic rule compliance constraint test, passed the dynamic feasible domain constraint test, failed the collision envelope constraint test, and failed the control obstacle function constraint test.

[0066] When a candidate game action fails a safety check, the reason corresponding to the failed check item is constructed as a triggering cause. In this embodiment, the four check results are categorized into two types of triggering causes based on their risk nature (in the form of "Triggering Cause Category - Corresponding Failed Check Item - Risk Meaning"): Collision Risk Category - Collision envelope detection failed, control obstacle function constraint detection failed - Candidate actions will cause or approach a collision, which is a high-risk trigger; Compliance and Comfort Category - Traffic rule compliance test failed, dynamic feasible domain test failed - Candidate action violated regulations, exceeded the physical feasible domain or comfort boundary, which is a general trigger.

[0067] In this example, both the collision envelope detection and CBF constraint detection failed. The triggering cause was constructed as a "collision risk class". At the same time, the identifier bits of the two failed detection items were recorded for subsequent S3 steps to encode as the cause components of the triggering feature vector.

[0068] When all four checks pass, the candidate game action is directly executed as the action to be executed without constructing a triggering cause. Furthermore, the second triggering feature vector output in this decision round is a zero vector with all zero values ​​(trigger flag position 0) to ensure that the input dimension of the policy network remains constant.

[0069] When the test fails, the longitudinal acceleration a of the safety alternative action is used. x And the steering angle δ is the decision variable u=(a x The objective function is constructed with the goal of minimizing the action deviation between safe alternative actions and candidate game actions (δ). min J(u)=w a ·(ax a raw ) 2 +w δ ·(δ δ raw ) 2 ; Where ax and δ are the longitudinal acceleration and steering angle of the safety substitution action, respectively, and is the value to be solved. raw δ raw These are the longitudinal acceleration and steering angle (corrected baseline) of the candidate game action, respectively. raw =+2.0m / s2、δ raw =0°, w a w δ These are the vertical and horizontal correction weights (values ​​after dimension normalization). Generally, w a =w δ =1.

[0070] The physical meaning of this objective function is: among all possible actions that meet the safety requirements, select the action that is closest to the original output of the policy network, so as to preserve the game intention of the policy network to the greatest extent while ensuring safety.

[0071] Using all constraints corresponding to the safety constraint strategy as constraints for the objective function, a constraint optimization problem is formed (in one specific implementation, this constraint optimization problem is a quadratic programming problem, which can be solved using the active set method or the interior point method; the Boolean rule decisions and envelope disjoint decisions in the constraints are linearized into linear constraints of decision variables according to the current scenario before solving): Constraint C1 (Traffic rule compliance constraint): v E +a x ·Δ t ≤v lim The simulated trajectory will not run red lights or cross solid lines; E +a x ·Δt≥0; Constraint C2 (Dynamic Feasibility Region Constraint): (μg≈7.8m / s²);|δ|≤δ max =30°; 3.0≤a x ≤+2.5 (comfort zone); Constraint C3 (collision envelope): The vehicle's envelope does not intersect with the envelopes of all opponents in the prediction time domain, and the time windows of the collision points of the vehicles and the opponents do not overlap in the intersection scenario; Constraint C4 (Control Barrier Function): h(x,u)≥0 and ≥ α(h) is the safety margin, which is non-negative and satisfies forward invariance.

[0072] In the intersection game scenario, constraints C3 and C4 naturally correspond to two mutually exclusive feasible branches, which the solver checks separately: Branch 1 (Overtaking Branch: The vehicle passes the conflict point before the other vehicle): The vehicle's front end must arrive at the conflict point no later than the other vehicle's intrusion time, i.e., t... E ≤t O,in =2.1s. From 24=8t E +(1 / 2)·a x ·t E 2 The inverse solution requires a longitudinal acceleration a. x ≥3.27m / s 2 Exceeding the upper limit of the comfort zone by 2.5 m / s 2 The constraint C2 is violated, and the feasible region of the preemptive branch is empty, resulting in no solution.

[0073] Branch 2 (Yielding Branch: Oncoming vehicle passes the conflict point first): Requires that the arrival time of the vehicle at the conflict point is no earlier than the sum of the oncoming vehicle's clearing time and the time safety margin, i.e., t. E ≥t O,out +τ = 3.1 + 0.55 = 3.65s (τ is calibrated based on the convergence requirements of the comprehensive envelope expansion margin and the CBF invariant set); simultaneously, constraint C4 requires that the safety margin at the end of the prediction time domain satisfies forward invariance. The inverse solution yields the requirement a for this branch. x ≤ 0.8m / s 2 .

[0074] Within the feasible region of the yield branch, the objective function J varies with a. x Stay away from a raw =+2.0 and monotonically increases, therefore the minimum deviation solution is taken at the boundary of the feasible region: a = 0.8m / s 2 δ =0° (Activated without any constraints on the steering angle direction, δ) Take δ directly raw =0°. Solution result verification: Arrival time: 24 = 8t E 0.4t E ²Get t E =3.68s≥3.65s, when the vehicle passes the conflict point, the other vehicle has already cleared the area, so constraint C3 is satisfied; CBF margin: The time window for the vehicle's envelope to enter the conflict zone is delayed to approximately [3.5s, 4.1s], which does not overlap with the opponent's time window [2.1s, 3.1s], with a time interval of approximately 0.4s. Based on the vehicle's passing speed (v≈5.1m / s), the corresponding spatial interval is approximately 2.0m, h≈+1.8m≥0, and the margin continuously increases with braking, satisfying the condition... ≥ α(h), constraint C4 is satisfied; Regularity: Final vehicle speed v' = 8.0 0.8 × 0.5 = 7.6 m / s, satisfying 0 ≤ v' ≤ 13.9; |a x |=0.8<7.8m / s 2 ; 3.0≤ 0.8 ≤ +2.5, constraints C1 and C2 are satisfied.

[0075] Objective function value J=( 0.8 2.0) 2 +0 = 7.84 (before normalization), correction magnitude Δa = |a a raw |=2.8m / s², Δδ=0.

[0076] When a solution exists within the feasible region: the solution with the smallest action deviation (a) ,δ )=( 0.8m / s 2 (0°) is determined as a safe alternative action and is used as the action to be executed in this decision round, driving the simulated vehicle to execute it; When the feasible domain is empty: output the pre-set safety fallback action as the action to be executed.

[0077] In this embodiment, rule-based detection uses algebraic criteria to quickly reject violations and actions exceeding physical limits, while optimization detection uses dynamic deduction and invariant set theory to accurately determine collision risks. All four detections are non-learning rules with clear criteria and calibrable thresholds, avoiding the uninterpretable problem of black-box safety filters. The constraint objective function aims to minimize action deviation, only adjusting the strategy output at the boundaries required by the safety constraints (in this example, the longitudinal adjustment is 2.8 m / s). 2First, the system shifts to zero correction, minimizing the impact of safety interventions on strategic game behavior. Second, it outputs the optimal safety alternative action when the feasible region has a solution, and outputs an emergency fallback action that satisfies the attachment limit when the feasible region is empty, ensuring that the safety constraint strategy has a definite safety action output under any input, and there is no failure window where no action can be executed. Finally, the detection conclusions are classified into collision risk and compliance comfort categories and are accompanied by a label for the failed detection items, providing a precise and quantifiable feedback signal source for S3 trigger feature vector encoding and S4 graded penalty training.

[0078] Optionally, in a specific embodiment, a second trigger feature vector is constructed based on the action to be executed, candidate game actions, and triggering reasons, such as... Figure 5 As shown, it includes: S3-1. Encode the triggering cause to obtain the corresponding cause component; S3-2. Record the longitudinal acceleration and turning angle of the candidate game action as the original action component, and record the longitudinal acceleration and turning angle of the action to be executed as the modified action component. S3-3. Based on the candidate game action and the action to be executed, calculate the longitudinal acceleration deviation and steering angle deviation between the candidate game action and the action to be executed in order to construct the correction amplitude component; S3-4. Concatenate the cause component, original action component, modified action component, and modified amplitude component in a preset order to form a feature vector of fixed dimensions, which serves as the second trigger feature vector.

[0079] Specifically, in this embodiment, the second trigger feature vector is the information interface between the security constraint policy and the policy network, and its design follows three principles: With a fixed dimension, the output vector dimension remains constant regardless of whether the candidate action is modified. When a detection passes, a zero vector is used to occupy the position, ensuring that the input layer dimension of the policy network does not change with the triggering situation. The information is complete, fully carrying five categories of information: "whether it was intervened, why it was intervened, what the original action was, what was changed, and how much it was modified", enabling the policy network to know both the error type and the error degree from an intervention. Dimensional normalization: After linear normalization, all physical quantities are concatenated to eliminate acceleration (m / s²). 2 The dimensional difference between the angle of rotation (°) and the steering angle (°).

[0080] The second trigger feature vector e is composed of four components concatenated in a preset order, totaling 13 dimensions. The overall structure is as follows: The cause component, whose fields include the trigger flag ft. rig1 (Dimension is 1, its encoding method is binary, no intervention = 0, intervention = 1); Detection item indicator bit (I rule ,I feas ,Ienv ,I cbf (Dimension 4, each of the four detections occupies 1 bit, each encoding method is binary, set to 1 for failure and 0 for success); Reason category bit (C) col C comf (The dimensions are 2, both of which are one-hot encoded, i.e., collision risk category / compliance comfort category).

[0081] Original motion components, (a raw,norm ,δ raw,norm (Dimension 2, encoding method is candidate game action normalized value).

[0082] Correct motion components, (a exec,norm ,δ exec,norm (Dimension is 2, encoding method is the normalized value of the action to be executed).

[0083] Correct the amplitude component, (Δ) anorm ,Δδ norm (The dimension is 2, and the encoding method is the normalized value of the signed action bias).

[0084] The normalized reference is longitudinal acceleration with the road adhesion limit μg≈7.8m / s². 2 As a benchmark (x) norm =x / 7.8, after normalization it falls into [ 1,1]); the steering angle is at the physical limit δ max =30° as the reference (δ) norm =δ / 30).

[0085] The triggering cause is encoded to obtain the cause components (7 dimensions in total): Trigger flag f trig (1 dimension): Set to 1 when the candidate game action in this decision round is modified by the security constraint strategy (including output security fallback action); set to 0 when all four checks pass and the candidate action is executed directly.

[0086] Detection Item Indicator Bits (4-dimensional): Following the four-item detection sequence of the safety constraint strategy, each detection corresponds to a binary indicator bit. A bit is set to 1 for a failed detection and 0 for a successful detection. I rule Traffic rule compliance constraint detection indicator; I feas : Dynamic feasible region constraint detection indicator bit; I env Collision envelope constraint detection indicator; I cbf : Control obstacle function constraint detection indicator bit.

[0087] Cause category bit (2-dimensional, one-hot): Encoded according to the risk nature of the triggering cause, C col =1 indicates a collision risk class (collision envelope detection or CBF constraint detection failed), C comf =1 indicates compliance with comfort category (failed traffic rule compliance test or dynamic feasibility domain test).

[0088] In this example, the collision envelope detection and CBF constraint detection failed, and the triggering reason was collision risk. Therefore, the reason component encoding is as follows: [f trig ,I rule ,I feas ,I env ,I cbf C col C comf ]=[1,0,0,1,1,1,0]; The detection item indicator provides fine-grained location (specifically, which detection item is at fault), while the cause category provides coarse-grained risk classification (directly corresponding to the S4 classification penalty: collision risk category triggers collision penalty P). col = 10. Compliance with comfort category triggers comfort penalty P comf = 2) The two are redundantly encoded and mutually verified.

[0089] Furthermore, the original motion components and the corrected motion components are calculated; Among them, the original action component (2-dimensional): records and normalizes the longitudinal acceleration and turning angle of the candidate game action: a raw,norm =a raw / 7.8=2.0 / 7.8≈0.26; δ raw,norm =δ raw / 30=0 / 30 = 0 Corrected motion components (2D): Record and normalize the longitudinal acceleration and steering angle of the motion to be executed (a safety alternative motion in this example): a exec,norm =a / 7.8= 0.8 / 7.8≈ 0.10; δ exec,norm =δ / 30=0 / 30=0; When the feasible domain is empty and a safety fallback action is output, the action component is corrected to record the safety fallback action (a). fb = 5.5m / s 2 δ fb The normalized value of (=0°) 0.71,0), the collision risk category position is 1 in the cause component.

[0090] Furthermore, obtain the correction magnitude component, that is: Based on candidate game actions and actions to be executed, calculate the longitudinal acceleration deviation and steering angle deviation between them (using signed deviation, with the sign indicating the correction direction): Δa=a exec a raw = 0.8 2.0= 2.8m / s 2 ;Δδ=δ exec δ raw =0 0=0° After normalization: Δa norm =Δa / 7.8= 2.8 / 7.8≈ 0.36; Δδ norm =Δδ / 30=0 The deviation sign has a clear physical meaning: Δa < 0 indicates that the safety constraint strategy corrects the policy network's acceleration intention downward to deceleration (braking and yielding), and Δa > 0 indicates upward correction (such as correcting an overly conservative slow movement to acceleration to escape a predicament); the larger |Δa| is, the stronger the intervention. The correction magnitude component serves as a learnable intervention intensity signal for the policy network, and directly supports the statistical distribution of correction magnitude in the online safety review of claim 9.

[0091] Then, perform fixed-dimensional splicing and time-series replacement: The cause component, the original action component, the modified action component, and the modified magnitude component are concatenated in a preset order to obtain the second trigger feature vector e0 (13-dimensional) for this decision round: e0=[1,0,0,1,1,1,0|0.26,0| 0.10,0| 0.36,0]; (The "|" symbol is only for illustrating component boundaries; in reality, they represent continuous vectors.) When all four checks pass, the candidate game action is directly taken as the action to be executed, the trigger flag is set to 0, all four components are set to zero, and the second trigger feature vector is a 13-dimensional all-zero vector. e t =[0,0,0,0,0,0,0|0,0|0,0|0,0|0,0]; The all-zero vector ensures both a constant input dimension and allows the policy network to explicitly perceive that "the safety constraint policy has not intervened in this decision round".

[0092] After the second trigger feature vector is constructed and replaces the first trigger feature vector, its transition time in the training loop is as follows: t=0 decision round (first decision round): The first trigger feature vector in S1 is the zero vector e. 1=0, concatenated with the first environmental state data and the first opponent's behavioral feature data to form the first enhanced state data, which is then input into the initial strategy model to obtain candidate game actions; S2 fails the detection; S3 constructs the above e0; Decision round t=1: After S1 acquires the second environmental state data and the second opponent's behavioral feature data, e0 is used as the first trigger feature vector for this decision round. It is concatenated with the state features to form the second enhanced state data (i.e., the enhanced state input for step t=1), which is input into the policy network for forward inference. When the policy network generates candidate actions for step t=1, it can obtain "the output of the previous step +2.0m / s" through e0. 2 The acceleration action was modified due to the risk of collision. 0.8m / s 2 brake"; The above process is repeated in each subsequent decision round: the second trigger feature vector constructed in step S3 becomes the first trigger feature vector in the next decision round S1.

[0093] After S4 executes the action to be executed, the transition sample is stored as a quintuple: (first augmented state data, candidate game action, action to be executed, reward value, second augmented state data), where the second augmented state data = [second environment state data; second opponent behavior feature data; e0]. The trigger information thus simultaneously enters two training pathways: one is as input features to the policy network for the next decision round (real-time feedback pathway), and the other is as part of the experience replay samples for parameter update training (replay feedback pathway, with a priority replay mechanism, trigger samples are sampled preferentially).

[0094] This embodiment constructs a 13-dimensional fixed-dimensional second trigger feature vector as a standardized information interface between the safety constraint strategy and the policy network. Through a structured concatenation of cause components, original action components, corrective action components, and correction magnitude components, it simultaneously carries complete information including intervention flags, detection failures, risk categories, original actions, corrective actions, and signed correction magnitudes. Dimensional normalization is applied to acceleration and steering angle to eliminate differences in units of different physical quantities. When no intervention occurs, a zero-based vector is used to ensure the stability of the network input dimension. This feature vector flows in a temporal replacement manner. The second trigger feature vector generated in this step serves as the input feature for the next decision round, enabling real-time feedback of safety intervention information to the policy network and storing trigger information in experience replay samples for training updates. Combined with redundant encoding of fine-grained detection indicator bits and coarse-grained risk category bits, it can directly interface with graded penalties. Simultaneously, the correction magnitude component supports statistical evaluation of the correction magnitude distribution, allowing the policy network to fully perceive the risk types, action deviations, and intervention intensity of historical interventions, efficiently learn safety boundaries, and improve training effectiveness.

[0095] Optionally, in one specific embodiment, S4, as Figure 6 As shown, it includes: S4-1. Drive the simulated vehicle in the simulation environment to perform the action to be performed, so that the simulation environment can perform state transition based on the simulated vehicle performing the action to be performed, and obtain the corresponding reward value, as well as the second environment state data and the second opponent behavior feature data after performing the action to be performed. S4-2. The first environmental state data, the first opponent behavior feature data and the first trigger feature vector are concatenated to form the first enhanced state data, and the second environmental state data, the second opponent behavior feature data and the second trigger feature vector are concatenated to form the second enhanced state data. S4-3: Use the second environment state data as the first environment state data, use the second opponent's behavior feature data as the first opponent's behavior feature data, return to S1, and repeat until the preset number of times. S4-4. Based on the reward value corresponding to each decision step within a preset number of iterations, the first augmented state data and the second augmented state data, and the pre-set reinforcement learning algorithm, perform parameter update training on the initial policy model to update the policy network parameters of the initial policy model.

[0096] Furthermore, S4-4 includes: Based on a pre-set discount factor, the reward value corresponding to each decision step within a preset number of times is discounted and accumulated to obtain the cumulative return for each decision step. Input the first enhanced state data and the second enhanced state data of each decision step within a preset number of times into a pre-set value network to obtain the first state value corresponding to the first enhanced state data and the second state value corresponding to the second enhanced state data in each decision step. Based on the discount factor, and the reward value, first state value and second state value corresponding to each decision step, the advantage function and temporal difference error corresponding to each decision step are constructed, and the value network loss is calculated based on the temporal difference error corresponding to each decision step. The advantage function is used to characterize the superiority or inferiority of the corresponding candidate game action, and the temporal difference error is used to characterize the degree of deviation between the estimated state value of the value network and the actual return. The first augmented state data corresponding to each decision step is re-input into the initial policy model to construct the action output distribution corresponding to each decision step, and the policy network loss is calculated based on the action output distribution and advantage function corresponding to each decision step. The network parameters of the value network are updated using gradients based on the value network loss, and the policy network parameters of the initial policy model are updated using gradients based on the policy network loss.

[0097] Furthermore, based on the discount factor, and the reward value, first state value, and second state value corresponding to each decision step, an advantage function and temporal difference error are constructed for each decision step. The value network loss is then calculated based on the temporal difference error for each decision step, including: Based on the reward value, discount factor, and second state value corresponding to each decision step, a temporal difference objective is constructed for each decision step; wherein, the temporal difference objective for any decision step is the sum of the product of the discount factor and the second state value corresponding to that decision step and the reward value of that decision step. Based on the temporal difference objective and the first state value corresponding to each decision step, a temporal difference error corresponding to each decision step is constructed; wherein, the temporal difference error of any decision step is the difference between the temporal difference objective and the first state value corresponding to that decision step. Based on the cumulative reward and the first state value corresponding to each decision step, an advantage function is constructed for each decision step; wherein, the advantage function for any decision step is the difference between the cumulative reward and the first state value corresponding to that decision step. A value network loss is constructed based on the temporal difference errors corresponding to all decision steps within a preset number of iterations; wherein, the value network loss is the ratio of the sum of squares of the temporal difference errors corresponding to each decision step within the preset number of iterations to the preset number of iterations.

[0098] It should be noted that in this embodiment, the complete execution of S1-S3 and S4-1, S4-2 corresponds to one decision step (decision step length Δt = 0.5s, i.e., a decision frequency of 2Hz); S4-3 controls the decision step loop, continuously executing a preset number of decision steps M (in this embodiment, M = 60, corresponding to the trajectory collection length of one training round), collecting M quintuple transition samples; S4-4 performs a batch parameter update training based on the entire batch of samples. S5 repeats S1~S4 to complete multiple rounds of "trajectory collection and batch update" until the reinforcement training termination condition is met. In this embodiment, l is the decision step number within the preset number of times (l = 0, 1, ..., M). 1).

[0099] Specifically, in each decision step, the simulated vehicle in the driving simulation environment executes the action to be executed in that decision step. The simulation environment performs state transitions based on the action to be executed, and obtains the corresponding reward value, as well as the second environmental state data and the second opponent behavior feature data after executing the action to be executed.

[0100] Taking the 0th decision step within a preset number of attempts as an example, the action to be executed is u. exec =(a ,δ )=( 0.8m / s 2 The simulation environment performs state transitions with a decision step size of Δt = 0.5s (0°). Final vehicle speed: v1 = v0 + a ·Δt=8.0+( 0.8) × 0.5 = 7.6 m / s; Distance traveled by the vehicle along the path: Δd = v0·Δt + (1 / 2)·a ·Δt 2 =8.0×0.5+0.5×( 0.8) × 0.25 = 3.9m, the distance from the vehicle to the conflict point is updated to d E,1 =24 3.9 = 20.1m; According to the prediction model (predicted acceleration a) of the vehicle O O =+1.5m / s 2 Motion: Δs O =6.0×0.5+(1 / 2)×1.5×0.25≈3.2m, d O,1 =18 3.2 = 14.8m.

[0101] The simulation environment outputs the corresponding reward value based on the state transition results after the execution of the action to be executed, as well as the second environmental state data (road environment, vehicle motion state) and the second opponent's behavioral feature data (opponent vehicle position, speed, heading angle, historical trajectory and updated predicted trajectory) after the execution of the action to be executed.

[0102] The reward value is generated by the simulation environment based on the state transition results after the action to be executed. In this embodiment, a reward function that superimposes task progress rewards and safety level penalties is used. r l =r task +r safe , where r task =k d ·Δd(k d =0.1 / m, +0.1 for every 1m advanced along the target path), r safe = w3·(I col ·P col +I comf ·P comf ); Among them, I col This is a collision risk indicator; it takes the value 1 if an actual collision occurs in this decision round, or if the triggering cause is a collision risk type. comf For compliance and comfort category indicators, the triggering reason is 1 when it is compliance and comfort category, P. col The baseline value for collision risk classification penalties (including round-ending penalties for actual collisions, which can be set to 10), P comf The baseline value for compliance and comfort-based grading penalties (can be set to 2), w3 is the intervention rate shaping weight, w3=1+5η, η is the intervention rate of the safety constraint strategy in this round, f trig This is the trigger flag (from the cause component of the trigger feature vector).

[0103] In this embodiment, the design intent of the tiered penalty is to classify penalties according to the triggering cause rather than applying a one-size-fits-all approach, and to directly apply a large penalty P to candidate actions of collision risk type. col =10 (equivalent to negatively reinforcing "actions that would otherwise cause a collision" during the action generation phase), applying a small penalty P to the compliant and comfortable category. comf =2; The intervention rate shaping weight w3 adaptively decays as the training process progresses (high intervention rate and strong penalty weight in the early stage of training, forcing the strategy to quickly move away from dangerous actions; low intervention rate and weight drop back to 1 in the later stage), avoiding the long-term dominance of penalty signals that leads to an overly conservative strategy.

[0104] This example is in the first training round, with an intervention rate η = 0.30 (18 interventions out of 60 decision steps, including 14 collision risk interventions and 4 compliance / comfort interventions), therefore w3 = 1 + 5 × 0.30 = 2.5; decision step l = 0 col =1、I comf =0, Δd=3.9m: r0 = 0.1 × 3.9 2.5 × (1 × 10 + 0 × 2) = +0.4 25.0= 24.6; If an actual collision occurs (a safety fallback action is still unavoidable and rarely occurs in simulation), an additional round termination flag is added, and the timing difference target for that step will no longer bootstrap.

[0105] In each decision step, the first environmental state data, the first opponent behavior feature data, and the first trigger feature vector of that decision step are concatenated to form the first enhanced state data: s l =[First environmental state data; First opponent behavior characteristic data; First trigger feature vector]; In this context, the first trigger feature vector of the first decision step (l=0) in the first training round is the zero vector e, which has a value of zero. 1=0, therefore s0=[first environmental state data; first opponent behavior characteristic data; 0].

[0106] The second environmental state data and the second opponent behavior feature data obtained after executing the action to be executed are combined with the second trigger feature vector e constructed in decision step S3. l The data is then stitched together to form the second enhanced state data: s l+1 =[Second environmental state data; Second opponent behavior characteristic data; Second trigger feature vector] In this example, the l=0th decision step is: s1=[second environmental state data; second opponent behavior characteristic data; e0].

[0107] In terms of temporal relationship, the second triggering feature vector e l Describe why the candidate game action in the l-th decision step is modified, and what the original action and the modified action are respectively. It is input into s. l+1 This allows the policy network to know, when generating candidate game actions at the (l+1)th decision step, that the candidate action at the lth decision step has been modified due to collision risk, +2.0m / s 2 Revised to 0.8m / s 2 All intervention information.

[0108] After S4-2 is completed, the second environmental state data will be used as the first environmental state data for the next decision step, and the second opponent behavior feature data will be used as the first opponent behavior feature data for the next decision step (at the same time, the second trigger feature vector e constructed in this decision step S3 will also be used). l (That is, as the first trigger feature vector for the next decision step), return to S1 and start the next decision step; repeat this process until the preset number of times M is reached.

[0109] During the loop, a 5-tuple transition sample is stored at each decision step: (s l ,u raw,l ,u exec,l ,r l ,s l+1 = (First augmented state data, candidate game actions, actions to be executed, reward value, second augmented state data). Candidate game actions u are retained in the sample at the same time raw,l (Actual output of the policy network, used for policy network loss calculation) and the action to be executed u exec,l (The actual execution of the environment, used for state transition and reward value generation) The separation of the two is the data structure manifestation of the modeling approach of "treating the security constraint policy as part of the simulation environment".

[0110] In this embodiment, the preset number of iterations M=60, meaning that 5-tuple samples (corresponding to the trajectory of one training round) are collected continuously for 60 decision steps. If a termination state occurs during the collection process (collision or target arrival), the second augmentation state data of that decision step is marked as a termination state, the temporal difference target no longer bootstraps, the simulation environment is reset, and collection continues until M samples are collected. After the trajectory collection is completed, step S4-4 is performed, and a batch parameter update training is conducted based on the M 5-tuple samples.

[0111] Based on the reward value for each decision step within a preset number of iterations, the first augmented state data, the second augmented state data, and a pre-set reinforcement learning algorithm, the initial policy model is trained with updated parameters. In this embodiment, the reinforcement learning algorithm uses the PPO (Proximal Policy Optimization) algorithm (discount factor γ=0.99, GAE parameter λ=0.95, pruning coefficient ε=0.2, learning rate lr=3×10⁻⁶). -4 The overall process is as follows: The cumulative reward G for each decision step is obtained by discounting and accumulating the reward values ​​of the M decision steps along the decision step sequence using a discount factor. l ; The first augmented state data s of M decision steps l Second enhanced state data s l+1 Input the values ​​into the value network to obtain the first state value V(s) for each decision step. l) and the second state value V(s) l+1 ); Based on the discount factor, and the reward value, first state value, and second state value at each decision step, construct the advantage function A for each decision step. l and timing difference error δ l And calculate the value network loss based on all temporal difference errors; The first augmented state data of each decision step is re-input into the initial policy model to construct the action output distribution corresponding to the candidate game action of each decision step. The policy network loss is calculated based on the action output distribution and the advantage function. The value network parameters are updated using gradients based on the value network loss, and the policy network parameters of the initial policy model are updated using gradients based on the policy network loss.

[0112] Based on a pre-set discount factor γ, the reward value corresponding to each decision step within a preset number of decisions is discounted and accumulated along the decision step sequence to obtain the cumulative reward for each decision step: ; Among them, G l This represents the cumulative reward corresponding to the l-th decision step. Starting from this step, it represents the sum of all reward values ​​weighted by a discount factor, moving forward through the decision step sequence. l is the decision step index, k is the forward offset relative to the current step (k=0 for the current step, k=1 for the next decision step, k=2 for the next step after that, and so on), and M is the preset number of iterations. r is the discount factor. l+k Let γ be the reward value corresponding to the (l+k)th decision step. That is, the cumulative reward of the lth decision step is the discounted weighted sum of the reward values ​​of the decision step and its subsequent decision steps, where γ=0.99 indicates that the weight of reward values ​​in more distant periods is lower; there are no reward values ​​after the terminating decision step, so the summation is naturally truncated.

[0113] The value network is a scalar regression network trained in parallel with the policy network (structure: MLP(256-256), input dimension is consistent with the augmented state input of the policy network, output is a single scalar state value). The first and second augmented state data for each decision step within a preset number of iterations are input into the value network respectively. First enhanced state data s l Input the value network to obtain the first state value V(s) l The value network's estimate of the "future cumulative return of this state"; Second enhanced state data s l+1 Input the value network to obtain the second state value V(s) l+1 ), used for bootstrapping of time-difference objectives.

[0114] This example takes the decision step l=0 as an example (the value network estimation is pessimistic in the early stage of training), and the value network outputs V(s0)=-20.0 and V(s1)=-18.0.

[0115] The value network is only used for advantage estimation and error calculation during the training period and is not part of the initial policy model. After training is completed and the policy model is obtained, the value network is discarded during deployment inference and does not participate in online decision-making.

[0116] The temporal difference objective is constructed based on the reward value, discount factor, and second state value corresponding to each decision step: the temporal difference objective for any decision step is the sum of the product of the discount factor and the second state value corresponding to that decision step, and the reward value for that decision step. y l =r l +γ·V(s l+1 ); When the second augmented state data s of this decision step l+1 When the state is terminated, the temporal difference objective is the reward value of that decision step: y l =r l They no longer lift themselves up.

[0117] In this example, step l=0: y0= 24.6 + 0.99 × ( 18.0)= 24.6 17.82= 42.42.

[0118] The temporal difference error is constructed based on the temporal difference objective and the first state value at each decision step: the temporal difference error at any decision step is the difference between the temporal difference objective and the first state value at that decision step. δ l =y l V(s l ); Temporal difference error is used to characterize the degree of deviation between the estimated state value of a value network and the actual return: δ l <0 indicates that the value network overestimated the state (the actual result was worse than expected), δ l >0 indicates an underestimation.

[0119] For example: δ0= 42.42 ( 20.0)= 22.42 (a large negative error, indicating that the value network has not yet realized that "generating aggressive acceleration candidate game actions in this state will incur severe penalties").

[0120] Value network loss is constructed based on the temporal difference error of all decision steps within a preset number of iterations: Value Network Loss L V This is the ratio of the sum of squares of the timing difference errors at each decision step within a preset number of iterations to the preset number of iterations: ; Mean square error of time series difference error (single-step squared term) =( 22.42) 2 ≈502.7, Batch loss L V (This is the average of the squared terms over M=60 steps). The squared terms prevent positive and negative biases from canceling each other out and amplify the contribution of samples with large biases, and are smooth and differentiable. The value network parameter φ along... φ L V After the direction is updated, the value estimates of each state converge toward the temporal difference objective.

[0121] The advantage function is constructed based on the cumulative reward and the first-state value at each decision step: the advantage function at any decision step is the difference between the cumulative reward and the first-state value at that decision step. A l =G l V(s l ); The advantage function is used to characterize the superiority or inferiority of corresponding candidate game actions: A l >0 indicates that the candidate game action is better than average and its generation probability should be increased; A l <0 indicates below-average and should be suppressed. To reduce the variance of single-step returns, this embodiment uses generalized advantage estimation (GAE): λ=0.95; Where A1 is the generalized advantage estimate for the l-th decision step, and λ is the GAE trace-decay parameter. In this embodiment, λ = 0.95, with a value of [0, 1]. The temporal difference error of the (l+k)th decision step.

[0122] In a simplified single-step illustration, A0≈δ0= 22.4, significantly negative, indicates that the candidate game action (intended to "probe ahead") is paired with a. raw =+2.0m / s 2 Aggressive acceleration is a bad move in this state.

[0123] The first enhanced state data s for each decision step within a preset number of iterations. lRe-input the initial policy model (policy network) and perform forward inference to construct the action output distribution corresponding to the candidate game actions at each decision step: the discrete intention head outputs the probability distribution of three types of game intentions via softmax (in this example, step l=0: tentative forward movement 0.62 / decelerate to give way 0.28 / accelerate to pass 0.10), and the continuous control head outputs the Gaussian distribution of longitudinal acceleration and steering angle (in this step μ). a =+2.0); the total log probability of candidate game actions is the sum of the log probability of the game intention and the log probability of the control quantity.

[0124] Based on the PPO algorithm, the policy network loss is the average of the pruning targets at each decision step within the batch: ; in, For policy network loss, Current policy network parameters, For probability ratio (importance sampling ratio), A l Let be the advantage function in step l, and be the PPO cutoff coefficient. It is generally set to 0.2, and clip(·) is the cutoff function, which limits the probability ratio to the range of [0.8, 1.2] to prevent the single update from being too large.

[0125] ; in, For the current policy, first enhanced state data s l Output candidate game action u raw,l The probability, The old strategy (the parameter θ used before the update when collecting this batch of trajectories) old The probability given for the same action This calculation exampleA0= 22.4 represents a strong negative advantage. The gradient update direction is to reduce the probability of generating "probing forward with large acceleration" action output distributions under similar enhanced state data, and increase the probability of generating early deceleration and yielding actions. As a result, the policy network gradually learns to avoid actions that will be intercepted by the safety constraint policy during the candidate game action generation stage, rather than relying on the passive fallback of the action output end.

[0126] After a batch of M decision-step samples completes gradient updates, the next round S1-S4 begins: M decision-step trajectories are collected again and updated in batches once more. The value network is discarded upon deployment after training is complete; the policy network parameters θ, after multiple rounds of updates, become the trained reinforcement policy model.

[0127] Priority Experience Replay (PER): The quintuple samples collected in S4-3 are stored in the experience replay pool for updating sampling in S4-4 and subsequent epochs; the sample sampling priority is set according to the temporal difference error and the trigger flag. p l =|δ l |+0.3·f trig ; In this example, for sample l=0, p0=22.42+0.3×1=22.7. The trigger sample has both "large temporal difference error (inaccurate prediction of value network)" and "trigger flag bonus" as high priority, and the actual sampling probability is about 4 times that of ordinary samples, which significantly improves the learning efficiency of the policy network for the safety boundary.

[0128] Intervention rate shaping and convergence curve, intervention rate η = the proportion of intervention times of the safety constraint strategy within the unit number of decision times, statistically calculated according to the training rounds and used for intervention rate shaping weight w3 = 1 + 5η; Training ends when the conditions for ending the reinforcement training are met (η≤0.05 and the collision risk trigger is cleared, and the system remains stable for several training rounds), and the strategy model is obtained. The intervention rate η, the correction magnitude distribution, and the trigger cause distribution are used as statistical inputs for the online safety review.

[0129] This embodiment enhances the policy network by concatenating the safety shield trigger feature vector to the next time step's state input, enabling the policy network to directly perceive the intervention information of the safety constraints from the previous decision step. It employs a task progress reward superimposed with tiered safety penalties, combined with adaptively shaping weights based on the safety shield intervention rate. In the early stages of training, it strengthens the negative suppression of dangerous actions, while in the later stages, it avoids overly conservative policies. It utilizes GAE generalized advantage estimation and PPO. Clip enables batch iterative updates of the strategy and value network, while introducing priority experience replay based on temporal difference error and trigger flags to improve the sampling probability of safety boundary samples and accelerate policy learning. Training uses the safety shield intervention rate and the proportion of collision risk triggers as convergence termination conditions. After training, the policy can natively avoid dangerous game actions that are easily intercepted by safety constraints, reduce the high frequency of safety shield intervention, and provide quantifiable statistical basis for subsequent online safety reviews, balancing autonomous driving game-playing capabilities and training safety.

[0130] Optionally, in one specific embodiment, after step S5, the method further includes: S6. Statistically analyze the correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions during the reinforcement training process, and conduct an online security review of the strategy model based on the correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions.

[0131] Specifically, the review is conducted on a test scenario set independent of the training scenario set (in this embodiment, N=2000 decision steps are extracted, covering scenario types such as no-signal intersection game, adjacent lane cutting in, sudden braking while following another vehicle, pedestrian interference, and speeding). The strategy model runs in a deployed form, and the safety constraint strategy remains online (the review statistics are precisely its intervention status), while the value network does not participate.

[0132] The 13-dimensional trigger feature vector e for each decision step l All were recorded, and the three statistics were directly based on the trigger flag f of this vector. trig The calculation of the cause component one-hot bit and the correction magnitude component does not require additional manual annotation. Correction rate: The proportion of candidate game actions that are corrected (substituted or covered) by the safety constraint strategy, i.e., the intervention rate. : ; in, To trigger the decision step at flag position 1, This is the trigger flag for the l-th decision step. Note that this is the same statistic η used in training to shape the weights w3=1+5η, where η is used to adaptively adjust the penalty intensity during training and to quantify the policy's dependence on the safety shield during review.

[0133] The amplitude distribution is corrected for the amplitude component Δa of the trigger sample. l (Longitudinal acceleration deviation, normalized baseline 7.8 m / s²) 2 ) and Δδ l (Steering angle deviation, baseline 30°) After inverse normalization, statistical histograms are generated by binning the amplitude range, and the mean is calculated: ; in, To calculate the average correction magnitude (longitudinal acceleration), for all decision steps that trigger corrections, the absolute value of the longitudinal acceleration deviation for each correction is taken and averaged. This represents the longitudinal acceleration deviation in step l.

[0134] The larger the magnitude, the further the original output of the strategy model is from the safe and feasible region.

[0135] Trigger cause distribution: one-hot bits by cause component category (collision risk class C) col Compliance and comfort category C comf The percentage of each category is calculated for the sub-scenarios corresponding to the detection item indicator positions (cutting in, intersection conflicts, sudden braking while following another vehicle, etc.). p c =N c / N trig N c=∑ l 1. [The triggering reason for step l is category c]; An unusually high proportion in a specific scenario indicates that the strategy has a capability deficiency in that scenario, rather than a global security issue.

[0136] This embodiment sets the following thresholds (the specific values ​​are examples and can be adjusted according to the security level of the deployment scenario): Correction rate threshold: η eval ≤0.05, meaning that over 95% of the decisions made by the strategy model do not require the intervention of the security shield; Single-cause red line: The trigger rate of any sub-scenario in the collision risk category is ≤20%, to prevent the strategy from having systemic capability gaps in specific scenarios; Correction range threshold: ≤1.0m / s 2 This ensures that interventions are primarily minor adjustments rather than emergency rescues; The actual number of collisions is zero: the number of actual collisions that could not be avoided even with the safety measures is 0.

[0137] This embodiment transforms the security of a strategy from a subjective judgment into three quantifiable indicators and clear thresholds: the correction rate answers how frequently the strategy is supported, the amplitude distribution answers how much the cost of correction is, and the cause distribution answers where the shortcomings are. Furthermore, when a strategy fails, the cause distribution directly indicates the weak scenario (in this example, it is an additional intervention), supporting targeted supplementary training rather than blindly adding more training. The supplementary training is highly targeted and requires fewer rounds (approximately 30 rounds are sufficient to meet the target). Moreover, all three statistics reuse the 13-dimensional trigger feature vectors already recorded in the training link, without introducing additional annotations or sensing devices.

[0138] Secondly, embodiments of this application provide a security feedback-driven reinforcement learning system, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the aforementioned security feedback-driven reinforcement learning method.

[0139] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0140] In the description of this specification, the terms "one embodiment," "some embodiments," "embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0141] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make modifications, alterations, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A reinforcement learning method based on security feedback, characterized in that, include: Real-time acquired environmental state data and actual opponent vehicle behavior characteristic data are input into a pre-trained reinforcement strategy model to obtain actual game actions to guide the vehicle's autonomous driving; the reinforcement strategy model is trained through the following steps: S1. Obtain the first environmental state data and the first opponent's behavioral feature data of the simulated vehicle in the simulation environment. Input the first environmental state data and the first opponent's behavioral feature data into the pre-trained initial strategy model to obtain the candidate game action corresponding to the simulated vehicle based on the first environmental state data, the first opponent's behavioral feature data, and the first trigger feature vector deployed by the model. S2. Based on the pre-set security constraint strategy, perform security checks on candidate game actions. When a candidate game action fails the security check, construct the triggering reason for the failure. Based on the pre-set constraint objective function, modify the candidate game action to obtain the corresponding safe alternative action as the action to be executed. The objective function is used to minimize the action deviation between the safe alternative action and the candidate game action as the optimization objective, and to solve for the safe alternative action within the feasible domain defined by the security constraint strategy. S3. Based on the action to be executed, candidate game actions, and triggering reasons, construct a second triggering feature vector to replace the first triggering feature vector; S4. Drive the simulated vehicle in the simulation environment to perform the action to be performed in order to obtain the corresponding reward value, and update and train the initial policy model based on the action to be performed and the corresponding reward value. S5. Randomly reset the first environmental state data and the first opponent behavior feature data of the simulated vehicle in the simulation environment, and repeat steps S1-S5 until the pre-set reinforcement training termination condition is met to obtain the reinforcement strategy model that has been trained.

2. The reinforcement learning method based on security feedback as described in claim 1, characterized in that, The constraints corresponding to the safety constraint strategy include traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints. Based on pre-set security constraint strategies, security checks are performed on candidate game actions. When a candidate game action fails the security check, a triggering reason for the failure is constructed, including: S2-1. Based on a pre-set safety constraint strategy, candidate game actions are sequentially tested for traffic rule compliance constraints, dynamic feasible region constraints, collision envelope constraints, and control obstacle function constraints to determine whether the safety test of the candidate game action passes. Specifically, the traffic rule compliance test determines whether the candidate game action violates traffic rules; the dynamic feasible region test determines whether the candidate game action is within the vehicle's dynamic feasible region; the collision envelope test determines whether the candidate game action will cause the simulated vehicle to collide with surrounding objects; and the control obstacle function constraint test determines whether the candidate game action violates pre-set safety invariant set constraints. S2-2. When it is determined that the security detection of the candidate game action fails, the reasons corresponding to the failed detection items are constructed as the triggering reasons. When the safety detection of a candidate game action is passed, the triggering reason is a zero vector.

3. The reinforcement learning method based on security feedback as described in claim 2, characterized in that, Both the candidate game action and the safe alternative action include longitudinal acceleration and steering angle; Based on a pre-set constraint objective function, candidate game actions are modified to obtain corresponding safe alternative actions, which are then used as actions to be executed, including: S2-3. Using the longitudinal acceleration and steering angle of the safety substitution action as decision variables, and minimizing the action deviation between the safety substitution action and the candidate game action as the optimization objective, construct the constraint objective function; S2-4. Using all the constraints corresponding to the security constraint strategy as the constraints of the constraint objective function, and performing constraint optimization to solve the constraint objective function within the feasible domain defined by the constraints of the constraint objective function; S2-5. When a solution exists within the feasible domain, the longitudinal acceleration and steering angle with the smallest action deviation are determined as the safe alternative action and used as the action to be executed. When the feasible domain is empty, a pre-set safety fallback action is output as the action to be executed.

4. The reinforcement learning method based on security feedback as described in claim 3, characterized in that, Based on the action to be executed, candidate game actions, and triggering reasons, a second triggering feature vector is constructed, including: S3-1. Encode the triggering cause to obtain the corresponding cause component; S3-2. Record the longitudinal acceleration and turning angle of the candidate game action as the original action component, and record the longitudinal acceleration and turning angle of the action to be executed as the modified action component. S3-3. Based on the candidate game action and the action to be executed, calculate the longitudinal acceleration deviation and steering angle deviation between the candidate game action and the action to be executed, so as to construct the correction amplitude component; S3-4. The cause component, the original action component, the modified action component, and the modified amplitude component are concatenated in a preset order to form a feature vector of fixed dimensions, which is used as the second trigger feature vector.

5. The reinforcement learning method based on security feedback as described in claim 1, characterized in that, S1 includes: S1-1. Obtain road environment data and vehicle motion state data in the simulation environment to construct the first environment state data; S1-2. Obtain the position, speed, heading angle and historical driving trajectory of each opposing vehicle within a preset range around the simulated vehicle in the simulation environment. Based on the position, speed, heading angle and historical driving trajectory of each opposing vehicle, as well as the pre-set trajectory prediction algorithm, obtain the predicted trajectory of each opposing vehicle in the prediction time domain. Construct the first opposing vehicle behavior feature data based on the position, speed, heading angle, historical driving trajectory and predicted trajectory of each opposing vehicle. S1-3. Encode the first environmental state data and the first opponent behavior feature data to obtain the corresponding state features, and concatenate the state features with the first trigger feature vector to construct enhanced state input features; wherein, the first trigger feature vector is the second trigger feature vector constructed in the previous decision round, and the first trigger feature vector in the first decision round is a zero vector with a value of zero. S1-4. Input the enhanced state input features into the initial policy model for forward reasoning to obtain candidate game actions corresponding to the simulated vehicle.

6. The reinforcement learning method based on security feedback as described in claim 1, characterized in that, S4 includes: S4-1. Drive the simulated vehicle in the simulation environment to execute the action to be executed, so that the simulation environment performs a state transition based on the simulated vehicle executing the action to be executed, and obtains the corresponding reward value, as well as the second environment state data and the second opponent behavior feature data after executing the action to be executed. S4-2. The first environmental state data, the first opponent behavior feature data and the first trigger feature vector are concatenated to form the first enhanced state data, and the second environmental state data, the second opponent behavior feature data and the second trigger feature vector are concatenated to form the second enhanced state data. S4-3. Use the second environment state data as the first environment state data, use the second opponent behavior feature data as the first opponent behavior feature data, return to S1, and repeat until the preset number of times. S4-4. Based on the reward value corresponding to each decision step within a preset number of times, the first augmented state data and the second augmented state data, and the pre-set reinforcement learning algorithm, perform parameter update training on the initial policy model to update the policy network parameters of the initial policy model.

7. The reinforcement learning method based on security feedback as described in claim 6, characterized in that, S4-4 includes: Based on a pre-set discount factor, the reward value corresponding to each decision step within a preset number of times is discounted and accumulated to obtain the cumulative return for each decision step. Input the first enhanced state data and the second enhanced state data of each decision step within a preset number of times into a pre-set value network to obtain the first state value corresponding to the first enhanced state data and the second state value corresponding to the second enhanced state data in each decision step. Based on the discount factor, and the reward value, first state value and second state value corresponding to each decision step, an advantage function and temporal difference error corresponding to each decision step are constructed, and the value network loss is calculated based on the temporal difference error corresponding to each decision step; the advantage function is used to characterize the superiority or inferiority of the corresponding candidate game action, and the temporal difference error is used to characterize the degree of deviation between the estimated state value of the value network and the actual return. The first augmented state data corresponding to each decision step is re-input into the initial policy model to construct the action output distribution corresponding to each decision step, and the policy network loss is calculated based on the action output distribution and advantage function corresponding to each decision step. The network parameters of the value network are updated using gradients based on the value network loss, and the policy network parameters of the initial policy model are updated using gradients based on the policy network loss.

8. The reinforcement learning method based on security feedback as described in claim 7, characterized in that, Based on the discount factor, and the reward value, first state value, and second state value corresponding to each decision step, an advantage function and temporal difference error corresponding to each decision step are constructed, and the value network loss is calculated based on the temporal difference error corresponding to each decision step, including: Based on the reward value, discount factor, and second state value corresponding to each decision step, a temporal difference objective is constructed for each decision step; wherein, the temporal difference objective for any decision step is the sum of the product of the discount factor and the second state value corresponding to that decision step and the reward value of that decision step. Based on the temporal difference objective and the first state value corresponding to each decision step, a temporal difference error corresponding to each decision step is constructed; wherein, the temporal difference error of any decision step is the difference between the temporal difference objective and the first state value corresponding to that decision step. Based on the cumulative reward and the first state value corresponding to each decision step, an advantage function is constructed for each decision step; wherein, the advantage function for any decision step is the difference between the cumulative reward and the first state value corresponding to that decision step. A value network loss is constructed based on the temporal difference errors corresponding to all decision steps within a preset number of iterations; wherein the value network loss is the ratio of the sum of squares of the temporal difference errors corresponding to each decision step within the preset number of iterations to the preset number of iterations.

9. The reinforcement learning method based on security feedback as described in claim 1, characterized in that, The method further includes: The correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions during the reinforcement training process are statistically analyzed. Based on the correction rate, correction magnitude distribution, and trigger cause distribution of all candidate game actions, the online security review of the strategy model is conducted.

10. A reinforcement learning system based on security feedback, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the security feedback-driven reinforcement learning method according to any one of claims 1-9.