Optimizing resource allocation in eh-enabled internet of things