Created
April 28, 2020 08:16
-
-
Save YannBerthelot/3779e09fdc44c81c440a3cea9726e976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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