Sampling-based Safe Reinforcement Learning for Nonlinear Dynamical Systems

Wesley A. Suttle, Vipul K. Sharma, Krishna Chaitanya Kosaraju, S. Sivaranjani, Ji Liu, Vijay Gupta, Brian M. Sadler · DOI

TL;DR

This paper introduces a novel single-stage, sampling-based reinforcement learning (RL) approach that guarantees both safety and convergence for controlling complex, nonlinear dynamical systems. Unlike existing methods that often sacrifice convergence for safety, this new algorithm learns controllers that satisfy hard safety constraints throughout training and deployment while still achieving optimal performance.

What Problem Does This Paper Address?

Reinforcement learning (RL) has shown immense promise in learning optimal control policies for systems with unknown dynamics. However, applying RL to real-world physical systems, especially those where safety is paramount (like robotics or autonomous vehicles), is challenging. Traditional RL algorithms can produce unsafe actions during training or deployment, leading to potential damage or accidents. Existing "safe RL" methods often employ a two-stage approach: first, an RL agent learns a potentially unsafe policy, and then a "safety filter" (often based on control barrier functions or CBFs) projects the actions onto a safe set. While this ensures safety, it often breaks the convergence guarantees of the underlying RL algorithm, leading to suboptimal performance. The core problem this paper addresses is the fundamental gap between the hard safety guarantees from control theory and the convergence guarantees from RL theory, aiming to achieve both simultaneously.

Methods

The authors propose a single-stage, sampling-based approach for safe RL in nonlinear dynamical systems. The key innovation lies in modifying standard policy gradient methods to directly sample from a state-dependent safe action set. This set is defined by a safety constraint, such as those provided by Control Barrier Functions (CBFs).

Here's a breakdown of their approach:

  • Truncated Policies: Instead of learning a policy that outputs actions directly, they learn a policy $\pi_\theta$ that is then "truncated" to only consider actions within the safe set $C(x)$ for a given state $x$. This truncated policy, denoted $\pi_f$, ensures that any sampled action is inherently safe.
  • Sampling from Safe Sets: The algorithm directly samples actions from this truncated policy. For practical implementation, they leverage techniques like rejection sampling or, for specific policy types (like Beta policies), more efficient sampling methods.
  • Theoretical Guarantees: The paper provides theoretical guarantees that this sampling-based approach maintains convergence properties of standard policy gradient methods while ensuring hard safety constraints are met. This is achieved by carefully analyzing the properties of the truncated policies and their induced Markov chains.
  • CBF-Constrained Beta Policies: As a practical instantiation, they extend Beta policies (which have finite support) to handle state-dependent CBF constraints. This allows them to directly sample from the safe action set defined by CBFs, which is particularly useful for problems with complex, dynamic safety regions.

Datasets

The paper does not introduce new datasets. Instead, it uses established simulation environments for evaluation:

  • Inverted Pendulum: A standard benchmark for control problems, modified to include safety constraints.
  • Quadcopter Navigation: A more complex environment involving obstacle avoidance, also adapted with safety constraints.

The authors highlight that their method is validated on these challenging scenarios, demonstrating its practical utility.

Key Insights and Ideas

  • Bridging the Theory Gap: The most significant insight is the successful integration of hard safety guarantees (from control theory) with convergence guarantees (from RL theory) into a single, unified framework. This is a long-standing challenge in safe RL.
  • Single-Stage Safety: By directly sampling from safe action sets, the method avoids the performance degradation often associated with post-hoc safety filters. This "single-stage" approach is crucial for achieving both safety and optimality.
  • Provable Convergence with Safety: The theoretical analysis demonstrates that their sampling-based approach not only guarantees safety but also recovers the convergence properties of standard policy gradient methods, leading to better-performing policies.
  • Flexibility of CBFs: The work highlights the power of Control Barrier Functions (CBFs) in defining dynamic safe action sets, which can then be directly leveraged by their sampling-based RL algorithm.

Key Results

The paper demonstrates the efficacy of their approach through simulations:

  • Quadcopter Navigation: Their CBF-constrained Beta policy successfully navigated a quadcopter around an obstacle to a goal, maintaining safety throughout. In contrast, a benchmark safety-filtered Gaussian policy failed to reach the goal when the obstacle was directly in its path, despite maintaining safety.
  • Inverted Pendulum: The CBF-constrained Beta policies showed faster learning and better performance compared to unconstrained Gaussian policies, especially in environments with strict safety bounds. The safety rate (percentage of time spent in the safe set) was consistently high for their method, while unconstrained policies failed to maintain safety.
  • Theoretical Guarantees: The paper provides theoretical proofs for the well-definedness of the objective function and the asymptotic convergence of their proposed Safe-RPG algorithm to stationary points.

Limitations and Future Work

  • Constraint Set Knowledge: The current formulation assumes that the safe control set $C(x)$ (derived from CBFs or similar) is known. A significant limitation is that learning or approximating $C(x)$ while maintaining safety and convergence guarantees is left as future work.
  • Computational Cost: While not explicitly detailed as a limitation, the sampling-based nature of the approach might introduce computational overhead, especially if the safe set is complex or difficult to sample from efficiently.
  • Generalization to Stochastic Dynamics: While the paper mentions that theoretical results extend to stochastic dynamics under ergodicity assumptions, the experimental validation focuses on deterministic systems.
  • Finite-Time Convergence: The current theoretical results guarantee asymptotic convergence. The authors suggest that strengthening these results to prove finite-time convergence to approximately locally optimal policies is a promising direction for future research.
  • Real-World Robotics: While validated in simulation, applying the method to real-world robotic systems with unmodeled dynamics and sensor noise would be a crucial next step.

Summary updated

BibTeX
@inproceedings{suttle2024sampling,
  author = {Wesley A. Suttle and Vipul K. Sharma and Krishna Chaitanya Kosaraju and S. Sivaranjani and Ji Liu and Vijay Gupta and Brian M. Sadler},
  title = {{Sampling-based Safe Reinforcement Learning for Nonlinear Dynamical Systems}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=HY7T2NY1Ge},
}
Figure