Reachability Constrained Reinforcement Learning

Dongjie Yu, Haitong Ma, Sheng-bo Li, Jianyu Chen

In the world of Reinforcement Learning (RL), safety is often treated as an afterthought or a "soft" constraint. We typically instruct an agent to maximize rewards while keeping the average cost of its mistakes low. But in the real world—think autonomous drones or self-driving cars—an "average" safety record isn't good enough. A single collision is a catastrophic failure, no matter how safe the rest of the flight was.

This paper introduces Reachability Constrained Reinforcement Learning (RCRL), a framework that shifts the focus from cumulative safety to persistent safety.

TL;DR

RCRL moves beyond traditional constrained RL by using reachability analysis to ensure an agent stays within a "feasible set" where safety can be guaranteed indefinitely. By learning a safety value function based on maximum (worst-case) violations rather than discounted sums, RCRL identifies larger safe operating regions and achieves superior performance with fewer safety breaches.

What Problem Does This Paper Address?

Most current Constrained RL (CRL) methods use Expected Discounted Cumulative Costs. This approach has a major flaw: it averages danger over time. An agent might decide that a high-risk maneuver is acceptable because it is followed by a long period of safety, effectively "diluting" the risk.

In control theory, safety is defined more rigorously through feasible sets: the subset of states from which an agent can stay safe forever. If a car is speeding toward a wall, it might be in a "safe" state now (no collision yet), but it has exited the feasible set because a crash is now inevitable.

Conceptual comparison of feasible sets

Existing attempts to bring feasible sets into RL often rely on:

  1. Energy-based methods (like Control Barrier Functions): These often require manual tuning and result in "conservative" sets—the agent becomes overly cautious and performs poorly.
  2. Hamilton-Jacobi (HJ) Reachability: This is mathematically rigorous but typically ignores performance (reward) optimization, focusing only on staying safe.

RCRL aims to bridge this gap by learning the largest possible feasible set while simultaneously optimizing for the task reward.

Methods

The core innovation of RCRL is the Safety Value Function ($V_h^\pi$). Unlike a standard value function that sums up rewards, this function tracks the maximum state violation expected along a trajectory.

1. The Self-Consistency Condition

The authors derive a "Bellman-like" equation for safety. Instead of the standard additive update, they use a max-operator: $$V_h^\pi(s) = \max \{h(s), V_h^\pi(s')\}$$ where $h(s)$ is the current constraint violation. This allows the agent to learn the safety value of any state using Temporal Difference (TD) learning.

2. The Optimization Objective

RCRL sets up a dual-objective problem:

  • Inside the feasible set: Maximize the expected return.
  • Outside the feasible set: Minimize the safety value function (i.e., get back to safety as quickly as possible).

3. Lagrangian-based Algorithm

To solve this, they use a Lagrangian approach with a statewise multiplier. Instead of one global penalty for all states, they use a neural network to learn a multiplier $\lambda(s)$ that applies the right amount of "safety pressure" depending on exactly where the agent is in the state space.

Datasets and Benchmarks

The authors evaluated RCRL on three distinct platforms:

  • Double Integrator: A classic 2D control problem where the "ground truth" feasible set can be calculated analytically. This was used to verify if RCRL actually learns the correct set.
  • Safe-control-gym (2D Quadrotor): A nonlinear task where a drone must track a circular path while staying within a vertical "tunnel."
  • Safety-Gym: A high-dimensional benchmark featuring complex agents (Point, Car, Doggo) navigating environments with hazards and pillars using Lidar-like sensor inputs.

Key Insights and Ideas

  • Max vs. Sum: The shift from "sum of costs" to "maximum violation" is the key to formalizing persistent safety. It ensures that the worst moment of a trajectory is the primary concern.
  • The "Largest" Feasible Set: By learning the safety boundaries directly from data, RCRL avoids the over-conservativeness of traditional control methods. It finds the actual limits of what the robot can handle, allowing for more aggressive (and thus higher-performing) policies.
  • Unified Learning: RCRL doesn't switch between a "safe controller" and an "optimal controller." It learns a single, unified policy that understands the trade-off between reward and the boundary of the feasible set.

Key Results

  • Ground Truth Matching: In the Double Integrator task, RCRL's learned feasible set almost perfectly overlapped with the analytical solution (the HJ Viability Kernel). In contrast, traditional energy-based methods (MPC-CBF) were significantly more restrictive.
Comparison of learned feasible sets on the Double Integrator task
  • Zero-Violation Performance: In the Quadrotor task, the RCRL agent achieved zero constraint violations while maintaining high tracking accuracy. Baselines like SAC-Lagrangian either violated constraints or (in the case of SAC-CBF) were so cautious they barely moved.
  • Scalability: In Safety-Gym, RCRL consistently showed the best constraint satisfaction across different agents (Car, Doggo) while matching or exceeding the rewards of standard PPO-Lagrangian.

Limitations and Future Work

  • Safety During Training: Like most Lagrangian methods, RCRL guarantees safety after convergence. During the early stages of training, the agent must explore the boundaries to learn where they are, which inevitably leads to violations.
  • Exploration Risk: The agent's need to "touch the stove" to learn it's hot is a fundamental challenge. The authors suggest that future work could combine RCRL with model-based RL to predict and avoid these training-time violations.
  • Computational Overhead: Learning a statewise multiplier network and a safety value function adds complexity compared to standard RL, though the authors demonstrate it is manageable for the tested benchmarks.

Summary updated

BibTeX
@inproceedings{yu2022reachability,
  author = {Dongjie Yu and Haitong Ma and Sheng-bo Li and Jianyu Chen},
  title = {{Reachability Constrained Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=OGeouX0eUl9},
}
Figure