From d16342f4229e280402d59344dde298b1c718dc5c Mon Sep 17 00:00:00 2001 From: MLErik <baerenjesus@gmail.com> Date: Fri, 25 Oct 2019 17:25:11 -0400 Subject: [PATCH] working on detection of initial fixed step of each agent --- flatland/envs/rail_env.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 413554c6..3c4a0487 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -400,13 +400,16 @@ class RailEnv(Environment): return True # Restart fixed agents + + if agent.malfunction_data['malfunction'] < 1 and agent.malfunction_data['next_malfunction'] > 0: + agent.malfunction_data['next_malfunction'] -= 1 if 'moving_before_malfunction' in agent.malfunction_data: self.agents[i_agent].moving = agent.malfunction_data['moving_before_malfunction'] return False # Break agents that have next_malfunction - if 1 > agent.malfunction_data['malfunction'] and agent.malfunction_data['next_malfunction'] < 1: + if agent.malfunction_data['malfunction'] < 1 and agent.malfunction_data['next_malfunction'] < 1: # Increase number of malfunctions agent.malfunction_data['nr_malfunctions'] += 1 -- GitLab