Before to choose an algorithm I suggest to read papers like
Camacho-Villalón, Christian L., Marco Dorigo, and Thomas Stützle. ‘Exposing the Grey Wolf, Moth-Flame, Whale, Firefly, Bat, and Antlion Algorithms: Six Misleading Optimization Techniques Inspired by Bestial Metaphors’. International Transactions in Operational Research
It depends on the problem you are aiming to solve. Considering the wireless sensor network as an example, you can collect swarm-data from the sensors, and aggregate them into a dataset, and forward it to the swarm algorithm for optimization.