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.1.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.1-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gym_lqr-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 72d925d14f42309ce9b713f48208446b78cc249b1e824e00e611425b6098687e
MD5 a6a08c03b4426ef7b338eff642d634ce
BLAKE2b-256 cf4bae4f852d870bbfa4af2941a8689886d808d511495194a3b744c3bafbd670

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gym_lqr-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 27.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87ef91e390a59050601c1d9881dc2c536575ff1ee9abc001d0d13a22d1a00959
MD5 1f317b9336fccee1a718685e89191340
BLAKE2b-256 682f0172572b5b75f80891595efa1b1705f3f37e606769e62fa3276102e94e80

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