Skip to content

Commit

Permalink
GymEnv utility methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bpiwowar committed Jun 2, 2023
1 parent 1e62120 commit fa8597a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bbrl/agents/gymnasium.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ def get_obs_and_actions_sizes(self):
state_dim = 1 # self.observation_space.n
return state_dim, action_dim

def is_continuous_action(self):
return isinstance(self.action_space, gym.spaces.Box)

def is_discrete_action(self):
return isinstance(self.action_space, gym.spaces.Discrete)

def is_continuous_state(self):
return isinstance(self.observation_space, gym.spaces.Box)

def is_discrete_state(self):
return isinstance(self.observation_space, gym.spaces.Discrete)

class ParallelGymAgent(GymAgent):
"""Create an Agent from a gymnasium environment
Expand Down

0 comments on commit fa8597a

Please sign in to comment.