Residential and office building optimization