Optimal Allocation of Available Resources to Improve the Reliability of building Systems