renewable energy energy systems stochastic optimization Thermal gradient Mathematical modeling energy efficiency in buildings