Resource allocation in cooperative and heterogeneous wireless networks with energy harvesting