flatland.envs.rail_grid_transition_map module#

class flatland.envs.rail_grid_transition_map.RailGridTransitionMap(width, height, transitions: ~flatland.core.transitions.Transitions = <flatland.envs.grid.rail_env_grid.RailEnvTransitions object>, grid: ~numpy.ndarray | None = None)[source]#

Bases: GridTransitionMap[RailEnvActions]

apply_action_independent(action: RailEnvActions, configuration: Tuple[Tuple[int, int], int]) Tuple[Tuple[Tuple[int, int], int], bool] | None[source]#

Apply the action on the train regardless of locations of other agents. Checks for valid cells to move and valid rail transitions.

Parameters#

action[ActionsType]

Action to execute

configurationConfigurationType

position and orientation

Returns#

configurationUnderlyingConfigurationType

the next configuration (cell + direction, resp., edge)

straightbool

whether the transition allows acceleration (only straight transitions in the grid, i.e. facing along the same axis: N->N/S, E->E/W, S->S/N, W->W/E)

get_predecessor_configurations(configuration: Tuple[Tuple[int, int], int]) Set[Tuple[Tuple[int, int], int]][source]#
get_successor_configurations(configuration: Tuple[Tuple[int, int], int]) Set[Tuple[Tuple[int, int], int]][source]#
get_valid_directions_on_grid(row: int, col: int) List[int][source]#

Returns directions in which the agent can move