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

TODO: Link example notebooks 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

Citing pc-gym

If you use pc-gym in your research, please cite using the following

@software{pcgym2024,
  author = {Max Bloor and and Jose Neto and Ilya Sandoval and Max Mowbray and Akhil Ahmed and Mehmet Mercangoz and Calvin Tsay and Antonio Del Rio-Chanona},
  title = {{pc-gym}: Reinforcement Learning Envionments for Process Control},
  url = {https://github.com/MaximilianB2/pc-gym},
  version = {0.0.4},
  year = {2024},
}

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.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

pcgym-0.1.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pcgym-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7cc38c57aac148ec5bcf72a7d1c429435abbbdfc18269a42be4b065ed193127f
MD5 f4ac6f330f0bc4cf8aea4ecd0651580f
BLAKE2b-256 58358c70b458e331cf0d28b499820a2c3b762796d9c2274dd2a2ce633257e49a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pcgym-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 491292a53ae23126c0f27b528ff6cfdd02d5601a034aa415018633521ca7d146
MD5 0e0dc24dbcd7995e6ec44d2cb42af2a9
BLAKE2b-256 408dc31598fac97a3bbecf46dfb50c4b244fa9890356ece8f7ff03067c6211f3

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