Coder Social home page Coder Social logo

manjavacas / melgym Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 25.32 MB

A Gymnasium-based interface for continuous control using MELCOR.

Home Page: https://melgym.readthedocs.io/

License: GNU General Public License v3.0

Python 98.34% Makefile 1.66%
gym-environment gymnasium hvac melcor python reinforcement-learning reinforcement-learning-environments control

melgym's Introduction

logo

Release License Contributors Documentation Status

MELGYM is a Gymnasium-based tool designed to facilitate interactive control over MELCOR 1.8.6 simulations.

Every control functionality in MELCOR is determined by Control Functions (CFs). However, the batch execution mode of MELCOR makes it difficult to interactively control and modify functions under certain user-defined conditions. Control conditions are defined a priori and sometimes requires the concatenation of several CFs that must be done in an unfriendly way.

MELGYM allows the definition of external user-defined controllers, allowing the use of reinforcement learning agents or any other custom/external control algorithm.

mdp

⚙️ How it works?

MELGYM leverages MELCOR's restart capabilities to modify CFs every few simulation cycles. Just before a warm start is performed, the underlying MELCOR model is modified according to the last registered simulation state, and continues running until the next control action is performed.

mpd-2

Check the MELGYM documentation for more detailed information.

🖥️ Setting up experiments

MELGYM environments adhere to the Gymnasium interface, and can be combined with DRL libraries such as Stable-Baselines3.

import melgym
import gymnasium as gym
from stable_baselines3 import TD3

env = gym.make('branch_1', render_mode='pressures')

# Training
agent = TD3('MlpPolicy', env)
agent.learn(total_timesteps=10_000)

# Evaluation
obs, info = env.reset()
done = trunc = False

while not (done or trunc):
    env.render()
    act, _ = agent.predict(obs)
    obs, rew, trunc, done, info = env.step(act)      

env.close()

For faster experimentation, the run_experiment.py script allows to launch experiments by using the configuration defined in config.yaml.

$ ./run_experiment.py -conf config.yaml

🚀 Contributing

See our contributing guidelines.

🧰 Side projects

MELGYM rely on the auxiliar toolbox MELKIT. Feel free to help us improving both projects!

melgym's People

Contributors

manjavacas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.