flatland.envs.malfunction_effects_generators module#
- class flatland.envs.malfunction_effects_generators.ConditionalMalfunctionEffectsGenerator(malfunction_rate: float | None = None, min_duration: float | None = None, max_duration: float | None = None, earliest_malfunction: int | None = None, max_num_malfunctions: int | None = None, condition: Callable[[EnvAgent, int], bool] | None = None, condition_pkg: str | None = None, condition_cls: str | None = None)[source]#
Bases:
EffectsGenerator
[RailEnv
]- on_episode_step_start(env: RailEnv, *args, **kwargs) RailEnv [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#
- class flatland.envs.malfunction_effects_generators.MalfunctionEffectsGenerator(malfunction_generator)[source]#
Bases:
EffectsGenerator
[RailEnv
]- on_episode_step_start(env: RailEnv, *args, **kwargs) RailEnv [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.envs.malfunction_effects_generators.condition_stopped_cells_and_range(start_step_incl: int, end_step_excl: int, cells: List[Tuple[int, int]]) Callable[[EnvAgent, int], bool] [source]#
Malfunction condition: stopped on any given cell and during range of timesteps.
Parameters#
- start_step_inclint
start step of positive range (incl.)
- end_step_exclint
end step of positive range (excl.)
Returns#
MalfunctionCondition
- flatland.envs.malfunction_effects_generators.condition_stopped_intermediate_and_range(start_step_incl: int, end_step_excl: int) Callable[[EnvAgent, int], bool] [source]#
Malfunction condition: stopped at an intermediate waypoint and in range of timesteps.
Parameters#
- start_step_inclint
start step of positive range (incl.)
- end_step_exclint
end step of positive range (excl.)
Returns#
MalfunctionCondition
- flatland.envs.malfunction_effects_generators.make_multi_malfunction_condition(conditions: List[Callable[[EnvAgent, int], bool]]) Callable[[EnvAgent, int], bool] [source]#
Disjunctively wrap multiple MalfunctionCondition into one.
Parameters#
- conditionsList[MalfunctionCondition]
list of disjunctive conditions
Returns#
MalfunctionCondition