Philip Ball delves into the dynamics of how flocks of sheep move together and the surprising physics behind the collective motion of animals
You’re probably familiar with the old joke about a physicist who, when asked to use science to help a dairy farmer, begins by approximating a spherical cow in a vacuum. But maybe it’s time to challenge this satire on how physics-based models can absurdly over-simplify systems as complex as farm animals. Sure, if you want to understand how a cow or a sheep works, approximating those creatures as spheres might not be such a good idea. But if you want to understand a herd or a flock, you can learn a lot by reducing individual animals to mere particles – if not spheres, then at least ovoids (or bovoids; see what I did there?).
By taking that approach, researchers over the past few years have not only shed new insight on the behaviour of sheep flocks but also begun to explain how shepherds do what they do – and might even be able to offer them new tips about controlling their flocks. Welcome to the emerging science of sheep physics.
“Boids” of a feather
Physics-based models of the group dynamics of living organisms go back a long way. In 1987 Craig Reynolds, a software engineer with the California-based computer company Symbolics, wrote an algorithm to try to mimic the flocking of birds. By watching blackbirds flock in a local cemetery, Reynolds intuited that each bird responds to the motions of its immediate neighbours according to some simple rules.
His simulated birds, which he called “boids” (a fusion of bird and droid), would each match their speed and orientation to those of others nearby, and would avoid collisions as if there was a repulsive force between them. Those rules alone were enough to generate group movements resembling the striking flocks or “murmurations” of real-life blackbirds and starlings, that swoop and fly together in seemingly perfect unison. Reynolds’ algorithms were adapted for film animations such as the herd of wildebeest in The Lion King.
Over the next two or three decades, these models were modified and extended by other researchers, including the future Nobel-prize-winning physicist Giorgio Parisi, to study collective motions of organisms ranging from birds to schooling fish and swarming bacteria. Those studies fed into the emerging science of active matter, in which particles – which could be simple colloids – move under their own propulsion. In the late 1990s physicist Tamás Vicsek and his student Andras Czirók, at Eötvös University in Budapest, revealed analogies between the collective movements of such self-propelled particles and the reorientation of magnetic spins in regular arrays, which also “feel” and respond to what their neighbours are doing (Phys. Rev. Lett. 82 209; J. Phys. A: Math. Gen. 30 1375).
In particular, the group motion can undergo abrupt phase transitions – global shifts in the pattern of behaviour, analogous to how matter can switch to a bulk magnetized state – as the factors governing individual motion, such as average velocity and strength of interactions, are varied. In this way, the collective movements can be summarized in phase diagrams, like those depicting the gaseous, liquid and solid states of matter as variables such as temperature and density are changed.
Models like these have now been used to explore the dynamics not just of animals and bacteria, but also of road traffic and human pedestrians. They can predict the kinds of complex behaviours seen in the real world, such as stop-and-start waves in traffic congestion or the switch to a crowd panic state. And yet the way they represent the individual agents seems – for humans anyway – almost insultingly simple, as if we are nothing but featureless particles propelled by blind forces.
Follow the leader
If these models work for humans, you might imagine they’d be fine for sheep too – which, let’s face it, seem behaviourally and psychologically rather unsophisticated compared with us. But if that’s how you think of sheep, you’ve probably never had to shepherd them. Sheep are decidedly idiosyncratic particles.
“Why should birds, fish or sheep behave like magnetic spins?” asks Fernando Peruani of the University of Cergy Paris. “As physicists we may want that, but animals may have a different opinion.” To understand how flocks of sheep actually behave, Peruani and his colleagues first looked at the available data, and then tried to work out how to describe and explain the behaviours that they saw.
1 Are sheep like magnetic spins?
In a magnetic material, magnetic spins interact to promote their mutual alignment (or anti-alignment, depending on the material). In the model of collective sheep motion devised by Fernando Peruani from the University of Cergy Paris, and colleagues, each sheep is similarly assumed to move in a direction determined by interactions with all the others that depend on their distance apart and their relative angles of orientation. The model predicts the sheep will fall into loose alignment and move in a line, following a leader, that takes a more or less sinuous path over the terrain.
For one thing, says Peruani, “real flocks are not continuously on the move. Animals have to eat, rest, find new feeding areas and so on”. No existing model of collective animal motion could accommodate such intermittent switching between stationary and mobile phases. What’s more, bird murmurations don’t seem to involve any specific individual guiding the collective behaviour, but some animal groups do exhibit a hierarchy of roles.
Elephants, zebras and forest ponies, for example, tend to move in lines such that the animal at the front has a special status. An advantage of such hierarchies is that the groups can respond quickly to decisions made by the leaders, rather than having to come to some consensus within the whole group. On the other hand, it means the group is acting on less information than would be available by pooling that of everyone.
To develop their model of collective sheep behaviour, Peruani and colleagues took a minimalistic approach of watching tiny groups of Merino Arles sheep that consisted of “flocks” of just two to four individuals who were free to move around a large field. They found that the groups spend most of their time grazing but would every so often wander off collectively in a line, following the individual at the front (Nat. Phys. 18 1494).
They also saw that any member of the group is equally likely to take the lead in each of these excursions, selected seemingly at random. In other words, as George Orwell famously suggested for certain pigs, all sheep are equal but some are (temporarily) more equal than others. Peruani and colleagues suspected that this switching of leaders allows some information pooling without forcing the group to be constantly negotiating a decision.
The researchers then devised a simple model of the process in which each individual has some probability of switching from the grazing to the moving state and vice versa – rather like the transition probability for emission of a photon from an excited atom. The empirical data suggested that this probability depends on the group size, with the likelihood getting smaller as the group gets bigger. Once an individual sheep has triggered the onset of the “walking phase”, the others follow to maintain group cohesion.
In their model, each individual feels an attractive, cohesive force towards the others and, when moving, tends to align its orientation and velocity with those of its neighbour(s). Peruani and colleagues showed that the model produces episodic switching between a clustered “grazing mode” and collective motion in a line (figure 1). They could also quantify information exchange between the simulated sheep, and found that probabilistic swapping of the leader role does indeed enable the information available to each individual to be pooled efficiently between all.
Although the group size here was tiny, the team has video footage of a large flocks of sheep adopting the same follow-my-leader formation, albeit in multiple lines at once. They are now conducting a range of experiments to get a better understanding of the behavioural rules – for example, using sirens to look at how sheep respond to external stimuli and studying herds composed of sheep of different ages (and thus proclivities) to probe the effects of variability.
The team is also investigating whether individual sheep trained to move between two points can “seed” that behaviour in an entire flock. But such experiments aren’t easy, Peruani says, because it’s hard to recruit shepherds. In Europe, they tend to live in isolation on low wages, and so aren’t the most forthcoming of scientific collaborators.
The good shepherd
Of course, shepherds don’t traditionally rely on trained sheep to move their flocks. Instead, they use sheepdogs that are trained for many months before being put to work in the field. If you’ve ever watched a sheepdog in action, it’s obvious they do an amazingly complex job – and surely one that physics can’t say much about? Yet mechanical engineer Lakshminarayanan Mahadevan at Harvard University in the US says that the sheepdog’s task is basically an exercise in control theory: finding a trajectory that will guide the flock to a particular destination efficiently and accurately.
Mahadevan and colleagues found that even this phenomenon can be described using a relatively simple model (arXiv:2211.04352). From watching YouTube videos of sheepdogs in action, he figured there were two key factors governing the response of the sheep. “Sheep like to stay together,” he says – the flock has cohesion. And second, sheep don’t like sheepdogs – there is repulsion between sheep and dog. “Is that enough – cohesion plus repulsion?” Mahadevan wondered.
The researchers wrote down differential equations to describe the animals’ trajectories and then applied standard optimization techniques to minimize a quantity that captures the desired outcome: moving the flock to a specific location without losing any sheep. Despite the apparent complexity of the dynamical problem, they found it all boiled down to a simple picture. It turns out there are two key parameters that determine the best herding strategy: the size of the flock and the speed with which it moves between initial and final positions.
Four possible outcomes emerged naturally from their model. One is simply that the herding fails: nothing a dog can do will get the flock coherently from point A to point B. This might be the case, for example, if the flock is just too big, or the dog too slow. But there are three shepherding strategies that do work.
One involves the dog continually running from one side of the flock to the other, channelling the sheep in the desired direction. This is the method known to shepherds as “droving”. If, however, the herd is relatively small and the dog is fast, there can be a better technique that the team called “mustering”. Here the dog propels the flock forward by running in corkscrews around it. In this case, the flock keeps changing its overall shape like a wobbly ellipse, first elongating and then contracting around the two orthogonal axes, as if breathing. Both strategies are observed in the field (figure 2).
But the final strategy the model generated, dubbed “driving”, is not a tactic that sheepdogs have been observed to use. In this case, if the flock is large enough, the dog can run into the middle of it and the sheep retreat but don’t scatter. Then the dog can push the flock forward from within, like a driver in a car. This approach will only work if the flock is very strongly cohesive, and it’s not clear that real flocks ever have such pronounced “stickiness”.
2 Shepherding strategies: the three types of herding
In the model of interactions between a sheepdog and its flock developed by Lakshminarayanan Mahadevan at Harvard University and coworkers, optimizing a mathematical function that describes how well the dog transports the flock results in three possible shepherding strategies, depending on the precise parameters in the model. In “droving”, the dog runs from side to side to steer the flock towards the target location. In “mustering”, the dog takes a helix-like trajectory, repeatedly encircling the flock. And in “driving”, the dog steers the flock from “inside” by the aversion – modelled as a repulsive force – of the sheep for the dog.
These three regimes, derived from agent-based models (ABM) and models based on ordinary differential equations (ODE), are plotted above. In the left column, the mean path of the flock (blue) over time is shown as it is driven by a shepherd on a separate path (red) towards a target (green square). Columns 2-4 show snapshots from column 1, with trajectories indicated in black, where fading indicates history. From left to right, snapshots represent the flock at later time points.
These herding scenarios can be plotted on a phase diagram, like the temperature–density diagram for states of matter, but with flock size and speed as the two axes. But do sheepdogs, or their trainers, have an implicit awareness of this phase diagram, even if they did not think of it in those terms? Mahadevan suspects that herding techniques are in fact developed by trial and error – if one strategy doesn’t work, they will try another.
Mahadevan admits that he and his colleagues have neglected some potentially important aspects of the problem. In particular, they assumed that the animals can see in every direction around them. Sheep do have a wide field of vision because, like most prey-type animals, they have eyes on the sides of their heads. But dogs, like most predators, have eyes at the front and therefore a more limited field of view. Mahadevan suspects that incorporating these features of the agents’ vision will shift the phase boundaries, but not alter the phase diagram qualitatively.
Another confounding factor is that sheep might alter their behaviour in different circumstances. Chemical engineer Tuhin Chakrabortty of the Georgia Institute of Technology in Atlanta, together with biomolecular engineer Saad Bhamla, have also used physics-based modelling to look at the shepherding problem. They say that sheep behave differently on their own from how they do in a flock. A lone sheep flees from a dog, but in a flock they employ a more “selfish” strategy, with those on the periphery trying to shove their way inside to be sheltered by the others.
3 Heavy and light: how flocks interact with sheepdogs
In the agent-based model of the interaction between sheep and a sheepdog devised by Tuhin Chakrabortty and Saad Bhamla, sheep may respond to a nearby dog by reorienting themselves to face away from or at right angles to it. Different sheep might have different tendencies for this – “heavy” sheep ignore the dog unless they are facing towards it. The task of the dog could be to align the flock facing away from it (herding) or to divide the flock into differently aligned subgroups (shedding).
What’s more, says Chakrabortty, contrary to the stereotype, sheep can show considerable individual variation in how they respond to a dog. Essentially, the sheep have personalities. Some seem terrified and easily panicked by a dog while others might ignore – or even confront – it. Shepherds traditionally call the former sort of sheep “light”, and the latter “heavy” (figure 3).
In the agent-based model used by Chakrabortty and Bhamla, the outcomes differ depending on whether a herd is predominantly light or heavy (arXiv:2406.06912). When a simulated herd is subjected to the “pressure” of a shepherding dog, it might do one of three things: flee in a disorganized way, shedding panicked individuals; flock in a cohesive group; or just carry on grazing while reorienting to face at right angles to the dog, as if turning away from the threat.
Again these behaviours can be summarized in a 2D phase diagram, with axes representing the size of the herd and what the two researchers call the “specificity of the sheepdog stimulus” (figure 4). This factor depends on the ratio of the controlling stimulus (the strength of sheep–dog repulsion) and random noisiness in the sheep’s response. Chakrabortty and Bhamla say that sheepdog trials are conducted for herd sizes where all three possible outcomes are well represented, creating an exacting test of the dog’s ability to get the herd to do its bidding.
4 Fleeing, flocking and grazing: types of sheep movement
The outcomes of the shepherding model of Chakrabortty and Bhamla can be summarized in a phase diagram showing the different behavioural options – uncoordinated fleeing, controlled flocking, or indifferent grazing – as a function of two model parameters: the size of the flock Ns and the “specificity of stimulus”, which measures how strongly the sheep respond to the dog relative to their inherent randomness of action. Sheepdog trials are typically conducted for a flock size that allows for all three phases.
Into the wild
One of the key differences between the movements of sheep and those of fish or birds is that sheep are constrained to two dimensions. As condensed-matter physicists have come to recognize, the dimensionality of a problem can make a big difference to phase behaviour. Mahadevan says that dolphins make use of dimensionality when they are trying to shepherd schools of fish to feed on. To make them easier to catch, dolphins will often push the fish into shallow water first, converting a 3D problem to a 2D problem. Herders like sheepdogs might also exploit confinement effects to their benefit, for example using fences or topographic features to help contain the flock and simplify the control problem. Researchers haven’t yet explored these issues in their models.
As the case of dolphins shows, herding is a challenge faced by many predators. Mahadevan says he has witnessed such behaviour himself in the wild while observing a pack of wild dogs trying to corral wildebeest. The problem is made more complicated if the prey themselves can deploy group strategies to confound their predator – for example, by breaking the group apart to create confusion or indecision in the attacker, a behaviour seemingly adopted by fish. Then the situation becomes game-theoretic, each side trying to second-guess and outwit the other.
Sheep seem capable of such smart and adaptive responses. Bhamla says they sometimes appear to identify the strategy that a farmer has signalled to the dog and adopt the appropriate behaviour even without much input from the dog itself. And sometimes splitting a flock can be part of the shepherding plan: this is actually a task dogs are set in some sheepdog competitions, and demands considerable skill. Because sheepdogs seem to have an instinct to keep the flock together, they can struggle to overcome that urge and have to be highly trained to split the group intentionally.
Giorgio Parisi: the Nobel-prize winner whose complex interests stretch from spin glasses to starlings
Iain Couzin of the Max Planck Institute of Animal Behavior in Konstanz, Germany, who has worked extensively on agent-based models of collective animal movement, cautions that even if physical models like these seem to reproduce some of the phenomena seen in real life, that doesn’t mean the model’s rules reflect what truly governs the animals’ behaviour. It’s tempting, he says, to get “allured by the beauty of statistical physics” at the expense of the biology. All the same, he adds that whether or not such models truly capture what is going on in the field, they might offer valuable lessons for how to control and guide collectives of agent-like entities.
In particular, the studies of shepherding might reveal strategies that one could program into artificial shepherding agents such as robots or drones. Bhamla and Chakrabortty have in fact suggested how one such swarm control algorithm might be implemented. But it could be harder than it sounds. “Dogs are extremely good at inferring and predicting the idiosyncrasies of individual sheep and of sheep–sheep interactions,” says Chakrabortty. This allows them to adapt their strategy on the fly. “Farmers laugh at the idea of drones or robots,” says Bhamla. “They don’t think the technology is ready yet. The dogs benefit from centuries of directed evolution and training.”
Perhaps the findings could be valuable for another kind of animal herding too. “Maybe this work could be applied to herding kids at a daycare,” Bhamla jokes. “One of us has small kids and recognizes the challenges of herding small toddlers from one room to another, especially at a party. Perhaps there is a lesson here.” As anyone who has ever tried to organize groups of small children might say: good luck with that.