qgym.spaces package
This package contains general spaces that are to be used as action or observation
space in custom RL Environments. All spaces inherit from spaces of the gymnasium
package.
- class qgym.spaces.Box(low, high, shape=None, dtype=<class 'numpy.float64'>, *, rng=None)[source]
Bases:
Box
An \(n\)-dimensional box space, i.e., collection of (possibly) open-ended intervals.
- __init__(low, high, shape=None, dtype=<class 'numpy.float64'>, *, rng=None)[source]
Initialize a
Box
space, i.e., a possibly open-ended interval in \(n\) dimensions.- Parameters:
low (
Union
[SupportsFloat
,Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) – Either one lower bound for all intervals, or anNDArray
with the shape given in shape with unique lower bounds for each interval.high (
Union
[SupportsFloat
,Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[Union
[bool
,int
,float
,complex
,str
,bytes
]]]) – Either one upper bound for all intervals, or anNDArray
with the shape given in shape with unique upper bounds for each interval.shape (
Sequence
[int
] |None
) –Tuple
containing the shape of theBox
space.dtype (
type
[floating
[Any
]] |type
[integer
[Any
]]) – Type of the values in each interval.rng (
Generator
|None
) – Random number generator to be used in this space, ifNone
a new one will be constructed.
- class qgym.spaces.Dict(spaces=None, *, rng=None, **spaces_kwargs)[source]
Bases:
Dict
Dictionary of other action/observation spaces for use in RL environments.
- __init__(spaces=None, *, rng=None, **spaces_kwargs)[source]
Initialize a
Dict
space, with string valued keys and spaces inheriting fromgym.Space
as values.- Parameters:
spaces (
dict
[str
,Space
[Any
]] |Sequence
[tuple
[str
,Space
[Any
]]] |None
) – Dictionary containing string valued keys and spaces that are to formspace. (this Dict)
rng (
Generator
|None
) – Random number generator to be used in this space, ifNone
a new one will be constructed.spaces_kwargs (
Space
[Any
]) – Spaces that are to form thisDict
space.
- class qgym.spaces.Discrete(n, start=0, *, rng=None)[source]
Bases:
Discrete
Discrete action/observation space for use in RL environments.
- class qgym.spaces.MultiBinary(n, *, rng=None)[source]
Bases:
MultiBinary
Multi-binary action/observation space for use in RL environments.
- class qgym.spaces.MultiDiscrete(nvec, dtype=<class 'numpy.int32'>, *, rng=None)[source]
Bases:
MultiDiscrete
Multi-discrete action/observation space for use in RL environments.
- __init__(nvec, dtype=<class 'numpy.int32'>, *, rng=None)[source]
Initialize a multi-discrete space, i.e., multiple discrete intervals of given sizes.
- Parameters:
nvec (
ArrayLike
) – Vector containing the upper bound of each discrete interval. The lower bound is always set to 0.dtype (
str
|type
[integer
[Any
]]) – Type of the values in each interval (default np.int64).rng (
Generator
|None
) – Random number generator to be used in this space, ifNone
a new random number generator will be constructed.