A hierarchical training method of generating collective foraging behavior for a robotic swarm