Sugarscape Seasonal Migration
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model is about seasonal migration, like it was stated in Epstein & Axtell's Sugarscape Growing Artificial Societies: Social Science from the Bottom Up. It provides a ground-up simulation of seasonal change, where there are two hemispheres, a winter and a summer that alternates.
This configuration leads to some turtles to migrate, looking for more sugar and other turtles remains in the place, like some kind of hibernation.
HOW IT WORKS
Each patch contains some sugar, the maximum amount of which is predetermined. At each tick, each patch regains some fraction of sugar, depending if it is winter or not, more sugar in summer and less sugar in winter. The amount of sugar a patch currently contains is indicated by its color; the darker the yellow, the more sugar.
At setup, agents are placed at random within the world. Each agent can only see a certain distance horizontally and vertically. At each tick, each agent will move to the nearest unoccupied location within their vision range with the most sugar, and collect all the sugar there. If its current location has as much or more sugar than any unoccupied location it can see, it will stay put.
Agents also use (and thus lose) a certain amount of sugar each tick, based on their metabolism rates. If an agent runs out of sugar, it dies.
There is not a replace for the turtle who dies.
HOW TO USE IT
The INITIAL-POPULATION slider sets how many agents are in the world.
The MINIMUM-SUGAR-ENDOWMENT and MAXIMUM-SUGAR-ENDOWMENT sliders set the initial amount of sugar ("wealth") each agent has when it hatches. The actual value is randomly chosen from the given range.
Press SETUP to populate the world with agents and import the sugar map data. GO will run the simulation continuously, while GO ONCE will run one tick.
The VISUALIZATION chooser gives different visualization options and may be changed while the GO button is pressed. When NO-VISUALIZATION is selected all the agents will be red. When COLOR-AGENTS-BY-VISION is selected the agents with the longest vision will be darkest and, similarly, when COLOR-AGENTS-BY-METABOLISM is selected the agents with the lowest metabolism will be darkest.
The WEALTH-DISTRIBUTION histogram on the right shows the distribution of wealth.
The LORENZ CURVE plot shows what percent of the wealth is held by what percent of the population, and the the GINI-INDEX V. TIME plot shows a measure of the inequity of the distribution over time. A GINI-INDEX of 0 equates to everyone having the exact same amount of wealth (collected sugar), and a GINI-INDEX of 1 equates to the most skewed wealth distribution possible, where a single person has all the sugar, and no one else has any.
The season (estaciones?) slider turn on the winter and summer alternate in each hemisphere
THINGS TO NOTICE
After running the model for a while with the seasonal slider turned on, some agents start to migrate to the hemisphere where there is summer and some other agents remains in place in sme kinf od hivernation. This behaviour is not preprogrammed but an emergent property.
You can watch how the turtles as whole move in a diagonal basis, despite the fact that each turtle can move just in a straight line. This is also an emergent property.
THINGS TO TRY
How does the initial population affect the seasonal behaviour? How long does it take for the turtles to start to go to the other hemisphere?
NETLOGO FEATURES
All of the Sugarscape models create the world by using file-read
to import data from an external file, sugar-map.txt
. This file defines both the initial and the maximum sugar value for each patch in the world.
Since agents cannot see diagonally we cannot use in-radius
to find the patches in the agents' vision. Instead, we use at-points
.
RELATED MODELS
Other models in the NetLogo Sugarscape suite include:
- Sugarscape 1 Immediate Growback
- Sugarscape 2 Constant Growback
- Sugarscape 3 Wealth distribution
CREDITS AND REFERENCES
Epstein, J. and Axtell, R. (1996). Growing Artificial Societies: Social Science from the Bottom Up. Washington, D.C.: Brookings Institution Press.
This model is based on Li, J. and Wilensky, U. (2009). NetLogo Sugarscape 3 Wealth Distribution model. http://ccl.northwestern.edu/netlogo/models/Sugarscape3WealthDistribution. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
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:
- Diaz Cordova, D, (2022). Netlogo Sugarscape 4. Seasonal migration model. Universidad Nacional de Lanús. Argentina
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 2009 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.
Comments and Questions
extensions [matrix] globals [ gini-index-reserve lorenz-points winter? ;;variable para el invierno duraciontotal ;; duracion del invierno ] ;; posibles agregados: enfermedades contagiosas, prediposición a enfermarse tomando en cuenta un metabolismo que no es satisfecha ;; ECT diabetes, prediabetes, normal -> tortugas profesionales de la salud; distribución de recursos y herencia ;; azucar limitar los recursos; azucar contaminada ;; accidentes; azucar se contamine siempre y cuando haya muchas tortugas alrededor ;; cuando la tortuga consume azucar genera deshecho turtles-own [ sugar ;; the amount of sugar this turtle has metabolism ;; the amount of sugar that each turtles loses each tick vision ;; the distance that this turtle can see in the horizontal and vertical directions vision-points ;; the points that this turtle can see in relative to it's current position (based on vision) age ;; the current age of this turtle (in ticks) max-age ;; the age at which this turtle will die of natural causes ] patches-own [ psugar ;; the amount of sugar on this patch max-psugar ;; the maximum amount of sugar that can be on this patch ] ;; ;; Setup Procedures ;; to setup if maximum-sugar-endowment <= minimum-sugar-endowment [ user-message "Oops: the maximum-sugar-endowment must be larger than the minimum-sugar-endowment" stop ] clear-all create-turtles initial-population [ turtle-setup ] setup-patches update-lorenz-and-gini set winter? true ;;indica si es true que hay invierno en el hemisferio norte (y verano en el sur) set duraciontotal 40 ;;indica cuantos ticks dura el invierno/verano reset-ticks end to turtle-setup ;; turtle procedure set color red set shape "turtle" ;move-to one-of patches with [not any? other turtles-here] set sugar random-in-range minimum-sugar-endowment maximum-sugar-endowment set metabolism random-in-range 1 4 set max-age random-in-range 60 100 set age 0 set vision random-in-range 1 10 ;; turtles can look horizontally and vertically up to vision patches ;; but cannot look diagonally at all set vision-points [] foreach (range 1 (vision + 1)) [ n -> set vision-points sentence vision-points (list (list 0 n) (list n 0) (list 0 (- n)) (list (- n) 0)) ] move-to one-of patches with [(pxcor < 15 and pycor >= 0) and (pxcor < 15 and pycor < 15)] ;[(pxcor < 21 and pycor > 9) and (pxcor > 9 and pycor < 21)] run visualization end to setup-patches let m matrix:from-row-list [[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2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3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]] let i 0 let j 0 ;let m1 matrix:transpose m ;; let row-i matrix:get-row m i ask patches with [pxcor = i and pycor = j] ;[set max-psugar item rowx row-i let rowx 49 repeat 50 [ repeat 50 [let row-i matrix:get-row m i ask patches with [pxcor = i and pycor = j] [set max-psugar item rowx row-i ;ask patches with [pxcor = i and pycor = j] [set max-psugar item rowx (matrix:get-row m i) set psugar max-psugar patch-recolor ] set rowx rowx - 1 set j j + 1 ] set i i + 1 set j 0 set rowx 49] ;ask patches [patch-recolor] ;file-open "sugar-map.txt" ;foreach sort patches [ p -> ; ask p [ ; set max-psugar file-read ; set psugar max-psugar ; patch-recolor ; ] ;] ;file-close end ;; ;; Runtime Procedures ;; to go if not any? turtles [ stop ] ask patches [ ;pregunto si hay invierno ifelse (estaciones? = true) [ ifelse (winter? = true) [ifelse (pxcor + 48 = pycor * -1) or (pxcor * -1 + 48 = pycor) and (pxcor > pycor * -1 + 48) or (pxcor * -1 + 48 > pycor) [patch-growbackwinter] [patch-growback] ] [ifelse (pxcor + 48 = pycor * -1) or (pxcor * -1 + 48 = pycor) and (pxcor > pycor * -1 + 48) or (pxcor * -1 + 48 > pycor) [patch-growback] [patch-growbackwinter] ] ] [patch-growbacknormal ] patch-recolor ] ask turtles [ turtle-move turtle-eat set age (age + 1) if sugar <= 0 ;or age > max-age [ ;hatch 1 [ turtle-setup ] die ] run visualization ] update-lorenz-and-gini ;;invierno y verano if (ticks mod duraciontotal = 0) [ifelse (winter? = true) [set winter? false] [set winter? true] ] tick end to turtle-move ;; turtle procedure ;; consider moving to unoccupied patches in our vision, as well as staying at the current patch let move-candidates (patch-set patch-here (patches at-points vision-points) with [not any? turtles-here]) let possible-winners move-candidates with-max [psugar] if any? possible-winners [ ;; if there are any such patches move to one of the patches that is closest move-to min-one-of possible-winners [distance myself] ] end to turtle-eat ;; turtle procedure ;; metabolize some sugar, and eat all the sugar on the current patch set sugar (sugar - metabolism + psugar) set psugar 0 end to patch-recolor ;; patch procedure ;; color patches based on the amount of sugar they have if psugar < 0 [set psugar 0] set pcolor (yellow + 4.9 - psugar) end to patch-growbacknormal ;; patch procedure ;; gradually grow back all of the sugar for the patch, en el original decía 1 en vez de 0.5 set psugar min (list max-psugar (psugar + 0.5)) end to patch-growback ;; patch procedure ;; gradually grow back all of the sugar for the patch set psugar min (list max-psugar (psugar + 1)) end ;;agrego crecimiento invernal to patch-growbackwinter ;; patch procedure ;; gradually grow back all of the sugar for the patch set psugar min (list max-psugar (psugar + (1 / 8))) end to update-lorenz-and-gini let num-people count turtles let sorted-wealths sort [sugar] of turtles let total-wealth sum sorted-wealths let wealth-sum-so-far 0 let index 0 set gini-index-reserve 0 set lorenz-points [] repeat num-people [ set wealth-sum-so-far (wealth-sum-so-far + item index sorted-wealths) set lorenz-points lput ((wealth-sum-so-far / total-wealth) * 100) lorenz-points set index (index + 1) set gini-index-reserve gini-index-reserve + (index / num-people) - (wealth-sum-so-far / total-wealth) ] end ;; ;; Utilities ;; to-report random-in-range [low high] report low + random (high - low + 1) end ;; ;; Visualization Procedures ;; to no-visualization ;; turtle procedure set color red end to color-agents-by-vision ;; turtle procedure set color red - (vision - 3.5) end to color-agents-by-metabolism ;; turtle procedure set color red + (metabolism - 2.5) end ; Copyright 2009 Uri Wilensky. ; See Info tab for full copyright and license.
There are 5 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Sugarscape Seasonal Migration.png | preview | Preview for 'Sugarscape Seasonal Migration' | almost 3 years ago, by Diego Díaz Córdova | Download |
Diego Díaz Córdova
error in modelin commons not in netlogo desktop
when I run this model in netlogo desktop, it all fine, but here in modelingcommons it launchs an error "ITEM expected this input to be a string or list, but got a number instead", I don't understand if it is modelingcommons' problem or something is wrong with the code (but in desktop it runs with any problem)
Posted almost 3 years ago
Hendra Kusumah
Maybe it's a bug, try this.. (Question)
let row-i matrix:get-row m i ask patches with [pxcor = i and pycor = j] [set max-psugar item rowx row-i
Posted over 2 years ago
Diego Díaz Córdova
you're right!!!
you are a genious!!! thank you so so so so much!!! now it works!!! thank you Hendra!
Posted over 2 years ago