Skip to main content

Reinforcement learning suite of process control problems.

Project description


Reinforcement learning environments for process control

Quick start ⚡

Setup a CSTR environment with a setpoint change

import pcgym

# Simulation variables
nsteps = 100
T = 25

# Setpoint
SP = {'Ca': [0.85 for i in range(int(nsteps/2))] + [0.9 for i in range(int(nsteps/2))]} 

# Action and observation Space
action_space = {'low': np.array([295]), 'high': np.array([302])}
observation_space = {'low': np.array([0.7,300,0.8]),'high': np.array([1,350,0.9])}

# Construct the environment parameter dictionary
env_params = {
    'N': nsteps, # Number of time steps
    'tsim':T, # Simulation Time
    'SP' :SP, 
    'o_space' : observation_space, 
    'a_space' : action_space, 
    'x0': np.array([0.8, 330, 0.8]), # Initial conditions [Ca, T, Ca_SP]
    'model': 'cstr_ode', # Select the model
}

# Create environment
env = pcgym.make_env(env_params)

# Reset the environment
obs, state = env.reset()

# Sample a random action
action = env.action_space.sample()

# Perform a step in the environment
obs, rew, done, term, info = env.step(action)

Documentation

You can read the full documentation here!

Installation ⏳

The latest pc-gym version can be installed from PyPI:

pip install pcgym

Examples

Example notebooks with training walkthroughs, implementing constraints, disturbances and the policy evaluation tool can be found here.

Implemented Process Control Environments 🎛️

Environment Reference Source Documentation
CSTR Hedengren, 2022 Source
First Order Sytem N/A Source
Multistage Extraction Column Ingham et al, 2007 (pg 471) Source
Nonsmooth Control Lim,1969 Source

Paper 📚

The associated pre-print paper can be found here. If you use our software in your work please cite the following:

@article{bloor2024pcgymbenchmarkenvironmentsprocess,
      title={PC-Gym: Benchmark Environments For Process Control Problems}, 
      author={Maximilian Bloor and José Torraca and Ilya Orson Sandoval and Akhil Ahmed and Martha White and Mehmet Mercangöz and Calvin Tsay and Ehecatl Antonio Del Rio Chanona and Max Mowbray},
      year={2024},
      eprint={2410.22093},
      archivePrefix={arXiv},
      primaryClass={eess.SY},
      url={https://arxiv.org/abs/2410.22093}, 
}

Other Great Gyms 🔍

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

pcgym-0.1.7.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

pcgym-0.1.7-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file pcgym-0.1.7.tar.gz.

File metadata

  • Download URL: pcgym-0.1.7.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pcgym-0.1.7.tar.gz
Algorithm Hash digest
SHA256 d89c691f1c77070327183d24d4bc72b536613222c22ab517c7cbc8b6ac7913e7
MD5 39a4ea906f331f152099074041875569
BLAKE2b-256 dbc479cf8e00406ac927abefac140b066a43dc675075449ec5289c6edfeff170

See more details on using hashes here.

File details

Details for the file pcgym-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pcgym-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pcgym-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd7edcafed4f406dfd1100aef2289b8d5f3ad6a294f999b59f03e070aae074c
MD5 e6f22c3c4948ea0995e534b247e4e5dd
BLAKE2b-256 5dfdf5ad688e631193421dc0cd4f4e9468a35d9bd1f5c13e133a1085babbadfb

See more details on using hashes here.

Supported by

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