Skip to main content

ventisim

Gymnasium Environments for Reinforcement Learning in Mechanical Ventilation

Python 3.10+ License: MIT Tests PyPI

VentiSim provides standardized Gymnasium environments for developing and benchmarking reinforcement learning algorithms applied to mechanical ventilation management. The environments model lung mechanics, gas exchange, and PEEP-dependent alveolar recruitment with physiologically grounded parameters derived from the ARDS literature.

Installation

pip install ventisim

With training dependencies (stable-baselines3, PyTorch):

pip install ventisim[train]

Full development install:

pip install ventisim[all]

Quick Start

import gymnasium as gym
import ventisim  # registers environments

env = gym.make("ventisim/TidalVolumeControl-v0")
obs, info = env.reset(seed=42)

for step in range(200):
    action = env.action_space.sample()
    obs, reward, terminated, truncated, info = env.step(action)
    if terminated or truncated:
        obs, info = env.reset()

env.close()

Environments

Environment Paradigm Obs Dim Act Dim Key Challenge
ventisim/TidalVolumeControl-v0 Pressure control 7 1 Deliver target VT (6 mL/kg IBW) while keeping plateau < 30 cmH2O
ventisim/PEEPOptimization-v0 PEEP titration 8 1 Balance recruitment vs. overdistension for optimal PaO2
ventisim/FullVentilatorManagement-v0 Multi-parameter 10 4 Simultaneously optimize oxygenation, ventilation, and lung protection

All environments support three difficulty tiers (easy, medium, hard) controlling inter-patient variability, compliance drift, and measurement noise.

Architecture

Models Layer
  SingleCompartmentLung  -- RC-circuit lung mechanics (compliance, resistance)
  GasExchangeModel       -- Alveolar gas equation + shunt + PEEP recruitment
  VirtualPatient         -- ARDS severity profiles (Berlin definition)

Environments Layer (Gymnasium API)
  TidalVolumeControl-v0         -- 1D action: inspiratory pressure
  PEEPOptimization-v0           -- 1D action: PEEP change
  FullVentilatorManagement-v0   -- 4D action: FiO2, PEEP, RR, P_insp

Agents Layer
  Random                 -- Uniform random sampling (lower bound)
  Heuristic              -- Clinical protocol baselines (proportional control)
  PPO                    -- Proximal Policy Optimization via stable-baselines3

Training

Train all agents and generate results:

python train_all.py

Train a single environment:

ventisim-train --env ventisim/TidalVolumeControl-v0

Run benchmarks (random + heuristic):

ventisim-benchmark

Paper

If you use VentiSim in your research, please cite:

@software{dhia2026ventisim,
  author    = {Dhia, Hass},
  title     = {VentiSim: Gymnasium Environments for Reinforcement Learning
               in Mechanical Ventilation},
  year      = {2026},
  publisher = {Smart Technology Investments Research Institute},
  url       = {https://github.com/HassDhia/ventisim},
}

License

MIT License. See LICENSE for details.

Contact

Hass Dhia -- Smart Technology Investments Research Institute

partners@smarttechinvest.com

Metadata

Release files for ventisim 0.1.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 ventisim 0.1.0
File Size Uploaded Provenance
ventisim-0.1.0.tar.gz 31.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 57.9 kB

Release files / ventisim-0.1.0.tar.gz

Download URL ventisim-0.1.0.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c3a5fed81bdf40044e12b9629a333befb52668a80d07e0fd2ea5edf7f03484d3
BLAKE2b-256 checksum
How to use checksums
38b47471c5c3829ba1aa5dfdf1b5230aefb04378c862e1eb862ad96d86665742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / ventisim-0.1.0-py3-none-any.whl

Download URL ventisim-0.1.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ac8aa211d2ee9bcc689d808f90131f0f4da48895b8d5550853332d81ecad6ed
BLAKE2b-256 checksum
How to use checksums
ce09ca9a41edda69eee6c4939f22edd0af859af27ad14889334e0cb07110146a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Security for ventisim 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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