Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 520 Bytes

alternatives.md

File metadata and controls

22 lines (18 loc) · 520 Bytes

Alternatives

Usage

In addition to a context manager (recommended), the environment can also be closed manually by using env.close()

import gym
from gym_brt import QubeSwingupEnv

num_episodes = 10
num_steps = 250

env = QubeSwingupEnv()
try:
    for episode in range(num_episodes):
        state = env.reset()
        for step in range(num_steps):
            action = env.action_space.sample()
            state, reward, done, _ = env.step(action)
finally:
    env.close()