Modeling housing energy demand and optimizing energy supply