ADVANCED ENERGY MANAGEMENT FOR RESIDENTIAL BUILDINGS OPTIMIZING COSTS