Skip to main content

Gymnasium environments for reinforcement learning in automated anesthesia drug dosing

Project description

AnestheSim

Gymnasium environments for reinforcement learning in automated anesthesia drug dosing

Python 3.10+ License: MIT Tests PyPI version


Three Gymnasium-compatible RL environments for automated anesthesia drug dosing: propofol infusion control via the Marsh three-compartment pharmacokinetic model with Hill pharmacodynamic BIS prediction, remifentanil effect-site concentration targeting via the Minto model, and combined propofol-remifentanil anesthesia management using the Greco synergistic interaction surface. Includes configurable difficulty tiers with patient variability and surgical stimulation events, heuristic TCI (Target-Controlled Infusion) clinical baselines, PPO RL agents, and a benchmark suite across three difficulty levels. 109 tests, MIT licensed.

Installation

pip install anesthesim              # Core (numpy, scipy, gymnasium)
pip install anesthesim[train]       # + SB3, PyTorch for RL training
pip install anesthesim[all]         # Everything

Development install:

git clone https://github.com/HassDhia/anesthesim.git
cd anesthesim
pip install -e ".[all]"

Quick Start

import gymnasium as gym
import anesthesim

env = gym.make("anesthesim/PropofolControl-v0")
obs, info = env.reset(seed=42)
for _ in range(100):
    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 Task Observation Action Key Challenge
PropofolControl-v0 BIS-guided propofol infusion Box(6): Cp, Ce, BIS, error, rate, time Box(1): rate [0,200] mcg/kg/min PK/PD delay, surgical stimulation
RemifentanilDosing-v0 Effect-site concentration targeting Box(6): Cp, Ce, target, error, rate, time Box(1): rate [0,0.5] mcg/kg/min Rapid onset/offset, changing targets
CombinedAnesthesia-v0 Multi-drug BIS control Box(8): 2x Cp, 2x Ce, BIS, error, 2x rate Box(2): propofol + remifentanil rates Drug synergy exploitation

Architecture

AnestheSim implements established pharmacokinetic/pharmacodynamic models:

  • Marsh PK Model (Marsh et al., 1991): Three-compartment model for propofol distribution
  • Minto PK Model (Minto et al., 1997): Three-compartment model for remifentanil with effect-site
  • Hill PD Model (Schnider et al., 1999): Sigmoid Emax model mapping propofol Ce to BIS
  • Greco Interaction Model (Bouillon et al., 2004): Response surface for propofol-remifentanil synergy

Paper

The accompanying paper is available at:

Citation

If you use anesthesim in your research, please cite:

@software{dhia2026anesthesim,
  author = {Dhia, Hass},
  title = {AnestheSim: Gymnasium Environments for Reinforcement Learning in Automated Anesthesia Drug Dosing},
  year = {2026},
  publisher = {Smart Technology Investments Research Institute},
  url = {https://github.com/HassDhia/anesthesim}
}

License

MIT License. See LICENSE for details.

Contact

Hass Dhia - Smart Technology Investments Research Institute

Project details


Download files

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

Source Distribution

anesthesim-0.1.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

anesthesim-0.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file anesthesim-0.1.0.tar.gz.

File metadata

  • Download URL: anesthesim-0.1.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for anesthesim-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6ab45e340cb8075523ed1a703c7d2b9a985b6c1a0ffda9773c74a4e461388a6
MD5 c946d77c2cd22e9d93836a9b6fa8e49a
BLAKE2b-256 94cdf7a5a7fdd63d6dc9f45f247adab5c112cc00ee3bfa8c5c5f812830d0bcce

See more details on using hashes here.

File details

Details for the file anesthesim-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anesthesim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for anesthesim-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bef8dcacc83a553791f9a1d9c181b4a3e5351726d8580d60a3a4ca811f9903da
MD5 2fae14c547ff8bb652f360791da91d11
BLAKE2b-256 5d7324d1115dac66c8aec6a25fa3aec428b62b0ca5a2770d1ab185eee283bf68

See more details on using hashes here.

Supported by

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