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

working on detection of initial fixed step of each agent

parent 000c2c19
No related branches found
No related tags found
No related merge requests found
...@@ -407,13 +407,16 @@ class RailEnv(Environment): ...@@ -407,13 +407,16 @@ class RailEnv(Environment):
return True return True
# Restart fixed agents # Restart fixed agents
if agent.malfunction_data['malfunction'] < 1 and agent.malfunction_data['next_malfunction'] > 0: 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: if 'moving_before_malfunction' in agent.malfunction_data:
self.agents[i_agent].moving = agent.malfunction_data['moving_before_malfunction'] self.agents[i_agent].moving = agent.malfunction_data['moving_before_malfunction']
return False return False
# Break agents that have next_malfunction # 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 # Increase number of malfunctions
agent.malfunction_data['nr_malfunctions'] += 1 agent.malfunction_data['nr_malfunctions'] += 1
......
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