Contact: Flora Charbonnier, flora.charbonnier@eng.ox.ac.uk
This project uses multi-agent reinforcement learning for the coordination of residential energy flexibility.
Cooperating agents learn to control the flexibility offered by electric vehicles, space heating and flexible loads in a partially observable stochastic environment.
The novel combination of learning from off-line convex optimisations on historical data and isolating marginal contributions to total rewards in reward signals increases stability and performance at scale. This tackles the challenge of scalability for simultaneously learning independent agents under partial observability in a stochastic environment for household-level decision-making.
The houses (agents) cooperate to minimise global system costs consisting of grid, distribution and storage costs.
For more details on the system framework, a description can be found in the peer-reviewed paper below, which uses this repository code:
Charbonnier F, Morstyn T, McCulloch MD. Scalable multi-agent reinforcement learning for distributed control of residential energy flexibility. Appl Energy 2022;314:118825. https://doi.org/10.1016/j.apenergy.2022.118825.
The learning methods are:
The flexible technologies modelled are:
Exploration sources are:
The learning for independent learners can be
The action space can be
Rewards for independent learners can be defined as:
Energy prices follow historical Octopus's agile tariff.
The source code for MARL_local_electricity is currently hosted on GitHub at: https://github.com/floracharbo/MARL_local_electricity
The data pre-processing for the home energy data generation HEDGE can be found at: https://github.com/floracharbo/HEDGE.
Obtain input data for HEDGE, as intructed on the README in https://github.com/floracharbo/HEDGE.
Create virtual environment:
conda create -n "my_venv" python==3.9.13
Install packages, inserting your operating system (os) in the yml file name below (mac or linux).
conda env update --name my_venv --file config_files/environments/environment_[os].yml --prune
Obtain Mosek licence and move to adequate folder. e.g. https://www.mosek.com/products/academic-licenses/
Activate environment:
conda activate my_venv
Define user inputs
Default settings are in the inputs folder config_files/input_parameters
:
If the user wishes to change these default settings, whilst still being able to compare previous runs in organise_results
, the previous default settings should be recorded in input_parameters/previous_defaults.yaml
.
To use experiment-specific settings different to the default parameters in config_files/default_input_parameters
, enter specific values in the settings
dictionary in the main.py
file, as shown in as an example in the file.
If values entered are in a list format, multiple experiments will loop though these values, so multiple experiments can be planned in one run.
main.py
Alternatively, settings can be entered through the command line rather than from the .py or .yaml files, e.g.
python main.py -n 5 --n_repeats 2 --n_epochs 20 -o grdC --o avail_car_step --rnn_hidden_dim 100
Where -o
stands for observation, -n
for the number of homes. You can add more abbreviations in the get_settings_i
function in the initialise_prm.py
file.
results
folder.