NetLogo Models Library:
Heatbugs is an abstract model of the behavior of biologically-inspired agents that attempt to maintain an optimum temperature around themselves. It demonstrates how simple rules defining the behavior of agents can produce several different kinds of emergent behavior.
Heatbugs has been used as a demonstration model for many agent-based modeling toolkits. We provide a NetLogo version to assist users in learning and comparing different toolkits. It demonstrates coding techniques in NetLogo and may be useful as a starting point for building other models.
While this NetLogo model attempts to match the Repast and Swarm versions (see "Credits" below), we haven't done a rigorous comparative analysis of the different versions, so it is possible that there are small inadvertent differences in the underlying rules and behavior.
The bugs move around on a grid of square "patches". A bug may not move to a patch that already has another bug on it.
Each bug radiates a small amount of heat. Heat gradually diffuses through the world; some heat is lost to cooling.
Each bug has an "ideal" temperature it wants to be. The bigger the difference between the temperature of the patch where the bug is and the bug's ideal temperature, the more "unhappy" the bug is. When a bug is unhappy, it moves. If it is too hot, it moves to the coolest adjacent empty patch. Conversely, if a bug is too cold, it moves to the warmest adjacent empty patch. (Note that these bugs aren't smart enough to always move to the best available patch.)
After choosing the number of bugs to create, and setting the model variables, press the GO button to set the heatbugs into motion.
BUG-COUNT: The number of bugs that will inhabit the model
EVAPORATION-RATE: The percentage of the world's heat that evaporates each cycle. A lower number means a world which cools slowly, a higher number is a world which cools quickly.
DIFFUSION-RATE: How much heat a patch (a spot in the world) diffuses to its neighbors. A higher number means that heat diffuses through the world quickly. A lower number means that patches retain more of their heat.
MIN/MAX-IDEAL-TEMP: The minimum and maximum ideal temperatures for heatbugs. Each bug is given an ideal temperature between the min and max ideal temperature.
MIN/MAX-OUTPUT-HEAT: The minimum and maximum heat that heatbugs generate each cycle. Each bug is given a output-heat value between the min and max output heat.
RANDOM-MOVE-CHANCE: The chance that a bug will make a random move even if it would prefer to stay where it is (because no more ideal patch is available).
DEEP-FREEZE: This button removes all heat from the world.
HEAT-UP: This button adds MAX-OUTPUT-HEAT to every patch in the world.
Beneath the view are two "Color By:" buttons. The IDEAL-TEMP button colors the bugs according to their IDEAL-TEMP value. Bugs with higher IDEAL-TEMP values will be brighter. The HAPPINESS button does the same, but is based upon the HAPPINESS value of each agent, with happier bugs being brighter.
The WATCH-HAPPIEST and WATCH-SADDEST buttons will highlight the happiest or saddest bug at the time the button is pressed.
Depending on their ideal temperatures, some bugs will tend to clump together, while others will tend to avoid all other bugs, and others still flutter around the edges of clumps. All of these behaviors are affected as well by the evaporation rate.
The diffusion rate affects the cohesiveness of clumps. If diffusion-rate is slow, many tiny clumps form. Why?
Most interesting behaviors occur when the number of bugs, how much heat they generate, and how quickly the world cools are balanced such that excessive heat does not build up.
Vary EVAPORATION-RATE in relation to the output-heat range of the bugs.
Use the HEAT-UP button to scramble clumped heatbugs and watch as they re-assemble into new clumps.
Randomize the amount of heat bugs generate each cycle.
Allow users to introduce heat into the system with the mouse.
sprout together let us initially place each bug on its own patch with a minimum of code.
Notice how the code does not make any use of X and Y coordinates. The
move-to primitives take care of sensing and motion on a toroidal grid without the need for any explicit coordinate math.
diffuse command is used to diffuse the heat around the patch grid.
Swarm version of Heatbugs -- https://web.archive.org/web/20130211011213/http://www.swarm.org/wiki/Examples_of_Swarm_applications
RePast version of Heatbugs -- http://repast.sourceforge.net/repast_3/examples/
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 2004 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 email@example.com.
This model was created 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.