From eb5eb66aa551c06f9c717142348451251f637e71 Mon Sep 17 00:00:00 2001
From: MLErik <baerenjesus@gmail.com>
Date: Thu, 31 Oct 2019 12:15:36 -0400
Subject: [PATCH] removed "fixed" attribute of agents as it is not needed
 anymore

---
 flatland/envs/agent_utils.py | 5 ++---
 flatland/envs/rail_env.py    | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/flatland/envs/agent_utils.py b/flatland/envs/agent_utils.py
index f5b84a7d..2bb9677a 100644
--- a/flatland/envs/agent_utils.py
+++ b/flatland/envs/agent_utils.py
@@ -40,7 +40,7 @@ class EnvAgentStatic(object):
     malfunction_data = attrib(
         default=Factory(
             lambda: dict({'malfunction': 0, 'malfunction_rate': 0, 'next_malfunction': 0, 'nr_malfunctions': 0,
-                          'moving_before_malfunction': False, 'fixed': True})))
+                          'moving_before_malfunction': False})))
 
     status = attrib(default=RailAgentStatus.READY_TO_DEPART, type=RailAgentStatus)
     position = attrib(default=None, type=Optional[Tuple[int, int]])
@@ -65,8 +65,7 @@ class EnvAgentStatic(object):
                                       'malfunction_rate': schedule.agent_malfunction_rates[
                                           i] if schedule.agent_malfunction_rates is not None else 0.,
                                       'next_malfunction': 0,
-                                      'nr_malfunctions': 0,
-                                      'fixed': True})
+                                      'nr_malfunctions': 0})
 
         return list(starmap(EnvAgentStatic, zip(schedule.agent_positions,
                                                 schedule.agent_directions,
diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py
index cb2fdb7e..13da13cf 100644
--- a/flatland/envs/rail_env.py
+++ b/flatland/envs/rail_env.py
@@ -406,7 +406,7 @@ class RailEnv(Environment):
         for agent in self.agents:
 
             # Ignore agents that OK
-            if agent.malfunction_data['fixed']:
+            if agent.malfunction_data['malfunction'] < 1:
                 continue
 
             # Reduce number of malfunction steps left
@@ -416,7 +416,6 @@ class RailEnv(Environment):
 
             # Restart agents at the end of their malfunction
             agent.malfunction_data['malfunction'] -= 1
-            agent.malfunction_data['fixed'] = True
             if 'moving_before_malfunction' in agent.malfunction_data:
                 agent.moving = agent.malfunction_data['moving_before_malfunction']
                 continue
@@ -450,7 +449,6 @@ class RailEnv(Environment):
                                                               self.max_number_of_steps_broken + 1) + 1
                 breaking_agent.malfunction_data['malfunction'] = num_broken_steps
                 breaking_agent.malfunction_data['moving_before_malfunction'] = breaking_agent.moving
-                breaking_agent.malfunction_data['fixed'] = False
                 breaking_agent.malfunction_data['nr_malfunctions'] += 1
         return
 
-- 
GitLab