View Source Rein.Environment behaviour (rein v0.0.1)

Defines an environment to be passed to Rein.

Summary

Types

t()

An arbitrary Nx.Container that holds metadata for the environment

Callbacks

Applies the given action to the environment.

Initializes the environment state with the given environment-specific options.

The number of possible actions for the environment

Resets any values that aren't fixed for the environment state.

Types

@type rl_state() :: Rein.t()
@type t() :: Nx.Container.t()

An arbitrary Nx.Container that holds metadata for the environment

Callbacks

Link to this callback

apply_action(rl_state, action)

View Source
@callback apply_action(rl_state(), action :: Nx.t()) :: rl_state()

Applies the given action to the environment.

Returns the updated environment, also updated with the reward and a flag indicating whether the new state is terminal.

@callback init(random_key :: Nx.t(), opts :: keyword()) :: {t(), random_key :: Nx.t()}

Initializes the environment state with the given environment-specific options.

Also calls reset/2 in the end.

@callback num_actions() :: pos_integer()

The number of possible actions for the environment

Link to this callback

reset(random_key, environment_state)

View Source
@callback reset(random_key :: Nx.t(), environment_state :: t()) ::
  {t(), random_key :: Nx.t()}

Resets any values that aren't fixed for the environment state.