flatland.envs.malfunction_generators module

Malfunction generators for rail systems

class flatland.envs.malfunction_generators.Malfunction(num_broken_steps)

Bases: tuple

num_broken_steps

Alias for field number 0

class flatland.envs.malfunction_generators.MalfunctionParameters(malfunction_rate, min_duration, max_duration)

Bases: tuple

malfunction_rate

Alias for field number 0

max_duration

Alias for field number 2

min_duration

Alias for field number 1

class flatland.envs.malfunction_generators.MalfunctionProcessData(malfunction_rate, min_duration, max_duration)

Bases: tuple

malfunction_rate

Alias for field number 0

max_duration

Alias for field number 2

min_duration

Alias for field number 1

flatland.envs.malfunction_generators.malfunction_from_file(filename:str) → Tuple[Callable[[flatland.envs.agent_utils.EnvAgent, numpy.random.mtrand.RandomState, bool], Union[flatland.envs.malfunction_generators.Malfunction, NoneType]], flatland.envs.malfunction_generators.MalfunctionProcessData][source]

Utility to load pickle file

Parameters:
input_file : Pickle file generated by env.save() or editor
Returns:
generator, Tuple[float, int, int] with mean_malfunction_rate, min_number_of_steps_broken, max_number_of_steps_broken
flatland.envs.malfunction_generators.malfunction_from_params(parameters:flatland.envs.malfunction_generators.MalfunctionParameters) → Tuple[Callable[[flatland.envs.agent_utils.EnvAgent, numpy.random.mtrand.RandomState, bool], Union[flatland.envs.malfunction_generators.Malfunction, NoneType]], flatland.envs.malfunction_generators.MalfunctionProcessData][source]

Utility to load malfunction from parameters

Parameters:
parameters : contains all the parameters of the malfunction

malfunction_rate : float how many time steps it takes for a sinlge agent befor it breaks min_duration : int minimal duration of a failure max_number_of_steps_broken : int maximal duration of a failure

Returns:
generator, Tuple[float, int, int] with mean_malfunction_rate, min_number_of_steps_broken, max_number_of_steps_broken
flatland.envs.malfunction_generators.no_malfunction_generator() → Tuple[Callable[[flatland.envs.agent_utils.EnvAgent, numpy.random.mtrand.RandomState, bool], Union[flatland.envs.malfunction_generators.Malfunction, NoneType]], flatland.envs.malfunction_generators.MalfunctionProcessData][source]

Malfunction generator which generates no malfunctions

Parameters:
Nothing
Returns:
generator, Tuple[float, int, int] with mean_malfunction_rate, min_number_of_steps_broken, max_number_of_steps_broken
flatland.envs.malfunction_generators.single_malfunction_generator(earlierst_malfunction:int, malfunction_duration:int) → Tuple[Callable[[flatland.envs.agent_utils.EnvAgent, numpy.random.mtrand.RandomState, bool], Union[flatland.envs.malfunction_generators.Malfunction, NoneType]], flatland.envs.malfunction_generators.MalfunctionProcessData][source]

Malfunction generator which guarantees exactly one malfunction during an episode of an ACTIVE agent.

Parameters:
earlierst_malfunction: Earliest possible malfunction onset
malfunction_duration: The duration of the single malfunction
Returns:
generator, Tuple[float, int, int] with mean_malfunction_rate, min_number_of_steps_broken, max_number_of_steps_broken