Math in… Flocking

In a flock, birds make their movement decisions independently yet somehow move together in tight formations without colliding. How do they manage this?

While what birds actually think while flocking remains a mystery, we have some sense for what their considerations might be based on our attempts to simulate them!

In 1986, computer scientist Craig Reynolds developed a program for simulating the flocking behavior of birds, fish, and other creatures. He called his simulated critters "boids."

While flocking, each boid looks at its neighbors and notes their positions and directions of travel.

Each boid has three objectives:

Alignment: It wants to head in the same direction as its neighbors, since they're on a journey together

Cohesion: It wants to be surrounded by its neighbors, since that's safest from predators

Separation: It wants to avoid flying directly toward a neighbor, since that could result in a collision

A boid iteratively updates its flight direction to satisfy its goals:

For alignment, a nice candidate for a flight direction is the average direction of all neighbors

For cohesion, it's toward the centroid of its neighbors – i.e., the average of their positions

For separation, it's the average of the directions directly away from its neighbors

These three directions are rarely the same, so the simulation takes a weighted average of the three as the boid's new direction. Deciding the values for those weights is akin to deciding how much the boids care about each of these goals.

Reynolds' models were what underpinned the movement logic of bat swarms and penguin armies in the film Batman Returns.

Flocking algorithms have been refined since then, but the basic principle is the same: simple individual decisions lead to complex emergent behavior.

What other factors might help us model flocking?

Nick Rauh

Nick is a Seattle-based mathematician who has spent his career teaching at colleges and designing math activities for K-12 children. He is currently the Mathematician in Residence at the Seattle Universal Math Museum.

https://maththem.blogspot.com
Previous
Previous

Math in… April Fools

Next
Next

Math in… Pasta