Fireflies Model - BehaviorSearch
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
NOTE
This is the BehaviorSearch benchmarking version of the classic NetLogo Fireflies model.
Reference: Stonedahl, F. Doctoral Thesis. [Genetic Algorithms for the Exploration of Parameter Spaces in Agent Based Models] (http://forrest.stonedahl.com/thesis/forreststonedahlthesis.pdf). Northwestern University.
MODIFICATIONS
December 2022:
- Converted to NetLogo 6.3.0 format.
- Removed "visuals?" on-off switch.
March 2011:
- Uses smaller world-size than original, for increased speed.
- Added "visuals?" on-off switch, for increased speed.
- Added "synchrony" measure reporter (doesn't affect model behavior).
WHAT IS IT?
This model demonstrates a population of fireflies which synchronize their flashing using only the interactions between the individual fireflies. It is a good example of how a distributed system (i.e. a system with many interacting elements, but no 'leader') can coordinate itself without any central coordinator.
Though most species of firefly are not generally known to synchronize in groups, there are some (for example, Pteroptyx cribellata, Luciola pupilla,and Pteroptyx malaccae) that have been observed to do so in certain settings. This model generalizes two main strategies used by such insects to synchronize with each other (phase delay and phase advance synchronization, as described below), retaining the essentials of the strategies while downplaying biological detail.
HOW IT WORKS
Each firefly constantly cycles through its own clock, flashing at the beginning of each cycle and then resetting the clock to zero once it has reached the maximum. At the start of each simulation all fireflies begin at a random point in their cycles (though they all have the same cycle lengths) and so flashing will occur erratically through the population. As fireflies perceive other flashes around them they are able to use this information to reset their own clocks to try and synchronize with the other fireflies in their vicinity. Each firefly uses the same set of rules to govern its own clock, and depending on the parameters of the simulation, the population may synchronize more or less effectively.
HOW TO USE IT
GO: starts and stops the simulation.
SETUP: resets the simulation according to the parameters set by the sliders.
NUMBER: sets the number of fireflies to be created.
CYCLE-LENGTH: sets the length of each firefly's clock before it resets to 0.
FLASHES-TO-RESET: sets the number of flashes a firefly must see in a single tick before its clock resets.
FLASH-LENGTH: sets the duration, in ticks, of each flash.
STRATEGY: sets the synchronization strategy to be used when a firefly sees enough other fireflies flashing around it (where "enough" is defined by FLASHES-TO-RESET). There are two possible strategies:
"delay": the firefly resets its clock to the FLASH-LENGTH (just after a flash would normally occur). This causes the firefly to synchronize with the next flash of the firefly it is responding to.
"advance": the firefly flashes immediately. When using this strategy, fireflies can only begin to reset their clocks during a window which begins two ticks after they have flashed. This ensures that flashes do not get stuck in a short cycle where they persistently reset their clocks and stay lit indefinitely.
SHOW-DARK-FIREFLIES?: if switch set to on, non-flashing fireflies are displayed in gray. If switch set to off, non-flashing fireflies are colored black and, thus, invisible.
Some settings need to be set before pressing the SETUP button. Changes to the NUMBER, STRATEGY and FLASH-LENGTH sliders will have no effect on a simulation in progress. FLASHES-TO-RESET, CYCLE-LENGTH and SHOW-DARK-FIREFLIES?, on the other hand, can be modified and will have an effect while the simulation is running.
THINGS TO NOTICE
Using the default settings (number: 1500, cycle-length: 10, flash-length: 1, number-flashes: 1, flashes-to-reset: 1, strategy: "delay"), notice how local clusters of synchronization begin to form. See if you can figure out where each cluster is represented on the plot. As the simulation proceeds, try to determine which local cluster will eventually "take over" the population. Did this cluster originally have the highest spike on the plot?
In phase advance simulations, why do the plots generally top off before the peaks reach the entire population?
In this model fireflies cannot reset their cycle when they are in the middle of a flash. Why was this restriction imposed?
THINGS TO TRY
Run the model with the "delay" strategy in the default settings. Change FLASHES-TO-RESET to 2, and run the model with the "advance" strategy (while keeping the other settings steady). Which strategy seems more effective? Why?
Try adjusting FLASHES-TO-RESET between 0, 1 and 2 using both phase delay and phase advance settings. Notice that each setting will give a characteristically different plot, and some of them do not allow for synchronization at all (for example, with the delay strategy, contrast FLASHES-TO-RESET set to 1 as opposed to 2). Why does this control make such a difference in the outcome of the simulation?
Changing the number of fireflies in a simulation affects the density of the population (as does adjusting the size of the world). What effect does this have on a simulation?
EXTENDING THE MODEL
This model explores only two general strategies for attaining synchrony in such cycle-governed fireflies. Can you find any others? Can you improve the existing strategies (i.e., by speeding them up)?
There are many other possible situations in which distributed agents must synchronize their behavior through the use of simple rules. What if, instead of perceiving only other discrete flashes, an insect could sense where another insect was in its cycle (perhaps by hearing an increasingly loud hum)? What kinds of strategies for synchronization might be useful in such a situation?
If all fireflies had adjustable cycle-lengths (initially set to random intervals) would it then be possible to coordinate both their cycle-lengths and their flashing?
Introduce some blind fireflies. How do the strategies fare with this addition?
NETLOGO FEATURES
Note the use of agentsets to count the number of nearby fireflies that are flashing:
count turtles in-radius 1 with [color = yellow]
CREDITS AND REFERENCES
Buck, John. (1988). Synchronous Rhythmic Flashing of Fireflies. The Quarterly Review of Biology, September 1988, 265 - 286.
Carlson, A.D. & Copeland, J. (1985). Flash Communication in Fireflies. The Quarterly Review of Biology, December 1985, 415 - 433.
HOW TO CITE
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
- Wilensky, U. (1997). NetLogo Fireflies model. http://ccl.northwestern.edu/netlogo/models/Fireflies. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Please cite the NetLogo software as:
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
COPYRIGHT AND LICENSE
Copyright 1997 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.
Comments and Questions
turtles-own [ clock ;; each firefly's clock threshold ;; the clock tick at which a firefly stops its flash reset-level ;; the clock tick a firefly will reset to when it is triggered by other flashing window ;; a firefly can't reset its cycle if (clock <= window) ] globals [ synchrony ] to-report testit setup repeat 1900 [ go ] let sync-list [] repeat 100 [ go set sync-list fput synchrony sync-list ] report median sync-list end to setup clear-all crt number [ setxy random-xcor random-ycor set clock random (round cycle-length) set threshold flash-length ifelse strategy = "delay" [ set reset-level threshold set window -1 ] [ set reset-level 0 set window (threshold + 1) ] set size 2 ;; easier to see recolor ] reset-ticks end to go ;if synchrony = 1 [ stop ] ask turtles [ move increment-clock if ( (clock > window) and (clock >= threshold) ) [ look ] ] ask turtles [ recolor ] tick set synchrony synchrony-measure end to recolor ; turtle procedure ifelse (clock < threshold) [ st set color yellow ] [ set color gray - 2 ifelse show-dark-fireflies? [ st ] [ ht ] ] end to move ; turtle procedure rt random-float 90 - random-float 90 fd 1 end to increment-clock ; turtle procedure set clock (clock + 1) if clock = cycle-length [ set clock 0 ] end to look ; turtle procedure if count turtles in-radius 1 with [color = yellow] >= flashes-to-reset [ set clock reset-level ] end to-report clock-diff [ c1 c2 ] report min (list (abs (c1 - c2)) (cycle-length - (abs (c1 - c2)))) end to-report synchrony-measure let diffsum 0 ask turtles [ ask other turtles [ set diffsum diffsum + clock-diff clock ([clock] of myself) ] ] report 1 - (diffsum / ((count turtles) * (count turtles - 1))) / (cycle-length / 2) end ; Copyright 1997 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created almost 2 years ago by Hendra Kusumah.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Fireflies Model - BehaviorSearch.png | preview | Preview for 'Fireflies Model - BehaviorSearch' | almost 2 years ago, by Hendra Kusumah | Download |
This model does not have any ancestors.
This model does not have any descendants.