A stochastic programming model for an energy planning problem: formulation, solution method and application