AI for energy optimization in smart buildings