Optimization methods over networks for popular content delivery and distributed machine learning