From e2d82e68f330c00f763507b3b01d774740bee53f Mon Sep 17 00:00:00 2001 From: Kevin Lu Date: Mon, 7 Feb 2022 10:58:01 -0800 Subject: [PATCH] off-by-one bug in % hyperparameter --- gym/experiment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gym/experiment.py b/gym/experiment.py index d1cb3f67..fd3dea81 100644 --- a/gym/experiment.py +++ b/gym/experiment.py @@ -106,7 +106,7 @@ def experiment( num_trajectories = 1 timesteps = traj_lens[sorted_inds[-1]] ind = len(trajectories) - 2 - while ind >= 0 and timesteps + traj_lens[sorted_inds[ind]] < num_timesteps: + while ind >= 0 and timesteps + traj_lens[sorted_inds[ind]] <= num_timesteps: timesteps += traj_lens[sorted_inds[ind]] num_trajectories += 1 ind -= 1