Skip to main content

PyPI Python Versions License: BSD-3-Clause Code Style: Black Linter: Ruff CircleCI

bettermdptools reinforcement learning gridworld

bettermdptools provides classic planning and tabular reinforcement learning algorithms for Gymnasium environments.

  • Planning: value iteration and policy iteration
  • Reinforcement learning: Q-learning and SARSA
  • Environments: discrete and discretized Gymnasium environments
  • Experimentation: reusable experiment, plotting, and optional Optuna utilities

Installation

bettermdptools supports Python 3.10 through 3.12.

pip install bettermdptools

Install the optional Optuna integration with:

pip install "bettermdptools[optuna]"

Quick Start

The transition model for Gymnasium's built-in discrete environments is stored on the unwrapped environment:

import gymnasium as gym

from bettermdptools.algorithms.planner import Planner
from bettermdptools.utils.plots import Plots

env = gym.make("FrozenLake8x8-v1", render_mode=None)

V, V_track, pi = Planner(env.unwrapped.P).value_iteration(gamma=0.99)

Plots.values_heat_map(V, title="State Values", size=(8, 8))

env.close()

bettermdptools wrappers expose generated tabular models through their own .P property. The Blackjack wrapper uses a context-aware exact representation. CartPole, Acrobot, and Pendulum use discretized models.

Documentation

User-facing examples and tutorials are available in the examples/ directory.

High-level experiment and optional Optuna APIs are documented in:

The generated Python API reference is built from the package docstrings.

Development

Poetry is the source of truth for dependencies, builds, and documentation tooling:

poetry install --with docs
poetry run pytest -q
poetry run ruff check .
poetry run black --check .
poetry run pdoc bettermdptools -o docs

See CONTRIBUTING.md for the complete contributor workflow.

License

bettermdptools is distributed under the BSD 3-Clause License. See LICENSE.

Metadata

Release files for bettermdptools 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bettermdptools 0.9.0
File Size Uploaded Provenance Actions
bettermdptools-0.9.0.tar.gz 35.2 kB Without provenance Details for bettermdptools-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bettermdptools 0.9.0
File Interpreter ABI Platform Actions
bettermdptools-0.9.0-py3-none-any.whl Python 3 none any Details for bettermdptools-0.9.0-py3-none-any.whl

Total release size: 81.0 kB

Release files / bettermdptools-0.9.0.tar.gz

Download URL bettermdptools-0.9.0.tar.gz
Size 35.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3bd96ea1b0743f58824fc14da2065de38470e7a6c045b336e274009bdba79c8b
BLAKE2b-256 checksum
How to use checksums
5b9cf5af5fcfc797d7b34295cbf20b074a1a9cc333405bb70c60bf660128950c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.9 Darwin/25.6.0

Release files / bettermdptools-0.9.0-py3-none-any.whl

Download URL bettermdptools-0.9.0-py3-none-any.whl
Size 45.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
595e3676388d3b5a3ec513c0afe849126fd8fac4987134052688b74fbacc87a6
BLAKE2b-256 checksum
How to use checksums
7db901c54be77a08826cd41d5b4d3c3b959693ada0fbe790dbca1333066ddffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.9 Darwin/25.6.0

Security for bettermdptools 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page