Skip to content

DiscountingChain-bsuite

DiscountingChain

DiscountingChain(n_actions: int = 5, mapping_seed: int = 0)

Bases: Environment[EnvState, EnvParams]

Choose between chains that pay their reward after different delays.

JAX port of the bsuite DiscountingChain environment. The first action of an episode selects one of n_actions chains and all later actions are ignored. Each chain pays a single reward after its own delay, which tests how an agent values rewards that arrive at different times. Resets are deterministic.

  • Observation: Box of shape (2,) with the index of the selected chain (-1 before the first step) and the fraction time / params.max_steps_in_episode of the episode that has elapsed.
  • Actions: Discrete(n_actions). The first action selects the chain.
  • Reward: the reward of the selected chain at step params.reward_timestep[chain], 0 on all other steps. The chain with index mapping_seed pays params.optimal_return (1.1 by default), all others 1.
  • Termination: never.
  • Truncation: after params.max_steps_in_episode steps (100 by default).

Parameters:

  • n_actions (int, default: 5 ) –

    Number of actions and chains. params.reward_timestep needs one entry per action; the default has 5.

  • mapping_seed (int, default: 0 ) –

    Index of the chain that pays params.optimal_return.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the DiscountingChain environment.

Attributes:

  • reward_timestep (Array) –

    Step at which each chain pays its reward, one entry per action.

  • optimal_return (float) –

    Reward paid by the chain with index mapping_seed. All other chains pay 1.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the DiscountingChain environment.

Attributes:

  • rewards (Array) –

    Reward paid by each chain, shape (n_actions,).

  • context (Array) –

    Index of the chain selected by the first action of the episode, -1 before the first step.

  • time (int) –

    Number of steps taken in the current episode.