Device sampling and resource optimization for federated learning in cooperative edge networks