From 49746bc6fb5bb7c0d0607140805aac00d8754657 Mon Sep 17 00:00:00 2001 From: u214892 <u214892@sbb.ch> Date: Thu, 5 Sep 2019 16:03:42 +0200 Subject: [PATCH] #167 bugfix action_on_cellexit --- flatland/envs/rail_env.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index ddd8e442..b9d1aa54 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -262,7 +262,7 @@ class RailEnv(Environment): agent.malfunction_data['malfunction'] = 0 - self._agent_malfunction(i_agent, RailEnvActions.DO_NOTHING) + self._agent_new_malfunction(i_agent, RailEnvActions.DO_NOTHING) self.num_resets += 1 self._elapsed_steps = 0 @@ -277,7 +277,10 @@ class RailEnv(Environment): # Return the new observation vectors for each agent return self._get_observations() - def _agent_malfunction(self, i_agent, action) -> bool: + def _agent_new_malfunction(self, i_agent, action) -> bool: + """ + Returns true if the agent enters into malfunction. (False, if not broken down or already broken down before). + """ agent = self.agents[i_agent] # Decrease counter for next event @@ -345,7 +348,7 @@ class RailEnv(Environment): action = RailEnvActions.DO_NOTHING # Check if agent breaks at this step - new_malfunction = self._agent_malfunction(i_agent, action) + new_malfunction = self._agent_new_malfunction(i_agent, action) # Is the agent at the beginning of the cell? Then, it can take an action # Design choice (Erik+Christian): -- GitLab