Skip to content

Spaces

Bases: Space

Create a continuous space with a given shape, minimum and maximum values.

Parameters:

Name Type Description Default
shape Shape

The shape of the space.

required
minimum Array

The minimum value of the space.

required
maximum Array

The maximum value of the space.

required
dtype dtype

The data type of the space.

float32

Returns:

Name Type Description
Continuous Continuous

A continuous space with the given shape, minimum and maximum values.

Generate a random sample from the space.

Parameters:

Name Type Description Default
key Array

A random key to generate the sample.

required

Returns:

Name Type Description
Array Array

A random sample from the space.

Bases: Space

The number of elements in the space.

Returns:

Name Type Description
Array Array

The number of elements in the space.

Create a discrete space with a given number of elements.

Parameters:

Name Type Description Default
n_elements int | Array

The number of elements in the space.

required
shape Shape

The shape of the space.

()
dtype dtype

The data type of the space.

int32

Returns:

Name Type Description
Discrete Discrete

A discrete space with the given number of elements.

Generate a random sample from the space.

Parameters:

Name Type Description Default
key Array

A random key to generate the sample.

required

Returns:

Name Type Description
Array Array

A random sample from the space.

Bases: PyTreeNode

Base class for all spaces in the game. Spaces define the shape and type of the observations, actions and rewards in the game. The sample method is used to generate random samples from the space.

Note

To initialize a space, use the create method of the specific space class.

TODO
  • maximum and minimum should be static objects, not arrays.

But how do we handle the case when they are not scalars? Maybe numpy arrays?

Generate a random sample from the space.

Parameters:

Name Type Description Default
key Array

A random key to generate the sample.

required

Returns:

Name Type Description
Array Array

A random sample from the space.