NeurIPS 2022 Citylearn Challenge - Starter Kit
This repository is the NeurIPS 2022 Citylearn Challenge Submission template and Starter kit! Clone the repository to compete now!
This repository contains:
- Documentation on how to submit your models to the leaderboard
- The procedure for best practices and information on how we evaluate your agent, etc.
- Starter code for you to get started!
- Competition Overview
- Getting Started
- How to write your own agent?
- How to start participating?
- Other Concepts
- Important links
The CityLearn Challenge 2022 focuses on the opportunity brought on by home battery storage devices and photovoltaics. It leverages CityLearn, a Gym Environment for building distributed energy resource management and demand response. The challenge utilizes 1 year of operational electricity demand and PV generation data from 17 single-family buildings in the Sierra Crest home development in Fontana, California, that were studied for Grid integration of zero net energy communities.
Participants will develop energy management agent(s) and their reward function for battery charge and discharge control in each building with the goals of minimizing the monetary cost of electricity drawn from the grid, and the CO2 emissions when electricity demand is satisfied by the grid.
The challenge consists of two phases:
-
In Phase I, the leaderboard will reflect the ranking of participants' submissions based on a 5/17 buildings training dataset.
-
In Phase II, the leaderboard will reflect the ranking of participants' submissions based on an unseen 5/17 buildings validation dataset as well as the seen 5/17 buildings dataset. The training and validation dataset scores will carry 40% and 60% weights respectively in the Phase 2 score.
-
In Phase III, participants' submissions will be evaluated on the 5/17 buildings training, 5/17 validation and remaining 7/17 test datasets. The training, validation and test dataset scores will carry 20%, 30% and 50% weights respectively in the Phase 3 score. The winner(s) of the competition will be decided using the leaderboard ranking in Phase III.
- Sign up to join the competition on the AIcrowd website.
- Fork this starter kit repository. You can use this link to create a fork.
- Clone your forked repo and start developing your agent.
- Develop your agent(s) following the template in how to write your own agent section.
- Develop your reward function following the template in how to write your own reward function section.
- Submit your trained models to AIcrowd Gitlab for evaluation (full instructions below). The automated evaluation setup will evaluate the submissions on the citylearn simulator and report the metrics on the leaderboard of the competition.
We recommend that you place the code for all your agents in the agents
directory (though it is not mandatory). You should implement the
register_reset
compute_action
Add your agent name in user_agent.py
, this is what will be used for the evaluations.
Examples are provided in agents/random_agent.py
and agents/rbc_agent.py
.
To make things compatible with PettingZoo, a reference wrapper is provided that provides observations for each building individually (referred by agent id).
Add your agent code in a way such that the actions returned are conditioned on the agent_id
. Note that different buildings can have different action spaces. agents/orderenforcingwrapper.py
contains the actual code that will be called by the evaluator, if you want to bypass it, you will have to match the interfaces, but we recommend using the standard agent interface as shown in the examples.
The reward function must be defined in get_reward()
function in the rewards.get_reward module. See here for instructions on how to define a custom reward function.
- Add your SSH key to AIcrowd GitLab
You can add your SSH Keys to your GitLab account by going to your profile settings here. If you do not have SSH Keys, you will first need to generate one.
-
Fork the repository. You can use this link to create a fork.
-
Clone the repository
git clone git@gitlab.aicrowd.com:aicrowd/challenges/citylearn-challenge-2022/citylearn-2022-starter-kit.git
-
Install competition specific dependencies!
cd citylearn-2022-starter-kit pip install -r requirements.txt
-
Write your own agent as described in How to write your own agent section.
-
Write your own reward function as described in How to write your own reward function section.
-
Test your agent locally using
python local_evaluation.py
-
Make a submission as described in How to make a submission section.
We accept submissions with custom runtime, so you don't need to worry about which libraries or framework to pick from.
The configuration files typically include requirements.txt
(pypi packages), apt.txt
(apt packages) or even your own Dockerfile
.
You can check detailed information about the same in the π runtime.md file.
Please follow the example structure as it is in the starter kit for the code structure. The different files and directories have following meaning:
.
βββ aicrowd.json # Submission meta information - like your username
βββ apt.txt # Linux packages to be installed inside docker image
βββ requirements.txt # Python packages to be installed
βββ local_evaluation.py # Use this to check your agent evaluation flow locally
βββ data/ # Contains schema files for citylearn simulator (for local testing)
βββ agents # Place your agents related code here
βββ random_agent.py # Random agent
βββ rbc_agent.py # Simple rule based agent
βββ orderenforcingwrapper.py # Pettingzoo compatibilty wrapper
βββ user_agent.py # IMPORTANT: Add your agent name here
βββ rewards # Place your reward related code here
βββ get_reward.py # Place your reward related code here
βββ user_reward.py # Custom reward class (DO NOT EDIT!)
Finally, you must specify an AIcrowd submission JSON in aicrowd.json
to be scored!
The aicrowd.json
of each submission should contain the following content:
{
"challenge_id": "neurips-2022-citylearn-challenge",
"authors": ["your-aicrowd-username"],
"description": "(optional) description about your awesome agent",
}
This JSON is used to map your submission to the challenge - so please remember to use the correct challenge_id
as specified above.
π submission.md
Best of Luck π π
Participants' submissions will be evaluated upon an equally weighted sum of two metrics at the aggregated district level where district refers to the collection of buildings in the environment. The metrics include 1) district electricity cost,
Participants are ranked in ascending order of
In Phase 1, the training dataset score will carry 100% weight. By Phase 2, the training and validation dataset scores will carry 40% and 60% weights respectively. Finally in Phase 3, the training, validation and test dataset scores will carry 20%, 30% and 50% weights respectively .
The winner of each phase will be the participant with the least weighted sum of scores from all considered datasets for the phase. In the event that multiple participants have the same
For Phase I, our agent should complete 5 episodes in 60 minutes. Note that the number of episodes and time can change depending on the phase of the challenge. However we will try to keep the throughput requirement of your agent, so you need not worry about phase changes. We only measure the time taken by your agent.
- Participants can run the evaluation protocol for their agent locally with or without any constraint posed by the Challenge to benchmark their agents privately. See
local_evaluation.py
for details. You can change it as you like, it will not be used for the competition. You can also change the simulator schema provided underdata/citylearn_challenge_2022_phase_1/schema.json
, this will not be used for the competition.
π You can share your solutions or any other baselines by contributing directly to this repository by opening merge request.
- Add your implemntation as
agents/<your_agent>.py
. - Import it in
user_agent.py
- Test it out using
python local_evaluation.py
. - Add any documentation for your approach at top of your file.
- Create merge request! πππ
-
πͺ Challenge Page: https://www.aicrowd.com/challenges/neurips-2022-citylearn-challenge
-
π£ Discussion Forum: https://discourse.aicrowd.com/c/neurips-2022-citylearn-challenge
-
π Leaderboard: https://www.aicrowd.com/challenges/neurips-2022-citylearn-challenge/leaderboards