Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.48 KB

designpatterns.rst

File metadata and controls

44 lines (30 loc) · 1.48 KB

Design Patterns

This page lays out some common design patterns for setting up your Phantom environment.

Simple Environment Pattern

This pattern is common for simple experiments. In this pattern all agents act at every step. Subclassing an environment from the :class:`PhantomEnv` class is sufficient for this.

Finite State Machine Pattern

For more complex experiments with multiple steps and multiple agent groups potentially with a subset of agents taking actions each turn Phantom provides the :class:`FiniteStateMachineEnv` class. This formalises the environment as a free state machine by extending the :class:`PhantomEnv` class and providing a clean interface for managing the logic of each state and the transitions between states.

Alternate Turn Pattern (Stackelberg Game)

A simple but commonly used pattern is that of a free state machine with two states that pass from one another. This is formally known as a Stackleberg game or a Stackelberg competition. This can easily be implemented using the :class:`FiniteStateMachineEnv` class.