Swarm behaviour, or swarming, is a collective behaviour exhibited by entities, particularly animals, of similar size which aggregate together, perhaps milling about the same spot or perhaps moving en masse or migrating in some direction. It is a highly interdisciplinary topic. As a term, swarming is applied particularly to insects, but can also be applied to any other entity or animal that exhibits swarm behaviour. The term flocking or murmuration can refer specifically to swarm behaviour in birds, herding to refer to swarm behaviour in tetrapods, and shoaling or schooling to refer to swarm behaviour in fish. Phytoplankton also gather in huge swarms called blooms, although these organisms are algae and are not self-propelled the way animals are. By extension, the term “swarm” is applied also to inanimate entities which exhibit parallel behaviours, as in a robot swarm, an earthquake swarm, or a swarm of stars.
From a more abstract point of view, swarm behaviour is the collective motion of a large number of self-propelled entities. From the perspective of the mathematical modeller, it is an emergent behaviour arising from simple rules that are followed by individuals and does not involve any central coordination. Swarm behaviour is also studied by active matter physicists as a phenomenon which is not in thermodynamic equilibrium, and as such requires the development of tools beyond those available from the statistical physics of systems in thermodynamic equilibrium.
Swarm behaviour was first simulated on a computer in 1986 with the simulation program boids. This program simulates simple agents (boids) that are allowed to move according to a set of basic rules. The model was originally designed to mimic the flocking behaviour of birds, but it can be applied also to schooling fish and other swarming entities.