An Example of the SAM+ Algorithm for Learning Action Models for Stochastic Worlds

Brendan Juba, Roni SternarXiv 2022

Abstract: In this technical report, we provide a complete example of running the SAM+ algorithm, an algorithm for learning stochastic planning action models, on a simplified PPDDL version of the Coffee problem. We provide a very brief description of the SAM+ algorithm and detailed description of our simplified version of the Coffee domain, and then describe the results of running it on the simplified Coffee domain.

Introduction

In automated planning, an agent requires a "world model" to predict the outcomes of its actions. While classical planning assumes actions are deterministic, real-world environments are inherently stochastic—actions can fail or result in multiple possible outcomes with varying probabilities. Manually authoring these stochastic models in formats like the Probabilistic Planning Domain Definition Language (PPDDL) is difficult and error-prone.

The SAM+ (Stochastic Action Model) algorithm addresses this by automatically learning models from observed trajectories. A key focus of SAM+ is "safe" learning: ensuring that learned probabilities are statistically grounded so that planners do not make overconfident assumptions based on sparse data.

The SAM+ Algorithm

SAM+ takes a set of trajectories and a safety parameter ($\delta$) as input to generate a PPDDL model. The algorithm operates in two primary phases:

  1. Learning Preconditions: SAM+ identifies action preconditions by taking the intersection of all literals (facts about the world) that were true in the state immediately preceding that action across all observations. This conservative approach ensures that a fact is only considered a precondition if it was present every time the action was executed.
  2. Learning Effects: The algorithm estimates the probability of state changes (effects) using "credal sets"—intervals of possible probabilities.
  3. Observed Changes: For changes observed in the data, probabilities are estimated using empirical frequency adjusted by a confidence margin derived from Hoeffding-style bounds.
  4. Unobserved Changes: If a change was never observed, SAM+ does not assume it is impossible. Instead, it assigns a small upper bound probability based on the number of observations, preventing the planner from being "blind-sided" by rare but possible events.
  5. Point Estimates: To maintain compatibility with standard planners, these intervals are converted into specific point probabilities (typically midpoints).

The Simplified Coffee Domain

The algorithm was evaluated using the Simplified Coffee Domain, a benchmark robot planning task. The state is defined by five fluents: in-office (IO), has-umbrella (HU), is-wet (IW), has-coffee (HC), and user-has-coffee (UHC). The domain includes six actions, such as buy-coffee (BC) and deliver-coffee (DC).

Observed trajectories (T1-T4) in the simplified Coffee Domain.

The dataset consists of four specific trajectories (T1-T4), as shown in the table above. These trajectories capture different scenarios, such as the robot leaving the office without an umbrella and subsequently becoming wet or remaining dry.

Key Insights and Results

The walkthrough demonstrates several critical behaviors of the SAM+ algorithm:

  • Statistical Safety and Convergence: The $\delta$ parameter allows the algorithm to acknowledge its own uncertainty. With only one observation per trajectory, the confidence margin for an effect is high (±0.71). However, as data increases to 100 observations per trajectory, this margin narrows significantly to ±0.07, showing how the model "sharpens" with more evidence.
  • Handling the "Never Seen": By assigning non-zero probabilities to unobserved effects, the model remains robust. It stays open to the possibility of an effect until a large number of "no-change" observations proves it highly unlikely.
  • Probabilistic Accuracy: The algorithm is highly sensitive to the frequency of observed outcomes. In simulations with skewed distributions (e.g., 895 instances of T1 vs. 10 of T3), the algorithm correctly converged to a 0.9 probability for the "getting wet" effect, matching the ground truth of the underlying domain.

Limitations and Future Work

While effective in this controlled environment, SAM+ currently assumes full observability, meaning the agent can see every relevant fact at every step. In real-world robotics, sensors are often noisy or states are partially hidden. Additionally, the conservative precondition learning (via strict intersection) may be vulnerable to noisy observations that could lead to overly restrictive models. Future research will explore how these learned models perform when integrated directly into PPDDL planners for complex, high-dimensional tasks.

Summary updated

BibTeX
@misc{juba2022example,
  author = {Brendan Juba and Roni Stern},
  title = {{An Example of the SAM+ Algorithm for Learning Action Models for Stochastic Worlds}},
  year = {2022},
  eprint = {2203.12499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.12499},
}
Figure