flatland.envs.predictions module¶
Collection of environment-specific PredictionBuilder.
-
class
flatland.envs.predictions.
DummyPredictorForRailEnv
(max_depth: int = 20)[source]¶ Bases:
flatland.core.env_prediction_builder.PredictionBuilder
DummyPredictorForRailEnv object.
This object returns predictions for agents in the RailEnv environment. The prediction acts as if no other agent is in the environment and always takes the forward action.
-
get
(self, handle:int=None)[source]¶ Called whenever get_many in the observation build is called.
Parameters: - handle : int, optional
Handle of the agent for which to compute the observation vector.
Returns: - np.array
Returns a dictionary indexed by the agent handle and for each agent a vector of (max_depth + 1)x5 elements: - time_offset - position axis 0 - position axis 1 - direction - action taken to come here The prediction at 0 is the current position, direction etc.
-
-
class
flatland.envs.predictions.
ShortestPathPredictorForRailEnv
(max_depth: int = 20)[source]¶ Bases:
flatland.core.env_prediction_builder.PredictionBuilder
ShortestPathPredictorForRailEnv object.
This object returns shortest-path predictions for agents in the RailEnv environment. The prediction acts as if no other agent is in the environment and always takes the forward action.
-
get
(self, handle:int=None)[source]¶ Called whenever get_many in the observation build is called. Requires distance_map to extract the shortest path. Does not take into account future positions of other agents!
If there is no shortest path, the agent just stands still and stops moving.
Parameters: - handle : int, optional
Handle of the agent for which to compute the observation vector.
Returns: - np.array
Returns a dictionary indexed by the agent handle and for each agent a vector of (max_depth + 1)x5 elements: - time_offset - position axis 0 - position axis 1 - direction - action taken to come here (not implemented yet) The prediction at 0 is the current position, direction etc.
-