Development of algorithms for building retrofit