Resource Management in Delay Tolerant Networks and Smart Grid