Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save YannBerthelot/3779e09fdc44c81c440a3cea9726e976 to your computer and use it in GitHub Desktop.
Save YannBerthelot/3779e09fdc44c81c440a3cea9726e976 to your computer and use it in GitHub Desktop.
class CustomEnvironment(Environment):
def __init__(self):
super().__init__()
def states(self):
return dict(type='float', shape=(8,))
def actions(self):
return dict(type='int', num_values=4)
# Optional, should only be defined if environment has a natural maximum
# episode length
def max_episode_timesteps(self):
return super().max_episode_timesteps()
# Optional
def close(self):
super().close()
def reset(self):
state = np.random.random(size=(8,))
return state
def execute(self, actions):
next_state = np.random.random(size=(8,))
terminal = np.random.random() < 0.5
reward = np.random.random()
return next_state, terminal, reward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment