Distributed Optimization In An Energy-Constrained Network.