globals [ generations ; counts how many generations have passed red-count ; population of red turtles blue-count ; population of blue turtles ] turtles-own [ fertility ; the whole number part of fertility fertility-remainder ; the fractional part (after the decimal point) ] to setup clear-output setup-experiment end to setup-experiment ca set generations 0 cct carrying-capacity [ setxy (random-float screen-size-x) (random-float screen-size-y) ; randomize turtle locations ifelse who < (carrying-capacity / 2) ; start out with equal numbers of reds and blues [ set color blue ] [ set color red ] ] setup-plot plot-counts end to go wander reproduce grim-reaper set generations generations + 1 plot-counts end ;; to enable many repetitions with same settings to go-experiment go if red-count = 0 [ print "red extinct after " + generations + " generations" setup-experiment ] if blue-count = 0 [ print "blue extinct after " + generations + " generations" setup-experiment ] end to wander ask turtles [ rt random-float 30 - random-float 30 fd 5 ] end to reproduce ask turtles [ ifelse color = red [ set fertility floor red-fertility set fertility-remainder red-fertility - (floor red-fertility) ] [ set fertility floor blue-fertility set fertility-remainder blue-fertility - (floor blue-fertility) ] ifelse (random-float 100) < (100 * fertility-remainder) [ hatch fertility + 1 [] ] [ hatch fertility [] ] ] end ;; kill turtles in excess of carrying capacity ;; note that reds and blues have equal probability of dying to grim-reaper locals [ num-turtles chance-to-die ] set num-turtles count turtles if num-turtles <= carrying-capacity [ stop ] set chance-to-die (num-turtles - carrying-capacity) / num-turtles ask turtles [ if random-float 1.0 < chance-to-die [ die ] ] end to plot-counts set-current-plot "Populations" set red-count count turtles with [ color = red ] set-current-plot-pen "Reds" plot red-count set blue-count count turtles with [ color = blue ] set-current-plot-pen "Blues" plot blue-count set-current-plot-pen "Total" plot count turtles end to setup-plot set-current-plot "Populations" set-plot-y-range 0 floor (carrying-capacity * 1.2) end ; *** NetLogo Model Copyright Notice *** ; ; 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. ; ; Copyright 1998 by Uri Wilensky. All rights reserved. ; ; Permission to use, modify or redistribute this model is hereby granted, ; provided that both of the following requirements are followed: ; a) this copyright notice is included. ; b) this model will not be redistributed for profit without permission ; from Uri Wilensky. ; Contact Uri Wilensky for appropriate licenses for redistribution for ; profit. ; ; This model was converted to NetLogo as part of the project: ; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN ; CLASSROOMS. The project gratefully acknowledges the support of the ; National Science Foundation (REPP program) -- grant number REC #9814682. ; Converted from StarLogoT to NetLogo, 2001. Updated 2002. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1998). NetLogo Simple Birth Rates model. ; http://ccl.northwestern.edu/netlogo/models/SimpleBirthRates. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; In other publications, please use: ; Copyright 1998 by Uri Wilensky. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/SimpleBirthRates ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 290 22 704 457 50 50 4.0 0 10 1 1 1 CC-WINDOW 292 451 703 632 Command Center BUTTON 134 38 255 71 run-experiment go-experiment T 1 T OBSERVER SLIDER 10 75 248 108 carrying-capacity carrying-capacity 1 4000 1000 1 1 turtles BUTTON 6 38 66 71 setup setup NIL 1 T OBSERVER BUTTON 70 38 130 71 go go T 1 T OBSERVER SLIDER 13 147 251 180 red-fertility red-fertility 0.0 10.0 2.0 0.1 1 children SLIDER 12 111 250 144 blue-fertility blue-fertility 0.0 10.0 2.0 0.1 1 children PLOT 4 238 284 514 Populations Generations Population 0.0 50.0 0.0 1200.0 true true PENS "Reds" 1.0 0 -65536 true "Blues" 1.0 0 -16776961 true "Total" 1.0 0 -11352576 true MONITOR 8 185 84 234 Num Reds red-count 3 1 MONITOR 95 184 172 233 Num Blues blue-count 3 1 MONITOR 178 185 268 234 Generations generations 3 1 @#$#@#$#@ WHAT IS IT? ----------- This is a simple model of population genetics. There are two populations, the REDS and the BLUES. Each has settable birth rates. The reds and blues move around and reproduce according to their birth rates. When the carrying capacity of the terrain is exceeded, some agents die (each agent has the same chance of being selected for death) to maintain a relatively constant population. The model allows you to explore how differential birth rates affect the ratio of reds to blues. HOW TO USE IT ------------- Each pass through the GO function represents a generation in the time scale of this model. The CARRYING-CAPACITY slider sets the carrying capacity of the terrain. The model is initialized to have a total population of CARRYING-CAPACITY with half the population reds and half blues. The RED-FERTILITY and BLUE-FERTILITY sliders sets the average number of children the reds and blues have in a generation. For example, a fertility of 3.4 means that each parent will have three children minimum, with a 40% chance of having a fourth child. The NUM BLUES and NUM REDS monitors display the number of reds and blues respectively. The GENERATIONS monitor displays the number of times there has been a birth and dying cycle. The GO button runs the model. A running plot is also displayed of the number of reds, blues and total population (in green). The RUN-EXPERIMENT button lets you experiment with many trials at the same settings. This button outputs the amount of time it takes for either the reds or the blues to die out given a particular set of values for the sliders. After each extinction occurs, all the graphics are cleared and another run begins with the same settings. This way you can see the variance of the number of generations till extinction. THINGS TO NOTICE -------------------- How does differential birth rates affect the population dynamics? Does the population with a higher birth rate always start off growing faster? Does the population with a lower birth rate always end up extinct? THINGS TO TRY ----------------- Try running an experiment with the same settings many times. Does one population always go extinct? How does the number of generations till extinction vary? EXTENDING THE MODEL ------------------- In this model, once the carrying capacity has been exceeded, every member of the population has an equal chance of dying. Try extending the model so that reds and blues have different saturation rates. How does the saturation rate compare with the birthrate in determining the population dynamics? In this model, the original population is set to the carrying capacity (both set to CARRYING-CAPACITY). Would population dynamics be different if these were allowed to vary independently? In this model, reds are red and blues blue and progeny of reds are always red, progeny of blues are always blue. What if you allowed reds to sometimes have blue progeny and vice versa? How would the model dynamics be different? CREDITS AND REFERENCES ---------------------- To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Simple Birth Rates model. http://ccl.northwestern.edu/netlogo/models/SimpleBirthRates. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1998 by Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/SimpleBirthRates for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 arrow true 0 Polygon -7566196 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 box true 0 Polygon -7566196 true true 45 255 255 255 255 45 45 45 circle true 0 Circle -7566196 true true 35 35 230 person false 0 Circle -7566196 true true 155 20 63 Rectangle -7566196 true true 158 79 217 164 Polygon -7566196 true true 158 81 110 129 131 143 158 109 165 110 Polygon -7566196 true true 216 83 267 123 248 143 215 107 Polygon -7566196 true true 167 163 145 234 183 234 183 163 Polygon -7566196 true true 195 163 195 233 227 233 206 159 spacecraft true 0 Polygon -7566196 true true 150 0 180 135 255 255 225 240 150 180 75 240 45 255 120 135 thin-arrow true 0 Polygon -7566196 true true 150 0 0 150 120 150 120 293 180 293 180 150 300 150 truck-down false 0 Polygon -7566196 true true 225 30 225 270 120 270 105 210 60 180 45 30 105 60 105 30 Polygon -8716033 true false 195 75 195 120 240 120 240 75 Polygon -8716033 true false 195 225 195 180 240 180 240 225 truck-left false 0 Polygon -7566196 true true 120 135 225 135 225 210 75 210 75 165 105 165 Polygon -8716033 true false 90 210 105 225 120 210 Polygon -8716033 true false 180 210 195 225 210 210 truck-right false 0 Polygon -7566196 true true 180 135 75 135 75 210 225 210 225 165 195 165 Polygon -8716033 true false 210 210 195 225 180 210 Polygon -8716033 true false 120 210 105 225 90 210 turtle true 0 Polygon -7566196 true true 138 75 162 75 165 105 225 105 225 142 195 135 195 187 225 195 225 225 195 217 195 202 105 202 105 217 75 225 75 195 105 187 105 135 75 142 75 105 135 105 @#$#@#$#@ NetLogo 2.0alpha1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@