bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
value_gif Namespace Reference

Functions

 read_sweeps (path)
 greedy_actions (P, V, gamma)
 draw (desc, V, actions, title, vmax)
 main ()

Variables

dict ARROWS = {0: (-0.3, 0), 1: (0, 0.3), 2: (0.3, 0), 3: (0, -0.3)}

Detailed Description

Make a GIF of a value function converging on FrozenLake.

The dynamic programming examples write sweeps.csv: a row for every sweep, the
sweep and then the value of every state. This script draws every sweep as the
lake, coloured by the value of its cells, with the value written in each cell
and an arrow for the greedy action, the one with the largest expected
r + gamma V(s') under FrozenLake's own transition model.

Usage:
  python value_gif.py sweeps.csv --out value_iteration.gif --title "Value iteration" [--slippery] [--gamma 0.99]
      [--step iteration]

Needs gymnasium, matplotlib and imageio.

Function Documentation

◆ draw()

value_gif.draw ( desc,
V,
actions,
title,
vmax )

◆ greedy_actions()

value_gif.greedy_actions ( P,
V,
gamma )

◆ main()

value_gif.main ( )

◆ read_sweeps()

value_gif.read_sweeps ( path)

Variable Documentation

◆ ARROWS

dict value_gif.ARROWS = {0: (-0.3, 0), 1: (0, 0.3), 2: (0.3, 0), 3: (0, -0.3)}