flatland.core.effects_generator module#

class flatland.core.effects_generator.EffectsGenerator(on_episode_start: Callable[[EnvironmentType], EnvironmentType] | None = None, on_episode_step_start: Callable[[EnvironmentType], EnvironmentType] | None = None, on_episode_step_end: Callable[[EnvironmentType], EnvironmentType] | None = None)[source]#

Bases: Generic[EnvironmentType]

Hook for external events modifying the env (state) before observations and rewards are computed.

See flatland-association/flatland-workshop-2024

on_episode_start(env: EnvironmentType, *args, **kwargs) EnvironmentType[source]#

Called by env at the end of reset before computing observations and infos.

In the future, will receive immutable state instead of full env.

Naming similar to https://docs.ray.io/en/latest/rllib/package_ref/doc/ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_start.html#ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_start, but modifying.

Parameters#

env args kwargs

Returns#

on_episode_step_end(env: EnvironmentType, *args, **kwargs) EnvironmentType[source]#

Called by env at the end of step before computing observations and infos.

In the future, will receive immutable state instead of full env.

Naming similar to to https://docs.ray.io/en/latest/rllib/package_ref/doc/ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_step.html#ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_step, but modifying.

Parameters#

env: Ra args kwargs

Returns#

on_episode_step_start(env: EnvironmentType, *args, **kwargs) EnvironmentType[source]#

Called by env at the beginning of step before evaluating the agent’s actions.

In the future, will receive immutable state instead of full env.

No naming similar to RLlib equivalent, see https://docs.ray.io/en/latest/rllib/rllib-callback.html

Parameters#

env args kwargs

Returns#

flatland.core.effects_generator.effects_generator_wrapper(*effects_generators: EffectsGenerator[EnvironmentType]) EffectsGenerator[EnvironmentType][source]#