Be the sheepdog
Play it. Point, drag or use the arrow keys, and the dog runs there. Get all twenty-four sheep into the corner pen.
Every day so far has been something to read, solve or look at. This one is something to steer: the first piece here that needs your reflexes. It is also a small working copy of a real piece of science, which is the part I find most interesting.
The study
In March 2010, researchers in South Australia put GPS backpacks on 46 merino ewes and one trained Kelpie, gave the dog almost no commands ("bring them home"), and logged everyone's position every second, accurate to 10–20 cm. From those tracks Daniel Strömbom, Andrew King and colleagues built a model of how one dog can move a flock, published in 2014 in the Journal of the Royal Society Interface. The game uses their rules.
What the sheep do
Each sheep has four urges, added together with fixed weights:
- Keep your distance. If another sheep is closer than about a body length, step away. This is the strongest urge.
- Stay near the others. Move towards the middle of your nearest neighbours.
- Get away from the dog. Only if the dog is close enough to bother you.
- Keep going. A sheep partly continues the way it was already heading, plus a little randomness.
When the dog is far away, a sheep mostly stands and grazes, taking an occasional step. That is the whole animal.
What the dog does
The study's dog has two rules and switches between them all the time:
- Driving. If every sheep is close to the middle of the flock, go to a spot behind the flock, on the far side from where they should go, and walk towards them.
- Collecting. If any sheep has wandered too far from the middle, go to a spot just behind the sheep that is furthest out, and push it back towards the group.
"Too far" grows with the size of the flock (in the paper, the spacing between sheep times the flock size to the power ⅔). And if the dog gets very close to any sheep, it stops for a moment. That is the whole dog. There is no plan, no memory, no map.
The weave nobody wrote
Real sheepdogs, driving a flock, swing from side to side behind it. Earlier models had put that zigzag in on purpose. In this model it isn't in the rules at all. It comes out by itself: the flock edges drift, a flank sheep gets too far out, the dog switches to collecting and swings round to that side, the flock tightens, the dog switches back to driving, then the other flank drifts. In the game, press The study's dog and Show what the dog is doing, and the pink trail behind it shows the weave building up. The authors also found the model's dog switched between collecting and driving in about the same proportions as the real Kelpie did.
The surprise: how much each sheep watches
Most famous flocking models (birds, fish) have each animal paying attention to only a handful of neighbours, and that is enough for beautiful group motion. The study found that is not enough to be herded. In their simulations, the dog reliably succeeded only when each sheep was attracted to roughly half of the flock or more; with fewer, success fell off sharply, and with very few it was rare. Herdability needs sheep that care about the whole group, not just the sheep next to them.
I checked this in the game itself, letting the study's dog work 30 fresh fields at each setting, with up to four minutes per field:
each sheep penned time
watches (of 30) (median)
23 (all) 30 24 s
12 (half) 30 32 s
6 1 —
3 1 —
With half the flock, the dog still always wins but sometimes needs over two minutes. With six or three, the flock breaks into little clumps that each hold together but ignore each other; the dog collects one, and another drifts off. You can feel this when you play: with 3 nearest, the sheep stop moving as one animal.
Where my version differs
I scaled things to fit a phone, so the numbers aren't the paper's:
- The field is smaller, and sheep only notice the dog within about a quarter of the field's width (in the paper the range is larger relative to the field).
- Sheep slow down as the dog gets further away instead of moving at one fixed speed, which makes the game feel less twitchy.
- Your dog runs a little faster than the study's (the paper's dog is 1.5 times as fast as a sheep).
- The pen is a corner of the field with open sides; hurdles close it only once all twenty-four are inside, so you need the whole flock in at once.
The weights between the four sheep urges, the noise, the two dog rules and the dog's thresholds are the paper's. The table above is from my version, not from the paper, so treat it as a demonstration that matches their finding, not a measurement of real sheep.
Sources
- Strömbom, D., Mann, R. P., Wilson, A. M., Hailes, S., Morton, A. J., Sumpter, D. J. T. and King, A. J. (2014), Solving the shepherding problem: heuristics for herding autonomous, interacting agents, Journal of the Royal Society Interface 11(100): 20140719. Also as an open PDF from Swansea University.
- Press release on the study, ScienceDaily, 26 August 2014.