MultiEnvResult
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) -> NoneResult 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.
Properties
data
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.
environment_id
environment_id: intThe ID of the environment that produced this result.
is_random
is_random: boolTrue when this result comes from one-shot random exploration.
is_replay
is_replay: boolTrue when this result comes from one-shot replay execution.
is_reset
is_reset: boolTrue 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.
is_step
is_step: boolTrue when this result comes from one normal queued step.
is_win
is_win: boolGets whether the terminated episode resulted in a win.
Raises:
ValueError– If called on a reset result or a step result with terminated=False.
observation
observation: np.ndarrayGet the observation.
Returns:
ndarray– The observation as a numpy array.
outcome
outcome: EpisodeOutcome | NoneGet 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).
replay_observations
replay_observations: list[np.ndarray]Get replay observations captured for a one-shot replay result.
Returns:
list[ndarray]– The replay observations as numpy arrays.
reward
reward: floatGet the reward.
Returns:
float– The reward value.
Raises:
ValueError– If called on a reset result.
steps_taken
steps_taken: intGet the number of environment steps executed to produce this result.
Returns:
int– The number of executed steps.
terminated
terminated: boolGet the terminated flag.
Returns:
bool– True if terminated, False otherwise.
Raises:
ValueError– If called on a reset result.
trajectory
trajectory: Trajectory | NoneGet the episode trajectory returned for this result.
Returns:
Trajectory | None– The trajectory, if one was returned.
truncated
truncated: boolGet the truncated flag.
Returns:
bool– True if truncated, False otherwise.
Raises:
ValueError– If called on a reset result.