Skip to content

Commit

Permalink
Merge pull request #142 from ibpsa/issue141_v060
Browse files Browse the repository at this point in the history
Issue141 v060
  • Loading branch information
javiarrobas authored May 10, 2024
2 parents f5cf4c6 + 3ca1cee commit 59f5c81
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 86 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ python generateDockerComposeYml.py absolute_boptest_root_dir

## Versioning and main dependencies

Current BOPTEST-Gym version is `v0.5.0` which is compatible with BOPTEST `v0.5.0`
Current BOPTEST-Gym version is `v0.6.0` which is compatible with BOPTEST `v0.6.0`
(BOPTEST-Gym version should always be even with the BOPTEST version used).
The framework has been tested with `gymnasium==0.28.1` and `stable-baselines3==2.0.0`.
You can see [testing/Dockerfile](testing/Dockerfile) for a full description of the testing environment.
Expand Down

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions generateDockerComposeYml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import sys


boptest_root = "./" # You can define boptest_root_dir here when use IDLE

# Get the argument from command line when use Linux
if len(sys.argv) >= 2:
boptest_root_dir = sys.argv[1]
# Check if there is an argument when calling the script defining the yaml target directory
# This is just convenient for dropping the generated script directly in the BOPTEST root directory,
# but if not provided it can be manually moved once it's generated
yaml_target_dir = sys.argv[1]
else:
boptest_root_dir = boptest_root
# Otherwise use parent directory as default
yaml_target_dir = os.path.dirname(os.path.abspath(__file__))

num_services = 2 # Total Services needed
base_port = 5000 # Start Port number
Expand Down Expand Up @@ -69,10 +71,10 @@ def is_port_available(port):
}

# Check whether the docker-compose.yml file exists in the BOPTEST root directory
docker_compose_path = os.path.join(boptest_root_dir, 'docker-compose.yml')
docker_compose_path = os.path.join(yaml_target_dir, 'docker-compose.yml')
if os.path.exists(docker_compose_path):
# If it exists, rename to docker-compose_origin.yml
shutil.move(docker_compose_path, os.path.join(boptest_root_dir, 'docker-compose_origin.yml'))
shutil.move(docker_compose_path, os.path.join(yaml_target_dir, 'docker-compose_origin.yml'))

# Create a new docker-compose.yml file in the BOPTEST root directory
with open(docker_compose_path, "w") as file:
Expand Down
6 changes: 4 additions & 2 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

BOPTEST-Gym has two main dependencies: BOPTEST and Stable-Baselines3. For simplicity, the first two digits of the version number match the same two digits of the BOPTEST version of which BOPTEST-Gym is compatible with. For example, BOPTEST-Gym v0.3.x is compatible with BOPTEST v0.3.x. The last digit is reserved for other internal edits specific to this repository only. See [here](https://github.com/ibpsa/project1-boptest/blob/master/releasenotes.md) for BOPTEST release notes.

## BOPTEST-Gym v0.5.0-dev
## BOPTEST-Gym v0.6.0

Released on xx/xx/xxxx.
Released on 10/05/2024.

- Update CCAI tutorial for numeric results with new Python v3.10.
- Pin Dockerfile image to linux/x86_64.
- Implement functionality and example with vectorized environment for parallel learning. This is for [#133](https://github.com/ibpsa/project1-boptest-gym/issues/133).

## BOPTEST-Gym v0.5.0
Expand Down
5 changes: 3 additions & 2 deletions testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Start with a base Ubuntu image
FROM ubuntu:20.04
FROM --platform=linux/x86_64 ubuntu:20.04
# This is the Focal Fossa ubuntu version
MAINTAINER Javier Arroyo <[email protected]>

Expand Down Expand Up @@ -30,7 +30,8 @@ RUN pip install \
gym \
shimmy \
ipykernel==6.25.1 \
PyYAML
PyYAML \
pytest

# Add developer user with permissions in the working directory
RUN useradd -ms /bin/bash developer
Expand Down
6 changes: 3 additions & 3 deletions testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ IMG_HOME=/home/developer/boptestgym
IMG_REGI=javierarroyo/boptestgym

# BOPTEST commit used for the tests
BOPTEST_COMMIT=12ceafe42983d42e535385dee1daa1d25673e2aa
BOPTEST_COMMIT=78665506a620fc07bc2a8f301661aef3dd6c88c2

# Define current BOPTEST-Gym version (should be even with BOPTEST version defined in commit above)
VERSION = 0.5.0-dev
VERSION = 0.6.0

build-boptestgym:
docker build -f ${ROOT}/testing/Dockerfile \
--progress=plain --rm -t ${IMG_NAME} .

build-boptestgym-no-cache:
docker build -f ${ROOT}/testing/Dockerfile \
--progress=plain --no-cache --rm -t ${IMG_NAME}
--progress=plain --no-cache --rm -t ${IMG_NAME} .

run-boptestgym:
docker run \
Expand Down
2 changes: 1 addition & 1 deletion testing/references/tutorial_output_kpis_DQN_alg.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tdis_tot": 8.37342768290697, "idis_tot": 0, "ener_tot": 0.3965270991185415, "cost_tot": 0.10051961962655029, "emis_tot": 0.06622002555279644, "pele_tot": 0.02104161873770755, "pgas_tot": null, "pdih_tot": null}
{"tdis_tot": 8.370831530559261, "idis_tot": 0, "ener_tot": 0.3965284452967778, "cost_tot": 0.1005199608827332, "emis_tot": 0.06622025036456192, "pele_tot": 0.021041628867335238, "pgas_tot": null, "pdih_tot": null}
2 changes: 1 addition & 1 deletion testing/references/tutorial_output_kpis_Q_alg.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tdis_tot": 0.08092250218334793, "idis_tot": 0, "ener_tot": 0.3449562854330366, "cost_tot": 0.08744641835727476, "emis_tot": 0.05760769966731713, "pele_tot": 0.02087948857312455, "pgas_tot": null, "pdih_tot": null}
{"tdis_tot": 1.741814571742692, "idis_tot": 0, "ener_tot": 0.17501251008682203, "cost_tot": 0.0443656713070094, "emis_tot": 0.02922708918449929, "pele_tot": 0.019907644464042158, "pgas_tot": null, "pdih_tot": null}
3 changes: 2 additions & 1 deletion testing/test_boptestGymEnv.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ def setUp(self):
the terminal when invoking this test.
'''

boptest_root = "./"
# Take parent directory as default
boptest_root = os.path.dirname(os.path.abspath(__file__))

# Get the argument from command line when use Linux
if len(sys.argv) >= 2:
Expand Down

0 comments on commit 59f5c81

Please sign in to comment.