Optimization of shape and functional structure of buildings as well as heat source utilisation. Partial problems solution