[Completed] #Electricity4All Python Challenge


Electricity is essential to poverty alleviation and sustainable development. Over 1.1 billion people lack access to electricity, making it a central priority for the United Nations’ 2030 Agenda for Sustainable Development. However, the goal of providing universal access to electricity carries significant challenges. Nearly 97% of people who lack access to electricity live in poor, remote and sparsely populated regions of Sub-Saharan Africa and developing Asia, and the infrastructure required to bring electricity to these areas can be extremely costly. As a result, viable policy solutions are generally limited to:

● connecting to the country’s central grid;

● building or connecting to a small network powered locally by diesel, wind, or solar technologies (known as a “mini-grid”); or

● using stand-alone, off-grid solar and diesel small generators

The costs of these options vary based on a complex set of factors such as distance to the grid; difficulty in sourcing diesel fuel; solar, wind or water availability; topography; and consumption levels. With these challenges in mind, the KTH Royal Institute of Technology(KTH) of Sweden, the United Nations Department of Economic and Social Affairs (UN-DESA), and other partners developed an electrification tool: Access to Universal Electricity. This tool provides an overview of the challenges inherent in providing electricity for all by incorporating relevant cost, feasibility and local factors to identify the lowest cost option available.

"The work carried out by KTH Royal Institute of Technology of Sweden and the United Nations Department of Economic and Social Affairs (UN-DESA), is a key milestone in giving support and capacity building to developing countries in different governmental areas and across public officers, in order to improve energy and economic planning skills with the use of these important models. I do believe that we are in a special moment where developing countries need to strengthen the planning units in order to better inform policy makers on the best options to fulfill the development goals, enhancing effectiveness and efficiency on the use of economic resources and social impact, throughout national actions combined with international cooperation." 

Jorge Leitón, Director of Energy Planning and Integration, Ministry of Hydrocarbons and Energy of Bolivia


Summary of the challenge

#Electricity4All challenges participants to convert the current electrification tool from Microsoft Visual Basic (VBA) to Python. The current model uses open geospatial data to predict the mix of technologies that will provide universal access to electricity at the lowest cost and calculates the lowest investment cost for electrification of a certain country or region given its population density, per capita electricity consumption levels and diesel prices. This code is part of a multistep analysis and constitutes a major computational component in the overall electrification planning. While this model provides important and novel insights, it is developed using a proprietary programming language that takes an average of 50 hours to run for the 44 African countries that were considered in the analysis.  In order to provide analysts with the greatest flexibility, it is essential to minimize computational time. Initial experimentation suggests the model scenario processing time can be reduced to less than 5 hours with Python. Therefore, the challenge objectives are as follows:

● Provide an elegant and well-written code (in Python) that reduces model run time from 50 hours to less than 5 hours; and

● Make the electrification code accessible to all (e.g. other researchers, organizations, energy planners and governments) as an open source solution.

The results of the challenge will be beneficial in facilitating further analysis of electrification policies in other countries and allow UN-DESA and KTH policy researchers to update and expand on comprehensive electrification planning studies. Furthermore, other researchers, organizations, energy planners and governments may use this code as part of their overall electrification planning analysis. The winning solution will be used to run several new scenarios that will feed UN-DESA modeling tools for Sustainable Development Policies, including the Universal Access to Electricity Model.

The final deadline is Sunday 15 May, 2016 at 23:59 PM EST.  See details on prizes and recognition here


Q&A Session on 6 May, 2016

KTH hosted an online Q&A sessions on Friday 6 May, 2016 at 9:00AM EST where participants had a chance to ask questions related to this challenge directly to the KTH Royal Institute of Technology personnels. You can watch the recording on the Q&A here. If your question wasn't answered during the session. Please email your question(s) to uniteideas@un.org.


What is the task?

View the challenge details here.



The datasets associated to this challenge:

1. Dataset “Algorithm-High 5” includes the algorithm and results for scenario one, which refers to High Diesel Price and Tier 5 electrification as shown in the Electrification analysis on the UN website. This scenario is the most time consuming.

2. Dataset “Inputs for other scenarios_Electrification challenge” includes inputs for 7 more scenarios.

3. UPDATE! The challenge host has now added a smaller dataset and a detailed description of the dataset to the dataset folder.

The datasets can be found here.


Expected Deliverables

The solutions should be submitted through Unite Ideas platform ("Propose a Solution" at the bottom of the challenge page). Participants should deliver their solution as a link to their github repository or cloud development environment, such as free Cloud9 ( https://c9.io/ ) workspace. To ensure comparability, the submissions should include a readme file with the code running time together with the RAM and the processor specifications of the computer used.

Important: In case you use a cloud environment (such as Cloud9) please share your workspace with uniteideas@un.org for the judges to be able to test run your submission.

Participants’ workspace should include:

1. The code written in Python (with comments as in Visual Basic),

2. A .txt input and a .txt output file with the results, and

A readme file including (a) description of the code, (b) instructions on how the program works and how to use it, (c) Code running time (the amount of time it takes from when the program is started to when the complete results are obtained), the RAM and the processor specifications of the computer used to run the code. This documentation should ensure clear code documentation for the other users and programmers who wish to further use or contribute to the code. (Find a resource on basic code documentation here.)


Prizes and recognition

The winner and the winning solution will:

● Be officially announced during  the High Level Political Forum on Sustainable Development in July, 2016 at the United Nations as part of the UN-DESA modeling tools initiative.

● Receive a letter of recognition from Lenni Montiel, the United Nations Assistant Secretary-General for Economic Development in UN-DESA.

● Be featured and referenced on KTH Royal Institute of Technology and UN-DESA Modeling tools for Sustainable Development websites.   

● Be offered the opportunity to have an advisory role in the further development of the submitted code.


Submission Guidelines: 

● This challenge is open to the general public. We welcome the participation of students, data scientists and Visual Basic/Python literate programmers. Public, private, and academic organizations are also invited to take part.

● Participants should submit the final challenge submissions (link to Github, Cloud9 or similar and a read me file) through the Unite Ideas Website by 15 May, 2016.

● Only original, open source work will be accepted. It is acceptable that your solution uses other existing open source Python libraries.Please use Python 2.7 or Python 3.x. Solutions using Jython, Cython, PyPy or similar tools are also welcome.

● Teams can submit by acknowledging all contributors under the “description” field on the submissions form.

● There are no limitations on the number of submissions per participant / participating team.

● The participants are required to agree on the terms and conditions.


Review Process: 

The judges will review the submitted solutions based on the expected deliverables. Qualified submissions will be judged on a combination of the following criteria:

 Conversion - Successful transfer of the code from VBA to Python, while maintaining the ability to run all the model scenarios.  

● Accuracy - The participant should be able to obtain the same results with Python as with VBA. In case of discrepancies, the participant should explain the difference in proximity.

● Speed - Significantly decrease the computational time of the script - from 50 hours in VBA to less than 5 hours in Python, per scenario. Participants should report the code running time in their submissions (see Expected Deliverables).

● Elegance - Create a user-friendly and clear input and output process to run the eight different scenarios at a time.

● Documentation - The Python code should be well-documented in English (clear language, skipping unnecessary lines etc.). The same applies for the readme documentation.

The judging panel consists of researchers and energy analysts from KTH Royal Institute of Technology of Sweden and United Nations Department of Economic and Social Affairs (UN-DESA).




Dimitris Mentis

Department of Energy Technology

KTH Royal Institute of Technology of Sweden

Oliver Broad 2.jpg

Oliver Broad

Department of Energy Technology

KTH Royal Institute of Technology of Sweden


Clovis Freire

Division for Sustainable Development

United Nations Department of Economic and Social Affairs (UN-DESA)


Solution Terms & Conditions: 
When you submit a solution to this challenge you agree to license it as follows:

Infographics and databases are licensed under a Creative Commons Attribution 4.0 International license. Read the full text of the license here: https://creativecommons.org/licenses/by/4.0/legalcode

Software (e.g. dynamic visualizations) is licensed under a GNU General Public License Version 3 as published by the Free Software Foundation here: https://www.gnu.org/licenses/gpl.html

You represent and warrant that you have all necessary rights, licenses, and permissions to grant the above license and that the content submitted by you and the submission of such content, do not and will not violate any intellectual property rights (including but not limited to copyrights and trademark rights) of any third party.

Submission Deadline: 
Sun. May. 15/16
Challenge Status: 
Challenger Organization: 
United Nations Division for Sustainable Development, DESA

The Division for Sustainable Development (DSD) provides leadership in promoting and coordinating implementation of the sustainable development agenda of the United Nations. The work of the Division translates into five core functions: (1) Support to UN intergovernmental processes on sustainable development; (2) Analysis and policy development; (3) Capacity development at the country level; (4) Inter-agency coordination; and (5) Knowledge management, communication and outreach.

Electrification, UNDESA