Skip to content

UmbrellaChain-bsuite

UmbrellaChain

UmbrellaChain(n_distractor: int = 0)

Bases: Environment[EnvState, EnvParams]

Decide at the first step whether to take an umbrella needed at the last.

JAX port of the bsuite UmbrellaChain environment, a test of credit assignment. Only the first action of an episode matters: it sets whether the agent carries the umbrella. The reward that depends on it arrives at the end of the chain, after random rewards that are unrelated to the actions. Each reset samples need_umbrella and the initial has_umbrella with probability 0.5 each.

  • Observation: Box of shape (3 + n_distractor,) with need_umbrella, has_umbrella, the remaining time 1 - time / params.chain_length and n_distractor random bits that are resampled at every step.
  • Actions: Discrete(2). The first action of the episode sets has_umbrella, later actions are ignored.
  • Reward: on the last step, 1 if has_umbrella equals need_umbrella and -1 otherwise. On all other steps, 1 or -1 with equal probability.
  • Termination: after params.chain_length steps (10 by default).
  • Truncation: after params.max_steps_in_episode steps (100 by default).

Parameters:

  • n_distractor (int, default: 0 ) –

    Number of random distractor bits appended to the observation.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the UmbrellaChain environment.

Attributes:

  • chain_length (int) –

    Number of steps in an episode.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the UmbrellaChain environment.

Attributes:

  • need_umbrella (int) –

    Whether the umbrella is needed at the end of the chain, 0 or 1.

  • has_umbrella (int) –

    Whether the agent carries the umbrella, 0 or 1. Sampled at reset and overwritten by the first action of the episode.

  • total_regret (int) –

    Regret of the current episode. A wrong umbrella choice adds 2 on the last step.

  • time (int) –

    Number of steps taken in the current episode.