Skip to content

Commit

Permalink
fixed sims_per_step done bug (#838)
Browse files Browse the repository at this point in the history
this was causing experiments to end prematurely if sims_per_step > 1
  • Loading branch information
AboudyKreidieh committed Feb 27, 2020
1 parent bc65245 commit 4cd30ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions flow/envs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,9 @@ def step(self, rl_actions):

# test if the environment should terminate due to a collision or the
# time horizon being met
done = (self.time_counter >= self.env_params.warmup_steps +
self.env_params.horizon) # or crash
done = (self.time_counter >= self.env_params.sims_per_step *
(self.env_params.warmup_steps + self.env_params.horizon)
or crash)

# compute the info for each agent
infos = {}
Expand Down
4 changes: 2 additions & 2 deletions flow/envs/multiagent/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def step(self, rl_actions):
states = self.get_state()
done = {key: key in self.k.vehicle.get_arrived_ids()
for key in states.keys()}
if crash or (self.time_counter >= self.env_params.warmup_steps +
self.env_params.horizon):
if crash or (self.time_counter >= self.env_params.sims_per_step *
(self.env_params.warmup_steps + self.env_params.horizon)):
done['__all__'] = True
else:
done['__all__'] = False
Expand Down

0 comments on commit 4cd30ee

Please sign in to comment.