evorl.envs.space

Module Contents

Classes

Box

Continuous space in R^n.

Discrete

Discrete space in {0, 1, …, n-1}.

Space

Base class for Space like gym.Space.

SpaceContainer

Container for structural spaces.

Functions

API

class evorl.envs.space.Box[source]

Bases: evorl.envs.space.Space

Continuous space in R^n.

Variables:
  • low – The lower bounds of the box.

  • high – The upper bounds of the box.

contains(x: chex.Array) chex.Array[source]
high: chex.Array

None

low: chex.Array

None

sample(key: chex.PRNGKey) chex.Array[source]
property shape: chex.Shape
class evorl.envs.space.Discrete[source]

Bases: evorl.envs.space.Space

Discrete space in {0, 1, …, n-1}.

Variables:

n – The number of discrete values.

contains(x: chex.Array) chex.Array[source]
n: int

None

sample(key: chex.PRNGKey) chex.Array[source]
property shape: chex.Shape
class evorl.envs.space.Space[source]

Bases: evorl.types.PyTreeData

Base class for Space like gym.Space.

abstract contains(x: chex.Array) bool[source]

Determine whether the input is in the space.

Returns:

A boolean value about whether x is in the space.

abstract sample(key: chex.PRNGKey) chex.Array[source]

Randomly sample a data in this space.

Returns:

A sample from the space

abstract property shape: chex.Shape

Get the shape of the space.

class evorl.envs.space.SpaceContainer[source]

Bases: evorl.envs.space.Space

Container for structural spaces.

Variables:

spaces – a pytree of spaces.

contains(data: chex.ArrayTree) chex.ArrayTree[source]
sample(key: chex.PRNGKey) chex.ArrayTree[source]
property shape: chex.ArrayTree
spaces: chex.ArrayTree

None

evorl.envs.space.is_leaf_space(space)[source]