flatland.callbacks.callbacks module#

class flatland.callbacks.callbacks.FlatlandCallbacks[source]#

Bases: object

Abstract base class for Flatland callbacks similar to rllib, see ray-project/ray.

These callbacks can be used for custom metrics and custom postprocessing.

By default, all of these callbacks are no-ops.

on_episode_end(*, env: Environment | None = None, data_dir: Path | None = None, **kwargs) None[source]#

Called when an episode is done (after terminated/truncated have been logged).

The exact time of the call of this callback is after env.step([action])

Parameters#

envEnvironment

the env

data_dirPath

trajectory data dir

kwargs:

Forward compatibility placeholder.

on_episode_start(*, env: Environment | None = None, data_dir: Path | None = None, **kwargs) None[source]#

Callback run right after an Episode has been started.

This method gets called after env.reset().

Parameters#

envEnvironment

the env

data_dirPath

trajectory data dir

kwargs:

Forward compatibility placeholder.

on_episode_step(*, env: Environment | None = None, data_dir: Path | None = None, **kwargs) None[source]#

Called on each episode step (after the action(s) has/have been logged).

This callback is also called after the final step of an episode, meaning when terminated/truncated are returned as True from the env.step() call.

The exact time of the call of this callback is after env.step([action]) and also after the results of this step (observation, reward, terminated, truncated, infos) have been logged to the given episode object.

Parameters#

envEnvironment

the env

data_dirPath

trajectory data dir

kwargs:

Forward compatibility placeholder.

flatland.callbacks.callbacks.make_multi_callbacks(*_callback_list: FlatlandCallbacks)[source]#