Nirantar — keeping the lights on with reinforcement learning

A PPO controller for a solar + battery system shared by 10 homes on a street with frequent, home-by-home power cuts. Trained on real outage and load data from three Indian regions, warm-started by imitating a perfect-foresight optimiser (behaviour cloning + DAgger), protected by a 4-hour safety shield, and tested once on an unseen city — Pune 2018.

+0.93reward / week vs rule-based control (95% CI +0.74 … +1.19)
−1.58 kWhevening grid import per day vs rule-based
+0.87reward / week vs chance-constrained MPC
58%of the rule → perfect-foresight gap closed

Live simulation KEY MOMENT

One real validation day replayed step by step: the frozen GRU-PPO policy (seed 2) decides every 15 minutes, the shield checks the decision, and the simulator moves the energy. Every number below comes from the recorded rollout.

00:00
PHYSICAL ENVIRONMENT · LIVE POWER FLOW (kW)
on gridcut · full backup cut · essentials onlycut · unserved
RL BRAIN · st → forecasts → GRU-PPO π(a|s) → shield → at
FORECAST LOOK-AHEAD
cut riskdemand
PPO ACTOR π(a|s)
24-HOUR TRACE (click to jump) · orange = homes in a cut · red band = evening peak 18–22 h

Narrated video

How it works

1 · Data164 homes, ~9.2 M 15-minute home-steps: CEEW smart meters (Mathura, Bareilly), Prayas eMARC + ESMI (Uttar Pradesh, Pune), NASA POWER solar.
2 · ForecastsPer-home cut risk and demand at +1/+2/+4 h (CatBoost, XGBoost, LightGBM), admitted only if ≥ 5% better than baselines.
3 · ImitationA perfect-foresight MILP expert labels 658,560 states; behaviour cloning + 2 DAgger rounds give the starting policy.
4 · PPO + shield1 M PPO steps per run; MLP vs GRU (last 8 states), 5 seeds each; the shield keeps ≥ 4 h of essential reserve.
5 · One testEverything chosen on 73 validation weeks; Pune 2018 (50 weeks) run once with paired bootstrap CIs.
System architecture

Data

Exploratory analysis

Results — Pune 2018 (50 weeks, run once)

Pre-registered questions (final − other, 95% CI)

Honest negatives: DAgger improved agreement with the expert but not reward, and the GRU (chosen on validation) is slightly worse than the MLP on the test.

PPO validation curvesPune test distributions