Skip to content
Snippets Groups Projects
Commit eb5eb66a authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

removed "fixed" attribute of agents as it is not needed anymore

parent 21160e70
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment