Distributed Optimization for Smart Cyber-Physical Networks