From 67d7929e11360a46bbc596eb89af9561b0a74408 Mon Sep 17 00:00:00 2001 From: u214892 <u214892@sbb.ch> Date: Thu, 6 Jun 2019 16:05:40 +0200 Subject: [PATCH] #25 use RailEnvActions enum instead of hardcoded action ints --- flatland/envs/predictions.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/flatland/envs/predictions.py b/flatland/envs/predictions.py index 0420ab70..ecc0f8f1 100644 --- a/flatland/envs/predictions.py +++ b/flatland/envs/predictions.py @@ -4,6 +4,7 @@ Collection of environment-specific PredictionBuilder. import numpy as np +from envs.rail_env import RailEnvActions from flatland.core.env_prediction_builder import PredictionBuilder @@ -41,12 +42,7 @@ class DummyPredictorForRailEnv(PredictionBuilder): prediction_dict = {} for agent in agents: - - # 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] + action_priorities = [RailEnvActions.MOVE_FORWARD, RailEnvActions.MOVE_LEFT, RailEnvActions.MOVE_RIGHT] _agent_initial_position = agent.position _agent_initial_direction = agent.direction prediction = np.zeros(shape=(self.max_depth, 5)) -- GitLab