TorchLean API

NN.Widgets.RL.GridWorld

GridWorld Widgets #

This module provides small infoview widgets for TorchLean's Lean-native GridWorld environment (NN.Spec.RL.Envs.GridWorld):

These widgets do not run training loops; instead, they help you see the state-space objects that RL algorithms manipulate.

Main definitions #

Implementation notes #

References #

Tags #

rl, gridworld, policy, rollout, artifacts, proofwidgets

Renderers #

Render a GridWorld state as a grid with start/goal/current highlights.

Instances For

    Render a simple policy overlay π : State → Action on GridWorld.

    Instances For

      Render a before/after policy snapshot (loaded from disk) as two GridWorld policy panels.

      Instances For

        Render a rollout path (first-visit indices) on GridWorld.

        Instances For

          Render a before/after episode path snapshot (loaded from disk) as two GridWorld path panels.

          Instances For

            Commands #

            Render the GridWorld layout (and a highlighted position) in the infoview.

            Usage: #gridworld_view gw, gw.start

            Instances For

              Render a greedy-policy map for a GridWorld in the infoview.

              Usage: #gridworld_policy_view gw, policy, where policy is a flattened row-major array of action indices (0..3).

              Instances For

                Render a single episode path as a sequence of positions in the infoview.

                Usage: #gridworld_path_view gw, path, where path is an array of (row, col) positions.

                Instances For

                  Read a saved GridWorld greedy-policy snapshot (before vs after) from JSON and render it.

                  This is intended for executable examples or training jobs that write artifacts to disk, for example: lake exe torchlean ppo_gridworld.

                  The JSON schema matches Runtime.RL.Artifacts.GridWorld.PolicyDiff.

                  Instances For

                    Read a saved GridWorld episode path snapshot (before vs after) from JSON and render it.

                    This is intended for executable examples or training jobs that write artifacts to disk, for example: lake exe torchlean ppo_gridworld.

                    The JSON schema matches Runtime.RL.Artifacts.GridWorld.PathDiff.

                    Instances For