Giter Club home page Giter Club logo

social-rl's Introduction

Master's Thesis Project: Social Learning in Multi-Agent Reinforcement Learning for Carbon Emission Reduction

Overview

This repository hosts the implementation of my master's thesis conducted for the Master of Science degree in Computer Science at the University of Tübingen. The thesis focuses on 'Incorporating Social Learning into Multi-Agent Reinforcement Learning to Lower Carbon Emissions in Energy Systems'. The primary goal is to explore the impact of social learning methods on the efficiency of energy systems, with a significant emphasis on reducing carbon emissions.

Thesis Objectives

  • To integrate social learning methods, specifically imitation learning and decision biasing, into the Soft Actor-Critic (SAC) algorithm.
  • To enhance the Multi-Agent Reinforcement Learning with Imitation and Social Awareness (MARLISA) algorithm for better performance regarding carbon emissions.
  • To assess the algorithms' performance based on the KPIs of fossil energy consumption, average fossil share, average fossil share grid, and 1 - used PV by the agents.
  • To compare the performance of the social methods to asocial baseline SAC.

Framework Used

The project is built upon the CityLearn environment, which has been customized to suit the specific requirements of this research. CityLearn provides a rich simulation environment for demand response and urban energy management tasks, facilitating the study of the proposed algorithms' effectiveness.

Repository Structure

  • src/: Contains all the source code developed for the thesis and the CityLearn code.
    • src/citylearn/agents: Contains all the source code of the RL agents (provided by CityLearn and developed for the thesis).
    • src/citylearn/data: Contains the datasets used in the CityLearn simulations.
    • src/scripts: Contains the python scripts for data exploration, data preprocessing and generating plots.
  • datasets/: Includes datasets and the results from simulations.
  • experiments/: Includes configuration details and results of all experiments (Some of them may be based on old options).
  • thesis/: LaTeX source code for the thesis document.

Getting Started

To get started with the project:

  • Clone the repository.
  • Install the required dependencies listed in requirements.txt or create a conda environment using env.yml and activate it.
  • Use one of the following commands to run a social simulation:
    • Train RBC, asocial SAC and SAC agents using imitation learning for two buildings using the optimized hyperparameters:
      python3 src/socialrl.py -s nnb_limitobs1 -b 2 --rbc --sac --transitions datasets/transitions/SAC_transitions_b5.pkl --autotune
      
      [Runtime ~17 Minutes]
    • Train RBC and SAC-DemoPol agents for two buildings using the optimized hyperparameters, two random demonstrators, mode 1, and an imitation learning rate $\alpha_i=0.2$:
      python3 src/socialrl.py -s nnb_limitobs1 -b 2 -d 2 --rbc --sacdemopol --autotune --mode 1 --ir 0.2
      
      [Runtime ~10 Minutes]
    • Train RBC and SAC-DemoQ agents for two buildings using the optimized hyperparameters, two random demonstrators, and an imitation learning rate $\alpha_i=0.15$:
      python3 src/socialrl.py -s nnb_limitobs1 -b 2 -d 2 --rbc --sacdemoq --autotune --ir 0.15
      
      [Runtime ~10 Minutes]
    • Train RBC and MARLISA agents for two buildings using the optimized hyperparameters and information sharing. The reward function to use is defined in src/citylearn/data/nnb_limitobs1_marlisa/schema.json:
      python3 src/marlisa_social.py -s nnb_limitobs1_marlisa -b 2 --rbc --autotune --information_sharing
      
      [Runtime ~11 Minutes]

For enhanced flexibility and customization, you have the ability to fine-tune the simulations by configuring additional options. This includes using a pre-trained demonstrator to guide the agents or adjusting various hyperparameters. To explore the full range of configurable settings for both non-social and social simulations, please refer to src/options.py or run python3 src/socialrl.py --help.

social-rl's People

Contributors

kristina29 avatar

Watchers

 avatar

social-rl's Issues

Normalize price

Normalize the weighted price between 0 and 1 and test how this influences the algorithms and also the new buildings (own data of PV generation)

Adapt price time series

Adapt price time series

$$p_{new}(t)=p(t)+\alpha\frac{E_f(t)}{E_f(t)+E_r(t)}$$

with old price $p$ at time $t$, produced energy with fossil sources $E_f(t)$, produced energy with renewable sources $E_r(t)$ and factor $\alpha$

Building PV generation

Change PV generation of the building files such that they are better correlated to the DHI/DNI

Adjust KPIs

Include at least share of renewable energy

Tolovski Reward

Try reward used by Tolovski et al: Advancing renewable Electricity consumption with reinforcement learning

$$r(s,a)=-(Energy_{renewable}-Energy_{demand}(s,a))^2$$

Adapt available renewable Energy

There is too much energy available: Every building could quite easly shift its loading such that it only uses renewable Energy. Not realistic! -> Limit available energy

Assumption: The total amount of produced energy $E_f(t)+E_r(t)$ in the fuel_mix data is equivalent to the total demand $D(t)$ at this time point $t$: $$E_f(t)+E_r(t)=D(t)$$

Idea:

  • Preprocessing:
    • Calculate the share of renewables in the fuel_mix data $\frac{E_r(t)}{E_r(t)+E_f(t)}=\frac{E_r(t)}{D(t)}$
    • Calculate the median $\bar{E}_{b,net}^x$ over $x$ time step simulations of the net energy consumption of building $b$
  • Training (+ Evaluation ?): At each time point
    • Calculate $E_r^b(t)=\frac{E_r(t)}{D(t)}\sum_b \bar{E}_{b,net}^x$ over all included buildings $b$ such that the relative share is the same for the reduced absolute demand

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.