Skip to main content

Gym(nasium) Interface for LQR-Family Problems

Project description

Gym Interface for LQR-Family Problems

Gym-LQR is a one-stop shop for data-driven LQR research.

Gym-LQR creates a discrete-time LQR environment from a subset of COMPleib problems. Currently supported systems:

  • HEx - Helicopter models
  • REAx - Reactor models
  • DISx - Decentralized interconnected systems
  • TG1 - 1072 MVA nuclear-powered turbo-generator
  • AGS - Automobile gas turbine
  • BDT1 - Realistic model of binary distillation tower
  • MFP - Moored floating platform
  • UWV - Control surface servo for underwater vehicle
  • EBx - Euler-Bernoulli beam
  • PAS - Piezoelectric bimorph actuator system design
  • TF - Terrain following model
  • PSM - Two-area interconnected power system
  • NNx - Academic test problems
  • DLRx - Models of space structure
  • ROCx - Reduced order control problems

Installation

pip install gym-lqr

Requires Python 3.10+.

Basic Usage

Single-agent (Centralized LQR)

Single-agent interface follows a familiar Gymnasium (ex- OpenAI Gym) gymnasium>=0.26 API.

import gymnasium as gym
# Register the LQR environment
import gym_lqr

# Create a Linear HE1 helicopter model from the COMPleib example set
# Discretize at a sampling rate of dt=0.1
env = gym.make('LQR-v0', env_id='HE1', dt=0.1)

# Fix the random seed for reproducibility
env.action_space.seed(1337)

# Reset the environment to generate the first observation
observation, info = env.reset(seed=1337)
for _ in range(100):
    # this is where you would insert your policy
    action = env.action_space.sample()

    # step (transition) through the environment with the action
    # receiving the next observation, reward and if the episode has terminated or truncated
    observation, reward, terminated, truncated, info = env.step(action)

    # If the episode has ended then we can reset to start a new episode
    if terminated or truncated:
        observation, info = env.reset()

env.close()

Multi-agent (Distributed LQR)

In development.

Future Releases

  • Support for more COMPleib problems.
  • Multi-agent (Distributed LQR) interface based on the PettingZoo API.

References

  1. Gymnasium - an API standard for reinforcement learning with a diverse collection of reference environments. Web: https://gymnasium.farama.org/index.html
  2. COMPleib: COnstraint Matrix-optimization Problem library. Web: http://www.complib.de/
  3. "Predictive Control for Linear and Hybrid Systems" by Francesco Borrelli, Alberto Bemporad, Manfred Morari (2017). Web: http://cse.lab.imtlucca.it/~bemporad/publications/papers/BBMbook.pdf

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

gym_lqr-0.0.2.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

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

gym_lqr-0.0.2-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file gym_lqr-0.0.2.tar.gz.

File metadata

  • Download URL: gym_lqr-0.0.2.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for gym_lqr-0.0.2.tar.gz
Algorithm Hash digest
SHA256 75c61032fdce9dadecdd81f822809b26b5d8c6a48a8024ecb3fb65eb5bf6509e
MD5 9d1659c550343f8435a5b38d5549c768
BLAKE2b-256 3ecc01930d69227bc486112000d6b13fa91927ea7df1de67a39098a802669fb7

See more details on using hashes here.

File details

Details for the file gym_lqr-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: gym_lqr-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for gym_lqr-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57cb92590b0ce95c1f74f324a2d2023da0bdcc7869abe3ac290c2fa68ee47939
MD5 742407df53d6e797991ba188c08ddfe5
BLAKE2b-256 c2f05319007387bf9467abe179271e895cb0a6ee869c15652724af62f141efac

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