Optimal configuration of future electricity grid