Skip to main content

ProcGrid Traffic Gym (PGTG)

PyPI Tests Docs License

Procedurally Generated Grid-Based Traffic Gym (PGTG), a feature-rich, extensible, and customizable reinforcement learning benchmark. PGTG requires an agent to navigate procedurally generated tracks while having to manage momentum and being exposed to various stochastic obstacles and the unpredictable behaviour of traffic participants. It provides fine-grained control over the map generation, traffic rules, obstacles, and the observation and reward functions. It is fully compatible with the Gymnasium API standard.

Getting Started

Installation

Requires Python 3.11, 3.12, or 3.13. PGTG is available on PyPi and can be installed with all major package managers:

pip install pgtg

For development from source, the repository uses mise and uv:

mise run install # create the .venv and install ".[all]"
mise run test    # run the test suite
mise run docs    # build the docs (add --serve for live preview)

Or manually with uv/pip:

uv venv && uv pip install -e ".[all]"

Usage

The easiest way to use PGTG is to create the environment with gymnasium:

import gymnasium as gym

env = gym.make("pgtg-v5")

The package relies on import side-effects to register the environment name so, even though the package is never explicitly used, its import is necessary to access the environment.

The environment constructor can also be used directly:

from pgtg import PGTGEnv

env = PGTGEnv()

Examples

The examples/ directory ships runnable marimo notebooks — an interactive playground, two Stable-Baselines3 training scripts (MLP and a custom CNN feature extractor), and a statistical evaluation with PyDSMC. Each is both a notebook and a CLI script and needs no setup:

uvx marimo edit --sandbox examples/explore_pgtg.py # click around
uv run --script examples/train_mlp_sb3.py          # train an agent

See examples/README.md for the full list.

Documentation

Full documentation is available at https://neuro-mechanistic-modeling.github.io/pgtg/:

  1. Getting Started
  2. Configuration Reference
  3. Extending PGTG

Citation

If you use PGTG in your research, please cite the accompanying paper (RLC 2026); see the Citation:

@article{meyer2026pgtg,
  title   = {{PGTG}: Procedurally Generated Grid-Based Traffic Gym},
  author  = {Meyer, Joshua and Kuntz, Felix M. and Wolf, Verena and
             Hoffmann, J{\"o}rg and Gros, Timo P.},
  journal = {Reinforcement Learning Journal},
  year    = {2026},
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgtg-0.6.0.tar.gz (95.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgtg-0.6.0-py3-none-any.whl (108.2 kB view details)

Uploaded Python 3

File details

Details for the file pgtg-0.6.0.tar.gz.

File metadata

  • Download URL: pgtg-0.6.0.tar.gz
  • Upload date:
  • Size: 95.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pgtg-0.6.0.tar.gz
Algorithm Hash digest
SHA256 6bd69b7602bcdda3227275311a0e5921aabd2afd32804e40b500a6157e803fe1
MD5 ff6820174551ad36770cd549c4faa4f1
BLAKE2b-256 09b6c2f471739a08605cb5ca9f2bb3fe986e7f16d4b45e50a34b03b44f134d6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgtg-0.6.0.tar.gz:

Publisher: publish.yml on neuro-mechanistic-modeling/pgtg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pgtg-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: pgtg-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 108.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pgtg-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 889ea4ac5820ef1e672d2a4e052d561bbbc158fda9f1489f825863e32774aac6
MD5 6c582be33bfbc25c7f50d67f5db4bcf9
BLAKE2b-256 306168192304fa9b4ea84d8df4f22df23594d756911d91062890323e066026c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pgtg-0.6.0-py3-none-any.whl:

Publisher: publish.yml on neuro-mechanistic-modeling/pgtg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page