Skip to content

FrozenLake-misc

FrozenLake

FrozenLake(desc: Sequence[str] | None = None, map_name: str | None = '4x4', is_slippery: bool = True, success_rate: float = 1.0 / 3.0, reward_schedule: Sequence[float] = (1.0, 0.0, 0.0))

Bases: Environment[EnvState, EnvParams]

Cross a frozen lake from the start tile to the goal without falling in.

JAX port of the Gymnasium FrozenLake environment with compatible maps, dynamics and rewards. The map is a grid of start (S), frozen (F), hole (H) and goal (G) tiles, and every episode starts on the start tile. Moves off the grid leave the position unchanged. If is_slippery, the agent moves in the chosen direction with probability success_rate and otherwise in one of the two perpendicular directions with equal probability. The probability of the executed move is returned as info["p"].

  • Observation: Discrete(nrow * ncol). The row-major index of the agent's tile, row * ncol + col.
  • Actions: Discrete(4). 0 moves left, 1 down, 2 right and 3 up.
  • Reward: given by reward_schedule for the tile the agent lands on. By default 1 for the goal and 0 for all other tiles.
  • Termination: the agent lands on a hole or the goal.
  • Truncation: after params.max_steps_in_episode steps (by default 200 for 8 x 8 maps and 100 otherwise).

Parameters:

  • desc (Sequence[str] | None, default: None ) –

    Custom map as a sequence of equally long row strings made of the tiles S, F, H and G, with exactly one S and one G. If None, the map is selected by map_name.

  • map_name (str | None, default: '4x4' ) –

    Name of the built-in map, "4x4" or "8x8". Only used if desc is None.

  • is_slippery (bool, default: True ) –

    Whether moves are stochastic.

  • success_rate (float, default: 1.0 / 3.0 ) –

    Probability of moving in the chosen direction if is_slippery. Must be in [0, 1].

  • reward_schedule (Sequence[float], default: (1.0, 0.0, 0.0) ) –

    Rewards for landing on a goal, a hole and any other tile, in that order.

References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the FrozenLake environment.

Attributes:

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the FrozenLake environment.

Attributes:

  • position (Array) –

    Row-major index of the agent's tile, row * ncol + col.

  • time (int) –

    Number of steps taken in the current episode.