This release is a pre-release and may not be stable for production use.
GymChem
English | 中文
Gymnasium-compatible simulation environments for chemical process optimization and data-driven analysis — from a minimal CSTR to industrial-scale benchmarks.
Why GymChem
Chemical process optimization research is fragmented: pyTEP is a simulator only, IDAES is powerful but steep, and ChemGymRL targets lab operations rather than industrial processes. GymChem unifies these scenarios behind a standard Gymnasium API — consistent state/action/reward design, fully traceable parameters, reproducible baselines and leaderboards, plus datasets and data-analysis tutorials. For researchers it is a ready-to-use benchmark platform; for students it is a friendly on-ramp to RL for chemical engineering.
Environments
| Environment | State | Action | Reward | Status |
|---|---|---|---|---|
CSTRSimpleEnv |
Reactor temperature (K) | Heating/cooling rate (K/s) | -abs(T - T_target) |
stable |
CSTREnv |
T (K), C_A (mol/m³), cooling-water T (K) | Cooling-water temperature rate (K/s) | -abs(T - T*) - 0.05 * abs(C_A - C_A*) |
alpha |
CSTREnv models a continuous stirred-tank reactor with a first-order exothermic reaction A → B: species balance, energy balance with Arrhenius kinetics, a cooling-water jacket, and a conservation-checked explicit-Euler integrator.
Install
# from source
git clone https://github.com/guyuan0710/gymchem.git
cd gymchem
pip install -e ".[dev]"
# once published on PyPI
pip install gymchem
Quick start
from gymchem.envs.cstr import CSTREnv, CSTRSimpleEnv
# v0.1: exothermic A→B CSTR — temperature + concentration + jacket
env = CSTREnv()
obs, info = env.reset(seed=0)
for _ in range(100):
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
if terminated or truncated:
break
# v0.0: minimal temperature tracking
env = CSTRSimpleEnv()
obs, info = env.reset(seed=0)
Test
pip install -e ".[dev]"
pytest # 17 tests: env_checker, no-NaN runs, conservation residuals, data pipeline
ruff check . # zero warnings
Data validation
Automated detection, validation, and update-maintenance for research/experimental data
(gymchem.data, no new dependencies):
python -m gymchem.data data/demo_cstr_trajectory.csv \
--manifest data/manifest.json --sidecar data/demo_meta.json \
--report data/demo_report.md
See docs/data-validation.md for the full workflow.
Docs & examples
- Parameter provenance (CSTR) — every physical constant traced to a source
- Data validation (detect / verify / maintain)
- Colab-ready notebook
- 中文说明
License
MIT © GymChem contributors
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gymchem-0.1.0a1.tar.gz.
File metadata
- Download URL: gymchem-0.1.0a1.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7bfbfc7d433ad766af047b69cd09760fbcfc6cd3f10f0ed42d8ad5f750d0d8b
|
|
| MD5 |
e53aff4f1fca869a38cf6aa49d14d45d
|
|
| BLAKE2b-256 |
efe739e05cc044c8a534c58795d172834f3435b0db993ad34e070ebe07e56fcf
|
File details
Details for the file gymchem-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: gymchem-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d973179de8953beb26a0052548a3fb3c5db08097015e4b6eaf834356b875ec83
|
|
| MD5 |
048313436827093067330b3b42defb69
|
|
| BLAKE2b-256 |
b2c442f630b097f3af2d4b8da101bc4d8e6d8fa3e08b5913fbc70f8d87281e5d
|