Quick Start Guide
This guide will help you get up and running with Reward Machines (RMs) and Counting Reward Machines (CRMs) in just a few minutes.Basic Example
We’ll use the Letter World environment, where an agent must visit letters (specific goal locations)in a specific order.What’s Happening?
- Ground Environment (
LetterWorld) A simple grid world subclass ofgymnasium.Env. - Labelling Function (
LetterWorldLabellingFunction) Maps low-level environment transitions to high-level events (propositions). - Reward Machine (RM) (
LetterWorldRewardMachine) Specifies rewards based on event sequences. - Cross-Product MDP (
LetterWorldCrossProduct) Combines environment, labelling function, and RM into a single Gymnasium-compatible environment.
To model tasks requiring counting or extended memory, swap in a
CountingRewardMachine instead of a standard RM. The workflow is identical.Training a Simple Agent
Here’s a basic tabular Q-learning loop:Next Steps
Worked Examples
- Explore the Letter World Example for a detailed walkthrough.