mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-23 15:04:20 +00:00
adds example usage to spaces (#173)
This commit is contained in:
committed by
Greg Brockman
parent
a4c35f82c0
commit
f254dd197e
@@ -7,6 +7,9 @@ class Box(gym.Space):
|
|||||||
"""
|
"""
|
||||||
A box in R^n.
|
A box in R^n.
|
||||||
I.e., each coordinate is bounded.
|
I.e., each coordinate is bounded.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
self.action_space = spaces.Box(low=-10, high=10, shape=(1,))
|
||||||
"""
|
"""
|
||||||
def __init__(self, low, high, shape=None):
|
def __init__(self, low, high, shape=None):
|
||||||
"""
|
"""
|
||||||
|
@@ -6,6 +6,9 @@ from gym.spaces import prng
|
|||||||
class Discrete(gym.Space):
|
class Discrete(gym.Space):
|
||||||
"""
|
"""
|
||||||
{0,1,...,n-1}
|
{0,1,...,n-1}
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
self.observation_space = spaces.Discrete(2)
|
||||||
"""
|
"""
|
||||||
def __init__(self, n):
|
def __init__(self, n):
|
||||||
self.n = n
|
self.n = n
|
||||||
|
@@ -3,6 +3,9 @@ from gym import Space
|
|||||||
class Tuple(Space):
|
class Tuple(Space):
|
||||||
"""
|
"""
|
||||||
A tuple (i.e., product) of simpler spaces
|
A tuple (i.e., product) of simpler spaces
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
self.observation_space = spaces.Tuple((spaces.Discrete(2), spaces.Discrete(3)))
|
||||||
"""
|
"""
|
||||||
def __init__(self, spaces):
|
def __init__(self, spaces):
|
||||||
self.spaces = spaces
|
self.spaces = spaces
|
||||||
|
Reference in New Issue
Block a user