Skip to content

EnvironmentState ​

python
EnvironmentState(n_step: int, gamma: float, action_shape: int, state: np.ndarray | None = None, action: int = 0, episode_reward: float = 0.0, episode_length: int = 0, trajectory_session: ActiveTrajectorySession = ActiveTrajectorySession.normal()) -> None

State tracked per-environment in the Trainer.

Source

Methods ​

reset ​

python
reset(observation: np.ndarray | None, trajectory_session: ActiveTrajectorySession | None = None) -> None

Reset the environment state for a new episode.

Parameters:

  • observation (ndarray | None) – The initial observation, if needed for the next step plan.
  • trajectory_session (ActiveTrajectorySession | None) – The trajectory source state for the new episode, or None for a normal episode.

Source

Values ​

action ​

python
action: int = 0

Last action taken.

Source

action_counts ​

python
action_counts: np.ndarray = field(init=False, repr=False)

Count of each action taken in the current episode.

Source

action_shape ​

python
action_shape: int

Number of possible actions.

Source

episode_length ​

python
episode_length: int = 0

Number of steps in the current episode.

Source

episode_reward ​

python
episode_reward: float = 0.0

Cumulative reward for the current episode.

Source

gamma ​

python
gamma: float

Discount factor.

Source

n_step ​

python
n_step: int

Number of steps for the n-step buffer.

Source

n_step_buffer ​

python
n_step_buffer: NStepBuffer = field(init=False, repr=False)

Buffer for computing n-step returns.

Source

state ​

python
state: np.ndarray | None = field(default=None, repr=False)

Current state observation.

Source

trajectory_session ​

python
trajectory_session: ActiveTrajectorySession = field(default_factory=ActiveTrajectorySession.normal, repr=False)

Trajectory source state for the current episode.

Source