From 9c66a35f82435836aebfb159763ce38f0954326c Mon Sep 17 00:00:00 2001 From: Erik Nygren <erik.nygren@sbb.ch> Date: Tue, 23 Apr 2019 10:29:57 +0200 Subject: [PATCH] found bug --> Infinite loops that you can enter but never leave... --- examples/training_navigation.py | 3 ++- flatland/core/env_observation_builder.py | 1 + flatland/envs/rail_env.py | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/training_navigation.py b/examples/training_navigation.py index 975d33fb..b78851c8 100644 --- a/examples/training_navigation.py +++ b/examples/training_navigation.py @@ -63,8 +63,9 @@ for trials in range(1, n_trials + 1): action_dict.update({a: action}) # Environment step + print(trials,step) next_obs, all_rewards, done, _ = env.step(action_dict) - + print("stepped") # Update replay buffer and train agent for a in range(env.number_of_agents): diff --git a/flatland/core/env_observation_builder.py b/flatland/core/env_observation_builder.py index d7bee930..ce0a28ae 100644 --- a/flatland/core/env_observation_builder.py +++ b/flatland/core/env_observation_builder.py @@ -272,6 +272,7 @@ class TreeObsForRailEnv(ObservationBuilder): other_agent_encountered = False other_target_encountered = False while exploring: + # ############################# # ############################# # Modify here to compute any useful data required to build the end node's features. This code is called diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 36040d5c..37a97ff8 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -612,9 +612,7 @@ class RailEnv(Environment): direction = reverse_direction movement = reverse_direction is_deadend = True - new_position = self._new_position(pos, movement) - # Is it a legal move? 1) transition allows the movement in the # cell, 2) the new cell is not empty (case 0), 3) the cell is # free, i.e., no agent is currently in that cell @@ -668,7 +666,6 @@ class RailEnv(Environment): # Reset the step actions (in case some agent doesn't 'register_action' # on the next step) self.actions = [0]*self.number_of_agents - return self._get_observations(), self.rewards_dict, self.dones, {} def _new_position(self, position, movement): -- GitLab