package fehu

  1. Overview
  2. Docs

Module Fehu_envsSource

Built-in reinforcement learning environments.

This module provides a collection of ready-to-use environments for testing algorithms, learning the Fehu API, and benchmarking. All environments follow the standard Fehu.Env interface and are fully compatible with wrappers, vectorization, and training utilities.

Available Environments

  • Random_walk: One-dimensional random walk with continuous state space
  • Grid_world: Two-dimensional grid navigation with discrete states and obstacles
  • Cartpole: Classic cart-pole balancing problem
  • Mountain_car: Drive up a steep hill using momentum

Usage

Create an environment with a Rune RNG key:

  let rng = Rune.Rng.create () in
  let env = Fehu_envs.Random_walk.make ~rng () in
  let obs, info = Fehu.Env.reset env ()

Environments support rendering for visualization:

  let env = Fehu_envs.Grid_world.make ~rng () in
  let obs, _ = Fehu.Env.reset env () in
  match Fehu.Env.render env with
  | Some output -> print_endline output
  | None -> ()

Environment Selection Guide

Use Random_walk for:

  • Testing continuous observation spaces
  • Debugging value-based algorithms
  • Quick prototyping with minimal complexity

Use Grid_world for:

  • Learning discrete state/action navigation
  • Testing path planning or exploration strategies
  • Demonstrating obstacle avoidance
Sourcemodule Random_walk : sig ... end

One-dimensional random walk environment.

Sourcemodule Grid_world : sig ... end

Two-dimensional grid world with goal and obstacles.

Sourcemodule Cartpole : sig ... end

Classic cart-pole balancing environment.

Sourcemodule Mountain_car : sig ... end

Mountain car environment - drive up a steep hill using momentum.