Pages

Sunday, June 4, 2023

Dirty, Disgusting, Filthy, Lice-Ridden Boids

[Title from The Producers]

Long ago I had a screen saver with a simulation of bird flocking behavior – A group of 2000s-era 3D blocks would fly in formation, land, and take off. I was recently reminded of it, and grew curious how it was made. My best guess is that it used a model developed in 1987 called Boids. The model consists of a group of agents (boids) that each act according to a set of simple rules. In this case, the rules are

  • Separation: Avoid flying into nearby flockmates
  • Alignment: Fly in the same average direction as nearby flockmates
  • Cohesion: Fly toward the average position of nearby flockmates

Along with these, I also included a target location that all boids want to get to. There's a lot of details unspecified here, like what "nearby" means, and how these various rules are weighted, e.g. cohesion and separation can be directly opposed at times. I looked at a couple implementations I found online, and tweaked my own model until I got reasonable looking results.

In the simulation below, the boids are all heading for the center of the map, and "nearby" covers about 1/4 of the map. I used "toroidal boundary conditions" which means if a boid goes off one edge, it wraps around to the opposite side. You can see that a few boids sometimes break out of the "nearby" region and head off on their own before rejoining:

I was pretty happy with how this worked out, but I felt like I should give it more of a physics spin. It occurred to me: What if these were relativistic boids? If they're moving at a significant fraction of the speed of light, then the observations they use to follow the rules above are based on the light arrival time, which may not reflect the current motion of a particular boid. What this amounts to is that based on the distance between two boids, their observations are delayed by a certain time. Here's what happens in that situation:

I was really surprised by the results – I expected that they would have a much harder time sticking together, since their actions would be too imprecise, but instead they show better clustering. I think this is because by staying closer, they get more up-to-date measurements, so it ends up being a positive-reinforcement.

I figured I could get a more qualitative comparison by computing some summary statistics. First I looked at the average distance between the boids at each time:

This shows the relativistic boids bunching up quickly, but then oscillating sharply around a higher value than then lowest the non-relativistic boids are able to hit. We can also look at the deviations in the boid's headings for the two cases:

This shows the relativistic boids frequently going in different directions, which we can see in the animation above: The tight grouping requires quickly changing direction to stay in one place.

I'm not sure whether any of the space organizations have plans for high-speed probe swarms, but if they do, I hope this will serve as my grant proposal!

No comments:

Post a Comment