Optimal regulation of energy network expansion when costs are stochastic