Joint energy demand and thermal comfort optimization in photovoltaic-equipped interconnected microgrids