Skip to content

Instantly share code, notes, and snippets.

@WhatIThinkAbout
Created July 23, 2022 16:02
Show Gist options
  • Select an option

  • Save WhatIThinkAbout/7ef95729077314cdcebc23c1f897da75 to your computer and use it in GitHub Desktop.

Select an option

Save WhatIThinkAbout/7ef95729077314cdcebc23c1f897da75 to your computer and use it in GitHub Desktop.
class Dynamic(gym.Space):
def __init__(self, action_list = []):
' set the list of initially available actions '
self.set_actions(action_list)
def sample(self):
' select a random action from the set of available actions '
return np.random.choice(self.available_actions)
def set_actions(self,actions):
self.available_actions = actions
self.n = len(actions)
def get_available_actions(self):
return [str(action) for action in self.available_actions]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment