UmbrellaChain-bsuite¶
UmbrellaChain ¶
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:
Boxof shape(3 + n_distractor,)withneed_umbrella,has_umbrella, the remaining time1 - time / params.chain_lengthandn_distractorrandom bits that are resampled at every step. - Actions:
Discrete(2). The first action of the episode setshas_umbrella, later actions are ignored. - Reward: on the last step, 1 if
has_umbrellaequalsneed_umbrellaand -1 otherwise. On all other steps, 1 or -1 with equal probability. - Termination: after
params.chain_lengthsteps (10 by default). - Truncation: after
params.max_steps_in_episodesteps (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.