flatland.core.grid.rail_env_grid module¶
-
class
flatland.core.grid.rail_env_grid.
RailEnvTransitions
[source]¶ Bases:
flatland.core.grid.grid4.Grid4Transitions
Special case of GridTransitions over a 2D-grid, with a pre-defined set of transitions mimicking the types of real Swiss rail connections.
As no diagonal transitions are allowed in the RailEnv environment, the possible transitions for RailEnv from a cell to its neighboring ones are represented over 16 bits.
The 16 bits are organized in 4 blocks of 4 bits each, the direction that the agent is facing. E.g., the most-significant 4-bits represent the possible movements (NESW) if the agent is facing North, etc…
agent’s direction: North East South West agent’s allowed movements: [nesw] [nesw] [nesw] [nesw] example: 1000 0000 0010 0000
In the example, the agent can move from North to South and viceversa.
-
is_valid
(self, cell_transition)[source]¶ Checks if a cell transition is a valid cell setup.
Parameters: - cell_transition : int
64 bits used to encode the valid transitions for a cell.
Returns: - Boolean
True or False
-
transition_list
= [0, 32800, 37408, 33825, 38433, 52275, 20994, 8192, 16386, 4608, 49186]¶
-