A Generic Model for Swarm Intelligence and Its Validations