The ability to synchronize behaviors is a common property in self organizing systems in nature. Some examples are: fireflies, which in some species are able to synchronize their flashes, or crickets, which in some species are able to synchronize their chirping. Cicadas a kind of insect has a synchronized development and emergent from their larval states. in certain periods which are prime numbers of years. Nuerons in the brain are able to synchronize their firing. Heart cells synchronize their beatings. All these seem to have some adaptive significance and have been enabled via natural selection. In this subunit we are going to look at one example, the example of fireflies flashing. So, if you are lucky, you've seen at some point this phenomenon. of synchronized firefly flashing. I'm going to show you this video. So, the little points of light are individual fireflies. And, you can see them very quickly many of them start to flash in unison. And, the synchronized flash gets stronger as more of the fireflies are recruited to flash in unison. It seems to be about one flash per second It is very very striking. So, similar to our discussion of flocking and schooling. We can ask why do these kind of systems synchronize? Well at least in the case of fireflies, there seems to be an explanation in terms of matting. Again there is multiple hypotheses. One hypothesis is that the synchronized flashing makes the male location more visible to the females. So, the females can come and find the males It also makes small groups of males appear larger, and perhaps that means they are more attractive to females. It reduces noise. That is males can more easily spot females in the dark between the flashes rather than have to find them all, while everyone is flashing chaotically. These are all hypotheses. Perhaps all of them are correct. Perhaps some of them. Nobody really knows for sure yet. But, it does seem to be an adaptive trait. Then, there is the question of how to synchronize. So, the assumption is that there is no leader leading the synchronization. Each individual firefly only sees its neighbors flashing. Now, what has been discovered is that each firefly itself is a natural oscillator that has a natural flashing frequency of about 1 second. That occurs because of brain activity. Excitation builds up in its neuron reaching some threshold which leads to a flash. So, there is a natural timing for this. However, if the firefly sees its neighbor flashing, this either resets its cycle, that is its excitation is set to zero, or speeds up its cycle perhaps depending on the species. But the result, that people have shown of a group of these oscillators that interact is synchrony of the kind we just saw, and this is called synchrony via coupled oscillators. So, similar to the flocking examples. Here we have a very simple mechanism that produces decentralized synchronization. and we can model it pretty easily using netlogo So let's look at a model, we are going to look at the Netlogo fireflies model which is in the biology section of the models library. And, what happens in that model, we will look at it in a second. We are going to have a number of fireflies, each one is a natural oscillator It has its own clock. Where after a number of ticks it's going to flash. let's say the cycle length is ten. Whenever the clock reads zero the firefly flashes. And then after it flashes it counts up to nine. And then it hits zero again and flashes. So everytime it reaches the maximum . it sets the clock to zero and flashes. All the fireflies in the model have the same cycle length. But each of them once you do setup is going to begin at some random point in their cycle. So they aren't going to begin at zero, they are going to begin at some random point. So, let's take a look at that. So I've opened NetLogo. I'm going to go to the models library. Go to biology. Go to fireflies. And, I open it up. So to illustrate how it works, let's start with just one firefly. So, the thing to look at now is how many fireflies we have. and the cycle length we have set to ten ticks. So we do setup. Here is our firefly right down here. This little gray triangle. And let's do, let's slow it down a bit and do go. And what you are going to see is it moving around. You see the world wraps around at the edges. And every ten ticks it flashes. So there is nobody else for it to interact with so, it's going to go along flashing At that same cycle. Ok, I'm going to stop it. Now let's start with two fireflies. So here I start. Here's one way over here you can't really see it. And this one note that they start at different points in their cycle. This one by random chance started at the flashing point in it's cycle. This one started at a different point so now when I do go you can see flashing but at different times and similarly let's say I start at a well we will do 45. You are going to see different ones flashing at different times. Ok let's look at how they interact. When a firefly perceives another firefly or one or more fireflies flashing near them. and they look at a radius of one patch, so they can only see one patch. around them. They are going to use this information to reset their own clocks. So here is how that works. each firefly has a parameter of flash length which is how many ticks per flash. In the version we looked at. a second ago it was one tick per flash So you can think of it as one tick. For now, We can reset it. They also have a parameter called flashes to reset, which gives the number of other fireflies to see flashing in other to change to change their clock so they have to look in one patch around them at each time step the count the number of fireflies they see that are flashing, and they can use one of two rules. The first one is called phase delay and here is how that works So if I am a firefly. if I saw enough flashes in my vision radius. that is if you go back to flashes to reset gives that number how many flashes I have to see in my radius to change my clock. If I do see enough, I am going to reset my clock. to flash length. Flash legnth to one tick. I'm going to reset my clock to one. everybody flashes on zero. So when my clock says zero I flash so if I reset my clock to one that means that I've actually gone backwards to wherever I use to be. back to where I would have flashes. and so what that does is it synchronizes me to the flash i just saw. Because everyone else I just saw who was flashing. Had just flashed so their clock is all at one. or two if flash length is two and so on. So it synchronizes with the other fireflies that I saw in my neighborhood So that's called the delay because it really effectively sets my clock back. to be in synch with the one I saw. There is another possible rule called the phase advance So if I saw enough flashes in my vision radius I'd then reset my clock to zero. So I'm sort of advancing my clock and I flash immediately. So we can experiment with those two rules. But let's look at what the behavior looks like So notice that the strategy here is set to delay The flash is set to reset. That is the number I need to see in my neighborhood in order to reset my clock is one. So i just need to see one. The flash length is one tick. The cycle length is ten ticks. Ok, show dark fireflies just shows the gray ones. The ones who aren't flashing. If I turn that off, those ones disappear. I won't do that for now. Now, I'm going to see the number to let's say seven a little over seven hundred Ok, so setup. Now there is alot of them and go Let's speed this up a little bit. On this plot we can see that each time set how many are flashing That's what this gives. So they are all interacting with each other. So you will start to see this number increasing here which means that more and more of them are getting into synchronization. And it's growing quickly It's going down a little bit. The randomness comes from the fact that they are moving around at random So they interact in a random way. But they are definitely getting more and more in synch with their flashes. We can see that better if I slow it down a bit So now you can see a really synchronized flashing. So this delay strategy really seems to work. Alright let's stop So now you can see relatively simple set of rules that each firefly obeys Each firefly only interacts with it's nearest neighbors one patch away and yet we can get the whole to group in almost perfect synchrony. If I went longer it would be even better, we would get to perfect synchrony without any individual firefly having any global knowledge of what's going on So let's do a little quiz where you play with this model yourself.