Skip to content
Snippets Groups Projects
Commit fd755735 authored by Christian Eichenberger's avatar Christian Eichenberger :badminton:
Browse files

Merge branch '25-prediction-refactoring' into 'master'

#25 use RailEnvActions enum instead of hardcoded action ints

Closes #25

See merge request flatland/flatland!51
parents 4145c9ea 515ef9fb
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ Collection of environment-specific PredictionBuilder. ...@@ -5,6 +5,7 @@ Collection of environment-specific PredictionBuilder.
import numpy as np import numpy as np
from flatland.core.env_prediction_builder import PredictionBuilder from flatland.core.env_prediction_builder import PredictionBuilder
from flatland.envs.rail_env import RailEnvActions
class DummyPredictorForRailEnv(PredictionBuilder): class DummyPredictorForRailEnv(PredictionBuilder):
...@@ -41,12 +42,7 @@ class DummyPredictorForRailEnv(PredictionBuilder): ...@@ -41,12 +42,7 @@ class DummyPredictorForRailEnv(PredictionBuilder):
prediction_dict = {} prediction_dict = {}
for agent in agents: for agent in agents:
action_priorities = [RailEnvActions.MOVE_FORWARD, RailEnvActions.MOVE_LEFT, RailEnvActions.MOVE_RIGHT]
# 0: do nothing
# 1: turn left and move to the next cell
# 2: move to the next cell in front of the agent
# 3: turn right and move to the next cell
action_priorities = [2, 1, 3]
_agent_initial_position = agent.position _agent_initial_position = agent.position
_agent_initial_direction = agent.direction _agent_initial_direction = agent.direction
prediction = np.zeros(shape=(self.max_depth, 5)) prediction = np.zeros(shape=(self.max_depth, 5))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment