Learning to Run a Power Network

Organized by l2rpn - Current server time: Oct. 27, 2020, 12:02 p.m. UTC


Development phase
Nov. 15, 2018, midnight UTC


Finale phase
May 30, 2019, midnight UTC


Competition Ends

The goal of this challenge is to to solve the electric power grid control problem using a reinforcement learning based approach. Participants are asked to design a reinforcement learning agent using tools and algorithms of their choice. The designed agents are supposed to learn a policy that maximizes the final score returned by the simulator, the possible actions at a given timestep being either switching a line status or changing the line interconnections. Indeed, we provide a simulation environement consisting of a power grid simulator along with a set of chronics. We use pypownet, an open-source power grid simulator developed by Marvin Lerousseau, that simulates the behaviour of a power grid of any given characterics subject to a set of external constraints governed by the given chronics. Samples of such chronics can be found under the sample_data directory.

We also provide a set of baselines solutions:

  • A Do Nothing agent, which does not take actions at all.
  • A RandomLineSwitch agent, which randomly switches the status of one random power line per timestep (if the random line is previously online, switch it off, otherwise switch it on
  • A RandomNodeSplitting agent, which selects a random switch configuration such that switched elements of the selected substations change the node within the substation on which they are directly wired.

Action space

Typically on natiowide power grids, dispatchers use two types of physical actions:

  • switching ON or OFF some power lines
  • switching the nodes on which elements, such as productions, consumptions, or power lines, are connected within their substation

See Random Agent for an example of action.


Using Docker

Retrieve the Docker image:

docker pull mok0na/l2rpn:2.0

Retrieve the notebook README.ipynb to help you start this competition. It is available in the starting kit to download from the Files tab in the Partipate tab.

Download starting-kit and public data

unzip starting_kit -d starting-kit
cp -r starting-kit ~/aux

Run the jupyter notebook:

docker run --name l2rpn -it -p 5000:8888 -v ~/aux:/home/aux mok0na/l2rpn:2.0 jupyter notebook --ip --notebook-dir=/home/aux --allow-root

Open the link and replace the port 5000 instead of 8888. e.g. :

To reuse the docker : restart the docker and open the link

docker start l2rpn

The submission zip is in your local directory ~/aux

python ingestion_program/ingestion.py public_data input_data/res ingestion_program example_submission

Score the model

python scoring_program/evaluate.py input_data output


  • The file README.ipynb contains step-by-step instructions on how to create a custom agent and use it on the simulator.
  • Modify example_submission.py to provide a better model The structure of the file submission.py should be:
            import pypownet.env
            import pypownet.agent
            class Submission(pypownet.agent.Agent):
                def __init__(self, environment):
                    assert isinstance(environment, pypownet.env.RunEnv)
                    self.environment = environment
                def act(self, observation):
                    """Produces an action given an observation of the environment.
                    Takes as argument an observation of the current state, and returns the chosen action."""
                    # Sanity check: an observation is a structured object defined in the environment file.
                    assert isinstance(observation, pypownet.env.RunEnv.Observation)
                    # Implement your policy here.
                    return None

Making a submission

Essentially, a submission should be a ZIP file containing at least these two files:

  • submission.py: code (i.e. agent) submitted by a challenger
  • metadata: file giving the instruction to Codalab on how to process the submission (should never be changed)

Upon reception of the challenger's submission, Codalab will see the metadata file (mandatory) and consider the submission of the participant as a code submission (contrary to results submission) and run the programs to process it. The folder containing both submission.py and metadata should then be zipped (the output name is not important). Then, on Codalab:

  • Go to the competition homepage
  • Click on "Participate"
  • Click on "Submit / View Results"
  • Click on "Submit", select the latter submission zip

Codalab will take some time to process the submission, and will print the scores on the same page (after refresh).

References and credits:
Founder of pypownet was Marvin Lerousseau. The competition protocol was designed by Isabelle Guyon. Our mentors are Balthazar Donon and Antoine Marot. Pypownet, 2017. https://github.com/MarvinLer/pypownet. The baseline methods were inspired by work performed by Kimang Khun.

pypowteam l2rpn@chalearn.org
Mohamed Khalil Jabri, Léa-Marie Lam-Yee-Mui, Youcef Madji,Luca Veyrin-Forrer, Tingting Wang, Yacine Yakoubi

L2RPN: Evaluation

This competition is based on reinforcement learning. Here, the agent you will have to code will decide of the action to do at each timestep. The aim of the competition is to maximize a reward specifically designed for the problem. The reward is indeed the feedback which measures the action of an agent. For the competition, the reward is a sum of five subrewards :

  • subreward proportional to the number of isolated loads [-14 , 0]
  • subreward proportional to the number of isolated productions [-1.4 , 0]
  • subreward of the cost of the action [-0.14, 0.4]
  • subreward of the distance to the reference grid [-14, 0]
  • subreward proportional to the sum of squared lines capacity usage [-50 , 0]

The cumulative reward could be positive. Here is a plot of some cumulative rewards.

plot cumulative rewards

Further information can be found here

L2RPN: Rules

Submissions must be made before the end of phase 1.

This challenge is governed by the general ChaLearn contest rules.

Development phase

Start: Nov. 15, 2018, midnight

Description: Development phase: tune your models and submit prediction results, trained model, or untrained model.

Finale phase

Start: May 30, 2019, midnight

Description: Final phase (no submission, your last submission from the previous phase is automatically forwarded).

Competition Ends


You must be logged in to participate in competitions.

Sign In
# Username Score
1 bdonon -618.390
2 Pheonixx77 -618.390
3 guyon -618.390