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

Changed behavior of environment to change action_dict of agents after their...

Changed behavior of environment to change action_dict of agents after their input. --> Giacomo please check that this is ok with your implementation
parent 46cf366a
No related branches found
No related tags found
No related merge requests found
......@@ -199,7 +199,8 @@ class RailEnv(Environment):
if iAgent not in action_dict: # no action has been supplied for this agent
if agent.moving:
# Keep moving
action_dict[iAgent] = RailEnvActions.MOVE_FORWARD
# CHange MOVE_FORWARD to DO_NOTHING
action_dict[iAgent] = RailEnvActions.DO_NOTHING
else:
action_dict[iAgent] = RailEnvActions.DO_NOTHING
......@@ -214,12 +215,14 @@ class RailEnv(Environment):
if action == RailEnvActions.DO_NOTHING and agent.moving:
# Keep moving
action_dict[iAgent] = RailEnvActions.MOVE_FORWARD
# Changed MOVE_FORWARD to DO_NOTHING
action_dict[iAgent] = RailEnvActions.DO_NOTHING
action = RailEnvActions.MOVE_FORWARD
if action == RailEnvActions.STOP_MOVING and agent.moving:
action_dict[iAgent] = RailEnvActions.DO_NOTHING
action = RailEnvActions.DO_NOTHING
#action_dict[iAgent] = RailEnvActions.DO_NOTHING
# CHanged DO_NOTHING to STOP_MOVING
action = RailEnvActions.STOP_MOVING
agent.moving = False
self.rewards_dict[iAgent] += stop_penalty
......
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