Added RL to README

This commit is contained in:
Dominik Moritz Roth 2024-10-02 18:45:11 +02:00
parent 08828e2dec
commit d941b2c9af

View File

@ -2,7 +2,7 @@
NuCon is a Python library designed to interface with and control parameters in Nucleares, a nuclear reactor simulation game. It provides a robust, type-safe foundation for reading and writing game parameters, allowing users to easily create their own automations and control systems. NuCon is a Python library designed to interface with and control parameters in Nucleares, a nuclear reactor simulation game. It provides a robust, type-safe foundation for reading and writing game parameters, allowing users to easily create their own automations and control systems.
In future versions, NuCon aims to implement built-in automation features. NuCon further provides a work in progress implementation of a reinforcement learning environment for training control policies.
## Features ## Features
@ -83,6 +83,45 @@ Custom Enum Types:
- `PumpOverloadStatus`: Enum for pump overload status (ACTIVE_AND_OVERLOAD, INACTIVE_OR_ACTIVE_NO_OVERLOAD) - `PumpOverloadStatus`: Enum for pump overload status (ACTIVE_AND_OVERLOAD, INACTIVE_OR_ACTIVE_NO_OVERLOAD)
- `BreakerStatus`: Enum for breaker status (OPEN, CLOSED) - `BreakerStatus`: Enum for breaker status (OPEN, CLOSED)
## Reinforcement Learning (Work in Progress)
NuCon includes a preliminary Reinforcement Learning (RL) environment based on the OpenAI Gym interface. This feature is currently a work in progress and requires additional dependencies.
### Additional Dependencies
To use the RL features, you'll need to install the following packages:
```bash
pip install gymnasium numpy
```
### RL Environment
The `NuconEnv` class in `nucon/rl.py` provides a Gym-compatible environment for reinforcement learning tasks in the Nucleares simulation. Key features include:
- Observation space: Includes all readable parameters from the Nucon system.
- Action space: Encompasses all writable parameters in the Nucon system.
- Step function: Applies actions to the Nucon system and returns new observations.
- Objective function: Allows for custom objective functions to be defined for training.
### Usage
Here's a basic example of how to use the RL environment:
```python
from nucon.rl import NuconEnv
env = NuconEnv(objectives=['max_power'], seconds_per_step=5)
obs, info = env.reset()
for _ in range(1000):
action = env.action_space.sample() # Your agent here (instead of random)
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()
```
## Testing ## Testing
NuCon includes a test suite to verify its functionality and compatibility with the Nucleares game. NuCon includes a test suite to verify its functionality and compatibility with the Nucleares game.