A Model for Swarm Formation with Reference Tracking