In my statistics class we were taught a technique for estimating the number of flies in a barn. You capture a fixed size sample of flies, e.g. 100, and give them each a little white dot on the back, then release them all back in the barn. Leave them to mingle for a while, then capture another fixed number of flies, e.g. 100. If 5 of them have a white dot on them, then you estimate that the 100 flies you captured originally and marked make up 5% of the total population, meaning your estimate of the total population must be 2000 flies.
All these models ignore how insects actually zero in on a smell. For a fly outside, the source of the smell is the gap in the window. What looks like random direction changes is actually a search pattern for that source.
From experience: about 5x as many as you think<p>Story: I was living in a large flatshare that was plagued by flies from nearby horse stables. We were organizing a decent sized party (maybe 40 guests). In the afternoon, we had 15ish items of food that needed to be stored for a few hours until guests arrived. At first we considered covering all the food (creating work and waste of aluminum or plastic foil), then I had the idea to kill all the flies in that room and close the door. We saw about four flies. In the end we killed about 20 before we declared the situation good enough. I don't recall if there was a last fly that we eventually killed, or that we eventually gave up on killing. It took half an hour or so.
This reminds me of the flocking boids algorithm by Craig Reynolds [0] which is based on three principles:<p><pre><code> + separation: steer to avoid crowding local flockmates
+ alignment: steer towards the average heading of local flockmates
+ cohesion: steer to move towards the average position (center of mass) of local flockmates
</code></pre>
The algorithm was used to animate the bat swarms in Batman Returns (1992) [1].<p>I love this algorithm, it's easy to develop and experiment with and the results feel beautiful & natural.<p><pre><code> [0]: https://www.red3d.com/cwr/boids/
[1]: https://en.wikipedia.org/wiki/Boids</code></pre>
Next step is to set up a grid of ESP32s with MEMS microphones and a FFT routine, stream that data to a server and apply some neural network to get to know the real amount of flies by tracking them individually. Then compare this to the model, and keep improving it until it fits.
A tip if you have an annoying fly in your house that's hard to swat. Turn off all the lights except the bathroom. In a few minutes it'll fly in. Close the door and it's mano-a-mano.
In the NetLogo Models Library there are quite a few similar models already, "Moths", "Ants", "Gaslab Maxwells Demon", and more variations (adaptive/nonadaptive, single/flocking etc)<p><a href="http://ccl.northwestern.edu/netlogo/docs/" rel="nofollow">http://ccl.northwestern.edu/netlogo/docs/</a>
If you’re already interested in flies, check out how they behave in nature. They can be quite territorial about their leaf or stick and fights between these agile little beasts are fascinating to watch (extremely quickly orbiting each other).
Well, there was at least one startup that addressed the issue of flies/mosquitoes indoors. Bzigo. <a href="https://bzigo.com/" rel="nofollow">https://bzigo.com/</a><p>It's a machine vision system that tracks mosquitoes and aims a laser pointer on them (so you can swat them). Don't know if this company still exists. It was/is an Israeli start-up and apparently not an April Fool's day joke.<p>It seems to me the best solution is to use screens, but that is not as sexy as machine vision.
Based on my experience, those flies need to be less like jittery dots, and more like kamikaze pilots, hurtling themselves from one side of the simulation to the other, repeatedly.
Lévy flight foraging hypothesis: <a href="https://en.wikipedia.org/wiki/L%C3%A9vy_flight_foraging_hypothesis" rel="nofollow">https://en.wikipedia.org/wiki/L%C3%A9vy_flight_foraging_hypo...</a><p>The scent-tracking mode used here seems to be a sort of variant, in which the long legs are not chosen randomly.<p>WRT the insect density decreasing as some fly away: in reality, others will arrive at approximately the same rate, keeping the density approximately the same, so it is probaby more realistic to put a box around the simulation, e.g. by reversing the direction of those that have moved away to the point that they would be several time-slices away from entering the window even if they flew back in a straight line.
I tried showing the flies using matplotlib.animation.FuncAnimation in a notebook, animating even 1000 frames is slow and it warns the animation becomes too large. Maybe there's a better way to do it? Preferably in a notebook interface.
This sounds like the "how many balls can fit in a bus" interview question, but somehow more entertaining. Possibly because it addresses a real-world situation.
Really interesting work. I love the different models of how a fly moves around. This jumped out at me, though:<p>>If we take a look at the animation now, we can see the flies look slightly more realistic (if not still a bit spazzy)<p>Is "spazzy" a word that's used in different regional dialects of English as a term to just mean jittery? In most of the places I've lived, it's an offensive word.
A fly is unlikely to fly randomly.<p><a href="https://en.wikipedia.org/wiki/L%C3%A9vy_flight" rel="nofollow">https://en.wikipedia.org/wiki/L%C3%A9vy_flight</a>
For some reason this reminds me of the Damien Hirst art work A Thousand Years[1].<p>Next step for me would be to turn the attractor into an Insectecuter.<p>1. <a href="https://damienhirst.com/a-thousand-years" rel="nofollow">https://damienhirst.com/a-thousand-years</a>
> The perfect question for a Sunday afternoon when you have no friends<p>I have one, we both read your post and we just befriended you without authorization