intelligent-environments-lab / CityLearn

Official reinforcement learning environment for demand response and load shaping
MIT License
462 stars 167 forks source link

Develop split episode training #69

Closed kingsleynweye closed 1 year ago

kingsleynweye commented 1 year ago

Description

Provide interface where a single dataset can be used to define multiple episodes. Until now, a dataset was used to define 1 episode of training that was repeatedly used to reset the environment and train multiple episodes. Problem with this approach was that it didn't allow for shorter episodes such as daily or weekly episodes while maintaining a dataset of many days. It also meant that there had to be continuity in time series e.g. 3 months of data from different years could not be easily combined into a training dataset.

This pull request allows one to specify the length of each episode using the citylearn.citylearn.CityLearnEnv.episode_time_steps variable such that setting this value to say 24 will mean each episode is 24 hours long and during each call to citylearn.citylearn.CityLearnEnv.reset, a new 24 timestep sequence in the dataset will be used for training.

By default, citylearn.citylearn.CityLearnEnv.episode_time_steps is set to the usual length defined by simulation_start_time_step and simulation_end_time_step in schema.

Alternatively, for unequal episode lengths, one can set citylearn.citylearn.CityLearnEnv.episode_time_steps to a list of episode_start_time_step and episode_end_time_step pairs e.g. [[0, 10], [10, 50], [51, 60]].

Other variables like citylearn.citylearn.CityLearnEnv.rolling_episode_split can be used to True if episode sequences are split such that each time step is a candidate for episode_start_time_step otherwise, False to split episodes in steps of episode_time_steps.

citylearn.citylearn.CityLearnEnv.rolling_episode_split is True if episode splits i.e. episode_start_time_step and episode_end_time_step are to be selected at random during training otherwise, False to select sequentially.

Issue

NIL

Changes

See change log

Screenshots

NIL

Checklist

Additional notes

NIL