Monitor API¶
The monitor layer turns finite-trace LTLf formulas into per-agent terminal objective rewards. It also exposes the small state-machine surface needed by counterfactual replay.
Core Types¶
Configuration for reward-monitor observation augmentation.
temporally_extended
class-attribute
instance-attribute
¶
Append the current monitor-state id to each learner observation.
Reward-monitor specification for one agent.
If agent_id is None, the spec is treated as shared and applied to all
agents in a parallel PettingZoo environment.
Per-agent episode summary stored by BoolRewardWrapper.
cum_reward
instance-attribute
¶
Objective cumulative reward kept for backward-compatible plotting.
handcrafted_cum_reward
class-attribute
instance-attribute
¶
Learner reward for handcrafted baselines, when applicable.
learner_cum_reward
class-attribute
instance-attribute
¶
Reward actually returned to the learner.
objective_cum_reward
class-attribute
instance-attribute
¶
Cumulative terminal objective reward.
start_step
class-attribute
instance-attribute
¶
Global timestep at the first step of the episode, when known.
Bases: BaseParallelWrapper
PettingZoo Parallel reward wrapper
- One BoolMonitor per agent (one LTLf spec per agent).
- label() is shared (computed once per step).
- Rewards are monitor-based.
- Tracks EpisodeLog per agent across episodes.
export ¶
export(
to_file: bool = True,
dir: str = "exports",
filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]
Export one automaton per agent monitor.
- If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
- Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
- If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.
label ¶
Override in subclass. Should return dict[str,bool] (shared labels, applied to every agent). Possibly extensible to agent-specific labels, with type: dict[agent_id, dict[str,bool]]