You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2.Create conda environment. Replace `XX` below with the name of the SustainGym environment you want to work on.
4
+
2.(Optional, but recommended) If you are using a conda version `<=23.9.0`, set the conda solver to libmamba for faster dependency solving. Starting from conda version [`23.10.0`](https://github.com/conda/conda/releases/tag/23.10.0), libmamba is the default solver.
5
5
```bash
6
-
conda env update --file env_XX.yml --prune
6
+
conda config --set solver libmamba
7
7
```
8
-
9
-
If you are using RLLib with a GPU, you will also need to [configure TensorFlow for GPU](https://www.tensorflow.org/install/pip#4_gpu_setup):
8
+
3. Clone the SustainGym repo, and enter the `sustaingym` directory.
3. Make code modifications in a separate git branch
13
+
4. Create conda environment. Replace `XX` below with the name of the SustainGym environment you want to work on. By default, the `env_XX.yml` environment files assume that you have a NVIDIA GPU. If you do not have a NVIDIA GPU, you may need to modify the `env_XX.yml` file.
14
+
```bash
15
+
conda env update --file env_XX.yml --prune
16
+
```
17
+
5. Make code modifications in a separate git branch
17
18
```bash
18
19
git checkout -b new_feature
19
20
```
20
-
4. From repo root folder, run mypy type checker and fix any errors.
21
+
6. From repo root folder, run mypy type checker and fix any errors.
21
22
```bash
22
23
mypy sustaingym
23
24
```
24
-
5. From repo root folder, run code linter and fix any linting errors.
25
+
7. From repo root folder, run code linter and fix any linting errors.
25
26
```bash
26
27
flake8 sustaingym
27
28
```
28
-
6. Commit changes in git and push.
29
-
7. Submit pull request on GitHub.
29
+
8. Commit changes in git and push.
30
+
9. Submit pull request on GitHub.
30
31
31
32
32
33
## Unit tests
33
34
34
-
First, set your terminal directory to this repo's root directory. Next, make sure you have activated the appropriate conda environment for the SustainGym environment you want to test (e.g., `conda activate sustaingym_ev`). Finally, run the unit tests for the desired SustainGym environment:
35
+
First, set your terminal directory to this repo's root directory. Next, make sure you have activated the appropriate conda environment for the SustainGym environment you want to test (_e.g._, `conda activate sustaingym_ev`). Finally, run the unit tests for the desired SustainGym environment:
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
# SustainGym: Reinforcement learning environments for sustainability applications
1
+
# SustainGym: Reinforcement Learning Environments for Sustainable Energy Systems
2
2
3
3
The lack of standardized benchmarks for reinforcement learning (RL) in sustainability applications has made it difficult to both track progress on specific domains and identify bottlenecks for researchers to focus their efforts on. We present SustainGym, a suite of environments designed to test the performance of RL algorithms on realistic sustainability tasks. These environments highlight challenges in introducing RL to real-world sustainability tasks, including physical constraints and distribution shift.
Copy file name to clipboardExpand all lines: docs/buildingenv.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@
3
3
BuildingEnv considers the control of the heat flow in a multi-zone building so as to maintain a desired temperature setpoint. Building temperature simulation uses first-principled physics models. Users can either choose from a pre-defined list of buildings (Office small, School primary, Apartment midrise, and Office large) and three climate types and cities (San Diego, Tucson, New York) provided by the Building Energy Codes Program or define a customized BuildingEnv environment by importing any self-defined EnergyPlus building models. Each episode runs for 1 day, with 5-minute time intervals ($H = 288$, $\tau = 5/60$ hours).
4
4
5
5
## Observation Space
6
-
For a building with $M$ indoor zones, the state $s(t) \in \R^{3M+2}$ contains observable properties of the building environment at timestep $t$:
6
+
For a building with $M$ indoor zones, the state $s(t) \in \R^{M+4}$ contains observable properties of the building environment at timestep $t$:
where $T_i(t)$ is zone $i$'s temperature at time step $t$, $N_i(t)$ is the number of occupants, $Q_{i}^{GHI}(t)$ is the heat gain from the solar irradiance, and $T_G(t)$ and $T_E(t)$ denote the ground and outdoor environment temperature. In practice, the agent may have access to all or part of the state variables for decision-making depending on the sensor setup. Note that the outdoor/ground temperature, room occupancy, and heat gain from solar radiance are time-varying uncontrolled variables from the environment.
12
+
where $T_i(t)$ is zone $i$'s temperature at time step $t$, $\bar{Q}^\mathrm{p}(t)$ is the heat acquisition from occupant's activities, $Q^\mathrm{GHI}(t)$ is the heat gain from the solar irradiance, and $T_\mathrm{G}(t)$ and $T_\mathrm{E}(t)$ denote the ground and outdoor environment temperature. In practice, the agent may have access to all or part of the state variables for decision-making depending on the sensor setup. Note that the outdoor/ground temperature, room occupancy, and heat gain from solar radiance are time-varying uncontrolled variables from the environment.
13
13
14
14
## Action Space
15
15
The action $a(t) \in [-1, 1]^M$ sets the controlled heating supplied to each of the $M$ zones, scaled to $[-1, 1]$.
@@ -18,13 +18,13 @@ The action $a(t) \in [-1, 1]^M$ sets the controlled heating supplied to each of
18
18
The objective is to reduce energy consumption while keeping the temperature within a given comfort range. The default reward function is a weighted $\ell_2$ reward, defined as
where $T^{obj}(t)=[T^{obj}_{1}(t),...,T^{obj}_{M}(t)]$ are the target temperatures and $T(t)=[T_{1}(t),...,T_{M}(t)]$ are the actual zonal temperature. BuildingEnv also allows users to customize reward functions using environment states $s(t)$, actions $a(t)$, target values $T^{obj}(t)$, and a weight term $\beta$. Users can also customize the reward function to take CO<sub>2</sub> emissions into consideration.
24
+
where $T^\mathrm{target}(t)=[T^\mathrm{target}_{1}(t),\cdots,T^\mathrm{target}_{M}(t)]$ are the target temperatures and $T(t)=[T_1(t),\cdots,T_M(t)]$ are the actual zonal temperature. BuildingEnv also allows users to customize reward functions by changing the weight term $\beta$ or the parameter $p$ defining the $\ell_p$ norm. Users can also customize the reward function to take CO<sub>2</sub> emissions into consideration.
25
25
26
26
## Distribution Shift
27
-
BuildingEnv features distribution shifts in the ambient outdoor temperature profile $T_E$ which varies with different seasons.
27
+
BuildingEnv features distribution shifts in the ambient outdoor temperature profile $T_\mathrm{E}$ which varies with different seasons.
28
28
29
29
## Multiagent Setting
30
30
In the multiagent setting for BuildingEnv, we treat each building as an independent agent whose action is the building's heat control decisions. It must coordinate with other building agents to maximize overall reward, which is the summation of each agent's reward. Each agent obtains either the global observation or individual building states.
@@ -33,11 +33,25 @@ In the multiagent setting for BuildingEnv, we treat each building as an independ
33
33
34
34
### Installation
35
35
36
-
Coming soon!
36
+
SustainGym is designed for Linux machines. SustainGym is hosted on [PyPI](https://pypi.org/project/sustaingym/) and can be installed with `pip`:
2. (Optional, but recommended) If you are using a conda version `<=23.9.0`, set the conda solver to libmamba for faster dependency solving. Starting from conda version [`23.10.0`](https://github.com/conda/conda/releases/tag/23.10.0), libmamba is the default solver.
46
+
```bash
47
+
conda config --set solver libmamba
48
+
```
49
+
3. Install the libraries necessary for runnning the BuildingEnv environment.
2. (Optional) Set the conda solver to libmamba for faster dependency solving.
64
+
2. (Optional, but recommended) If you are using a conda version `<=23.9.0`, set the conda solver to libmamba for faster dependency solving. Starting from conda version [`23.10.0`](https://github.com/conda/conda/releases/tag/23.10.0), libmamba is the default solver.
2. (Optional) Set the conda solver to libmamba for faster dependency solving.
37
+
2. (Optional, but recommended) If you are using a conda version `<=23.9.0`, set the conda solver to libmamba for faster dependency solving. Starting from conda version [`23.10.0`](https://github.com/conda/conda/releases/tag/23.10.0), libmamba is the default solver.
Copy file name to clipboardExpand all lines: docs/evchargingenv.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,14 @@ The reward function is a sum of three components: $r(t) = p(t) - c_V(t) - c_C(t)
19
19
20
20
### Installation
21
21
22
-
SustainGym is hosted on [PyPI](https://pypi.org/project/sustaingym/) and can be installed with `pip`:
22
+
SustainGym is designed for Linux machines. SustainGym is hosted on [PyPI](https://pypi.org/project/sustaingym/) and can be installed with `pip`:
23
23
24
24
```bash
25
25
pip install sustaingym[ev]
26
26
```
27
27
28
+
Specifically for `EVChargingEnv`, you also need to have a MOSEK license. You may either request a free [personal academic license](https://www.mosek.com/products/academic-licenses/), or a free 30-day [commercial trial license](https://www.mosek.com/products/trial/). The license file should be placed inside a folder called "mosek" under your home directory. Typically, that will be `~/mosek/mosek.lic`.
2. (Optional) Set the conda solver to libmamba for faster dependency solving.
53
+
2. (Optional, but recommended) If you are using a conda version `<=23.9.0`, set the conda solver to libmamba for faster dependency solving. Starting from conda version [`23.10.0`](https://github.com/conda/conda/releases/tag/23.10.0), libmamba is the default solver.
52
54
```bash
53
55
conda config --set solver libmamba
54
56
```
@@ -90,4 +92,4 @@ optional arguments:
90
92
91
93
## References
92
94
93
-
[1] Z. J. Lee et al., "Adaptive Charging Networks: A Framework for Smart Electric Vehicle Charging," in _IEEE Transactions on Smart Grid_, vol. 12, no. 5, pp. 4339-4350, Sept. 2021, doi: 10.1109/TSG.2021.3074437. URL [https://ieeexplore.ieee.org/document/9409126](https://ieeexplore.ieee.org/document/9409126).
95
+
[1] Z. J. Lee et al., "Adaptive Charging Networks: A Framework for Smart Electric Vehicle Charging," in _IEEE Transactions on Smart Grid_, vol. 12, no. 5, pp. 4339-4350, Sept. 2021, doi: 10.1109/TSG.2021.3074437. URL [https://ieeexplore.ieee.org/document/9409126](https://ieeexplore.ieee.org/document/9409126).
Copy file name to clipboardExpand all lines: docs/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ A suite of environments designed to test the performance of RL algorithms on rea
11
11
The lack of standardized benchmarks for reinforcement learning (RL) in sustainability applications has made it difficult to both track progress on specific domains and identify bottlenecks for researchers to focus their efforts on. We present **SustainGym**, a suite of environments designed to test the performance of RL algorithms on realistic sustainability tasks. These environments highlight challenges in introducing RL to real-world sustainability tasks, including physical constraints and distribution shift.
12
12
13
13
<p>
14
-
<a href="https://drive.google.com/file/d/1wrLGu2FCVOT_BvtDoudsz05zFG89r7dI/view?usp=drive_link" class="btn btn-blue fs-5 mb-4 mb-md-0 mr-2">Read the Paper</a>
14
+
<a href="https://openreview.net/forum?id=vZ9tA3o3hr" class="btn btn-blue fs-5 mb-4 mb-md-0 mr-2">Read the Paper</a>
15
15
<a href="https://github.com/chrisyeh96/sustaingym/" class="btn fs-5 mb-4 mb-md-0">View it on GitHub</a>
Copy file name to clipboardExpand all lines: env_building.yml
+22-10Lines changed: 22 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,41 @@
5
5
# conda remove --name sustaingym_building --all
6
6
#
7
7
# Notes
8
-
# - last updated: September 27, 2023
8
+
# - Ray 2.8:
9
+
# - officially only supports up to Python 3.10 (see https://docs.ray.io/en/latest/ray-overview/installation.html)
10
+
# - only supports gymnasium 0.28.1 (see https://github.com/ray-project/ray/blob/ray-2.8.0/python/setup.py#L305)
11
+
# - officially seems to only supports pettingzoo 1.23.1 (see https://github.com/ray-project/ray/blob/ray-2.7.1/python/requirements/ml/rllib-test-requirements.txt),
12
+
# but empirically seems to work with pettingzoo 1.24.*
13
+
#
14
+
# last updated: November 13, 2023
9
15
name: sustaingym_building
10
16
channels:
17
+
- pytorch
18
+
- nvidia
11
19
- conda-forge
12
20
dependencies:
13
-
- python=3.11
14
-
- cvxpy # for MPC controller
15
-
- flake8 # Optional, for code linting
16
-
- ipympl # Optional, for Jupyter / VSCode notebooks
17
-
- ipykernel # Optional, for Jupyter / VSCode notebooks
21
+
- python=3.10.*
22
+
- cvxpy=1.4.* # for MPC controller
23
+
- flake8 # Optional, for code linting
24
+
- ipympl # Optional, for Jupyter / VSCode notebooks
25
+
- ipykernel # Optional, for Jupyter / VSCode notebooks
Copy file name to clipboardExpand all lines: env_cogen.yml
+20-15Lines changed: 20 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -5,44 +5,49 @@
5
5
# conda remove --name sustaingym_cogen --all
6
6
#
7
7
# Notes
8
-
# - ray[rllib]==2.7 only supports gymnasium 0.28.1, pettingzoo 0.24.*
9
-
# - last updated: October 30, 2023
8
+
# - TensorFlow 2.14:
9
+
# - the GPU version only works with Python <=3.10 (see https://github.com/tensorflow/tensorflow/issues/61986)
10
+
# - TensorFlow 2.15 should fix this issue
11
+
# - Ray 2.8:
12
+
# - officially only supports up to Python 3.10 (see https://docs.ray.io/en/latest/ray-overview/installation.html)
13
+
# - only supports gymnasium 0.28.1 (see https://github.com/ray-project/ray/blob/ray-2.8.0/python/setup.py#L305)
14
+
# - officially seems to only supports pettingzoo 1.23.1 (see https://github.com/ray-project/ray/blob/ray-2.8.0/python/requirements/ml/rllib-test-requirements.txt),
15
+
# but empirically seems to work with pettingzoo 1.24.*
16
+
#
17
+
# last updated: November 16, 2023
10
18
name: sustaingym_cogen
11
19
channels:
12
20
- pytorch # for pytorch
13
21
- nvidia # for pytorch-cuda
14
22
- conda-forge
15
23
dependencies:
16
-
- python=3.11
24
+
- python=3.10.*
17
25
- flake8
18
26
- ipympl # for Jupyter / VSCode notebooks
19
27
- ipykernel # for Jupyter / VSCode notebooks
20
28
- matplotlib
21
29
- mypy
22
-
- numpy
30
+
- numpy=1.26.*
23
31
- openpyxl # for reading Excel files
24
32
- pandas
25
33
- pip
26
-
- pytorch=2.0.1
34
+
- pytorch=2.1.*
27
35
- pytz=2023.3
28
36
- seaborn
29
37
- tqdm
30
38
- xlrd # for reading Excel files
31
39
32
-
# for GPU
33
-
- cudatoolkit=11.8.0 # for TensorFlow 2.12
34
-
- pytorch-cuda=11.8 # for PyTorch 2.0
35
-
40
+
# for GPU. comment out for CPU-only.
41
+
- pytorch-cuda=11.8 # for PyTorch 2
36
42
37
43
- pip:
38
44
- gymnasium==0.28.1
39
45
- pettingzoo==1.24.1
40
-
- "ray[rllib]==2.7.1"
41
-
- tensorflow==2.14.*
46
+
- ray[rllib]==2.8.*
47
+
- onnxruntime==1.16.* # the ONNX model for CogenEnv is small and runs sufficiently fast on CPU
42
48
43
49
# uncomment for CPU-only
44
-
# - onnxruntime
50
+
# - tensorflow==2.14.*
45
51
46
-
# for GPU
47
-
- nvidia-cudnn-cu11==8.6.0.163 # for TensorFlow 2.12
Copy file name to clipboardExpand all lines: env_ev.yml
+36-27Lines changed: 36 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -5,45 +5,54 @@
5
5
# conda remove --name sustaingym_ev --all
6
6
#
7
7
# Notes
8
-
# - the 2 main bottlenecks are acnportal and ray
9
-
# 1) acnportal v0.3.2 only supports up to Pandas 1.1,
10
-
# and Pandas 1.1 only supports up to Python 3.9
11
-
# 2) ray[rllib]==2.7.0 only supports gymnasium 0.28.1, pettingzoo 0.24.*
12
-
# - technically, ray(2.7.0) needs Pandas >= 1.3, but we can bypass this requirement by installing
13
-
# it through pip instead of conda
14
-
# - last updated: September 27, 2023
8
+
# - TensorFlow 2.14:
9
+
# - the GPU version only works with Python <=3.10 (see https://github.com/tensorflow/tensorflow/issues/61986)
10
+
# - TensorFlow 2.15 should fix this issue
11
+
# - Ray 2.8:
12
+
# - officially only supports up to Python 3.10 (see https://docs.ray.io/en/latest/ray-overview/installation.html)
13
+
# - only supports gymnasium 0.28.1 (see https://github.com/ray-project/ray/blob/ray-2.8.0/python/setup.py#L305)
14
+
# - officially seems to only supports pettingzoo 1.23.1 (see https://github.com/ray-project/ray/blob/ray-2.8.0/python/requirements/ml/rllib-test-requirements.txt),
15
+
# but empirically seems to work with pettingzoo 1.24.*
16
+
#
17
+
# last updated: November 25, 2023
15
18
name: sustaingym_ev
16
19
channels:
17
20
- pytorch # for pytorch
18
21
- nvidia # for pytorch-cuda
19
22
- mosek # for mosek
20
23
- conda-forge
21
24
dependencies:
22
-
- python=3.9.16
23
-
- cudatoolkit=11.8.0 # for TensorFlow 2.12
24
-
- cvxpy=1.3.1
25
-
- flake8=6.0.0
25
+
- python=3.10.*
26
+
- cvxpy=1.4.*
27
+
- flake8=6.1.*
26
28
- ipympl=0.9.3 # for Jupyter / VSCode notebooks
27
29
- ipykernel # for Jupyter / VSCode notebooks
28
-
- matplotlib=3.7.1
29
-
- mosek=10.0.44
30
-
- mypy=1.3.0
31
-
- numpy=1.24.3
32
-
- pandas=1.1.5 # acnportal 0.3.2 only works with Pandas 1.1
30
+
- matplotlib=3.8.*
31
+
- mosek=10.1.*
32
+
- mypy=1.3.*
33
+
- numpy=1.26.*
34
+
- pandas=2.1.*
33
35
- pip
34
-
- pytorch=2.0.1
35
-
- pytorch-cuda=11.8 # for PyTorch 2.0
36
+
- pytorch=2.1.*
36
37
- pytz=2023.3
37
-
- requests=2.31.0
38
-
- scikit-learn=1.1.1
39
-
- scipy=1.10.1
40
-
- seaborn=0.12.2
41
-
- tqdm=4.65.0
38
+
- requests=2.31.*
39
+
- scikit-learn=1.1.*
40
+
- scipy=1.11.*
41
+
- seaborn=0.13.*
42
+
- tqdm=4.66.*
43
+
44
+
# for GPU. comment out for CPU-only.
45
+
- pytorch-cuda=11.8 # for PyTorch 2
42
46
43
47
- pip:
44
-
- acnportal==0.3.2
48
+
- acnportal>=0.3.3
45
49
- gymnasium==0.28.1
46
50
- pettingzoo==1.24.1
47
-
- "ray[rllib]==2.7.0"
48
-
- tensorflow==2.12.0
49
-
- nvidia-cudnn-cu11==8.6.0.163 # for TensorFlow 2.12
0 commit comments