Skip to content

Commit

Permalink
Kill timestep_limit
Browse files Browse the repository at this point in the history
  • Loading branch information
nottombrown committed Dec 28, 2016
1 parent 2890611 commit 68c66b9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/scripts/sim_env
Expand Up @@ -20,7 +20,7 @@ env = envs.make(args.env)
ac_space = env.action_space

fps = args.fps or env.metadata.get('video.frames_per_second') or 100
if args.max_steps == 0: args.max_steps = env.spec.timestep_limit
if args.max_steps == 0: args.max_steps = env.spec.tags['wrapper_config.TimeLimit.max_episode_steps']

while True:
env.reset()
Expand Down
2 changes: 0 additions & 2 deletions gym/envs/README.md
Expand Up @@ -56,12 +56,10 @@ ant.AntEnv
register(
id='foo-v0',
entry_point='gym_foo.envs:FooEnv',
timestep_limit=1000,
)
register(
id='foo-extrahard-v0',
entry_point='gym_foo.envs:FooExtraHardEnv',
timestep_limit=1000,
)
```

Expand Down
5 changes: 1 addition & 4 deletions gym/envs/registration.py
Expand Up @@ -25,7 +25,6 @@ class EnvSpec(object):
Args:
id (str): The official environment ID
entry_point (Optional[str]): The Python entrypoint of the environment class (e.g. module.name:Class)
timestep_limit (int): The max number of timesteps per episode during training
trials (int): The number of trials to average reward over
reward_threshold (Optional[int]): The reward threshold before the task is considered solved
local_only: True iff the environment is to be used only on the local machine (e.g. debugging envs)
Expand All @@ -35,14 +34,12 @@ class EnvSpec(object):
Attributes:
id (str): The official environment ID
timestep_limit (int): The max number of timesteps per episode in official evaluation
trials (int): The number of trials run in official evaluation
"""

def __init__(self, id, entry_point=None, timestep_limit=1000, trials=100, reward_threshold=None, local_only=False, kwargs=None, nondeterministic=False, tags=None):
def __init__(self, id, entry_point=None, trials=100, reward_threshold=None, local_only=False, kwargs=None, nondeterministic=False, tags=None):
self.id = id
# Evaluation parameters
self.timestep_limit = timestep_limit
self.trials = trials
self.reward_threshold = reward_threshold
# Environment properties
Expand Down
10 changes: 5 additions & 5 deletions misc/write_rollout_data.py
Expand Up @@ -13,13 +13,13 @@ def __init__(self, ac_space):
def act(self, _):
return self.ac_space.sample()

def rollout(env, agent, timestep_limit):
def rollout(env, agent, max_episode_steps):
"""
Simulate the env and agent for timestep_limit steps
Simulate the env and agent for max_episode_steps
"""
ob = env.reset()
data = collections.defaultdict(list)
for _ in xrange(timestep_limit):
for _ in xrange(max_episode_steps):
data["observation"].append(ob)
action = agent.act(ob)
data["action"].append(action)
Expand All @@ -46,10 +46,10 @@ def main():
alldata = {}
for i in xrange(2):
np.random.seed(i)
data = rollout(env, agent, env.spec.timestep_limit)
data = rollout(env, agent, env.spec.tags['wrapper_config.TimeLimit.max_episode_steps'])
for (k, v) in data.items():
alldata["%i-%s"%(i, k)] = v
np.savez(args.outfile, **alldata)

if __name__ == "__main__":
main()
main()

1 comment on commit 68c66b9

@nojvek
Copy link

@nojvek nojvek commented on 68c66b9 Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This totally broke universe installation. See openai/universe#87

Please sign in to comment.