Skip to content

MultiEnvResult ​

python
MultiEnvResult(environment_id: int, is_reset: bool, is_step: bool = False, is_random: bool = False, is_replay: bool = False, observation: np.ndarray | None = None, reward: float | None = None, terminated: bool = False, truncated: bool = False, is_win: bool = False, data: dict[str, Any] | None = None, steps_taken: int = 0, trajectory: Trajectory | None = None, replay_observations: list[np.ndarray] | None = None) -> None

Result from a single environment within a MultiEnv.

Initialize the MultiEnvResult.

Parameters:

  • environment_id (int) – The ID of the environment.
  • is_reset (bool) – Whether this is a reset result.
  • is_step (bool) – Whether this is a normal single-step result.
  • is_random (bool) – Whether this is a one-shot random exploration result.
  • is_replay (bool) – Whether this is a one-shot replay result.
  • observation (ndarray | None) – The resulting observation.
  • reward (float | None) – The reward received (None if reset).
  • terminated (bool) – Whether the environment terminated.
  • truncated (bool) – Whether the environment was truncated.
  • is_win (bool) – Whether the episode resulted in a win.
  • data (dict[str, Any] | None) – Optional data returned on episode completion (terminated or truncated).
  • steps_taken (int) – The number of environment steps executed for this result.
  • trajectory (Trajectory | None) – Optional trajectory produced by a random exploration result.
  • replay_observations (list[ndarray] | None) – Optional replay observations for a one-shot replay result.

Source

Properties ​

data ​

python
data: dict[str, Any]

Get the data returned on episode completion.

Returns:

  • dict[str, Any] – A dictionary of string keys to values. Empty if no data was returned.

Source

environment_id ​

python
environment_id: int

The ID of the environment that produced this result.

Source

is_random ​

python
is_random: bool

True when this result comes from one-shot random exploration.

Source

is_replay ​

python
is_replay: bool

True when this result comes from one-shot replay execution.

Source

is_reset ​

python
is_reset: bool

True if this result is a reset result, False if it is a step result. If it is a reset result, then observation will contain the initial observation. If it is a step result, then observation will be the observation after the step and reward, terminated, and truncated will be available.

Source

is_step ​

python
is_step: bool

True when this result comes from one normal queued step.

Source

is_win ​

python
is_win: bool

Gets whether the terminated episode resulted in a win.

Raises:

  • ValueError – If called on a reset result or a step result with terminated=False.

Source

observation ​

python
observation: np.ndarray

Get the observation.

Returns:

  • ndarray – The observation as a numpy array.

Source

outcome ​

python
outcome: EpisodeOutcome | None

Get the episode outcome, if this result completes an episode.

Returns:

  • EpisodeOutcome | None – The outcome, or None if this result does not represent a completed episode (a reset, or a non-terminal, non-truncated step).

Source

replay_observations ​

python
replay_observations: list[np.ndarray]

Get replay observations captured for a one-shot replay result.

Returns:

  • list[ndarray] – The replay observations as numpy arrays.

Source

reward ​

python
reward: float

Get the reward.

Returns:

  • float – The reward value.

Raises:

  • ValueError – If called on a reset result.

Source

steps_taken ​

python
steps_taken: int

Get the number of environment steps executed to produce this result.

Returns:

  • int – The number of executed steps.

Source

terminated ​

python
terminated: bool

Get the terminated flag.

Returns:

  • bool – True if terminated, False otherwise.

Raises:

  • ValueError – If called on a reset result.

Source

trajectory ​

python
trajectory: Trajectory | None

Get the episode trajectory returned for this result.

Returns:

  • Trajectory | None – The trajectory, if one was returned.

Source

truncated ​

python
truncated: bool

Get the truncated flag.

Returns:

  • bool – True if truncated, False otherwise.

Raises:

  • ValueError – If called on a reset result.

Source