Optimization of heat saving in buildings using unsteady heat transfer model