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:
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 from gym.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 form

  • space. (this Dict)

  • rng (Generator | None) – Random number generator to be used in this space, if None a new one will be constructed.

  • spaces_kwargs (Space[Any]) – Spaces that are to form this Dict space.

class qgym.spaces.Discrete(n, start=0, *, rng=None)[source]

Bases: Discrete

Discrete action/observation space for use in RL environments.

__init__(n, start=0, *, rng=None)[source]

Initialize a Discrete space, i.e., a range of integers.

Parameters:
  • n (int) – The number of integer values in the Discrete space.

  • start (int) – The smallest element is the Discrete Space.

  • rng (Generator | None) – Random number generator to be used in this space, if None a new random number generator will be constructed.

class qgym.spaces.MultiBinary(n, *, rng=None)[source]

Bases: MultiBinary

Multi-binary action/observation space for use in RL environments.

__init__(n, *, rng=None)[source]

Initialize a multi-discrete space, i.e., multiple discrete intervals of given sizes.

Parameters:
  • n (ArrayLike) – ArrayLike containing integers representing the number of elements in the space.

  • rng (Generator | None) – Random number generator to be used in this space. If None, a new random number generator will be constructed.

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, if None a new random number generator will be constructed.