  Achieving a successful energetic transition through a smarter and greener
electricity grid is a major goal for the 21st century. It is assumed that such
smart grids will be characterized by bidirectional electricity flows coupled
with the use of small renewable generators and a proper efficient information
system. All these bricks might enable end users to take part in the grid
stability by injecting power, or by shaping their consumption against financial
compensation. In this paper, we propose an algorithm that forms coalitions of
agents, called prosumers, that both produce and consume. It is designed to be
used by aggregators that aim at selling the aggregated surplus of production of
the prosumers they control. We rely on real weather data sampled across
stations of a given territory in order to simulate realistic production and
consumption patterns for each prosumer. This approach enables us to capture
geographical correlations among the agents while preserving the diversity due
to different behaviors. As aggregators are bound to the grid operator by a
contract, they seek to maximize their offer while minimizing their risk. The
proposed graph based algorithm takes the underlying correlation structure of
the agents into account and outputs coalitions with both high productivity and
low variability. We show then that the resulting diversified coalitions are
able to generate higher benefits on a constrained energy market, and are more
resilient to random failures of the agents.
