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:
BoxAn \(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
Boxspace, 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 anNDArraywith 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 anNDArraywith the shape given in shape with unique upper bounds for each interval.shape (
Sequence[int] |None) –Tuplecontaining the shape of theBoxspace.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, ifNonea new one will be constructed.
- class qgym.spaces.Dict(spaces=None, *, rng=None, **spaces_kwargs)[source]
Bases:
DictDictionary of other action/observation spaces for use in RL environments.
- __init__(spaces=None, *, rng=None, **spaces_kwargs)[source]
Initialize a
Dictspace, with string valued keys and spaces inheriting fromgym.Spaceas 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, ifNonea new one will be constructed.spaces_kwargs (
Space[Any]) – Spaces that are to form thisDictspace.
- class qgym.spaces.Discrete(n, start=0, *, rng=None)[source]
Bases:
DiscreteDiscrete action/observation space for use in RL environments.
- class qgym.spaces.MultiBinary(n, *, rng=None)[source]
Bases:
MultiBinaryMulti-binary action/observation space for use in RL environments.
- class qgym.spaces.MultiDiscrete(nvec, dtype=<class 'numpy.int32'>, *, rng=None)[source]
Bases:
MultiDiscreteMulti-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, ifNonea new random number generator will be constructed.