Population Growth
WHAT IS IT?
This project explores the growth of a population. In this model, agents reproduce by fission every birth-frequency units of age.
HOW TO USE IT
Running the model simply means setting the initial population with the slider named population, and choosing how many age units must pass before reproduction using the "birth-frequency" slider. Then click the "Go" button to start the model. To export time-series data, you must first open the "Output Window" from the Windows menu. Do a "Save Output As..." to your local drive (home directory) as the file simple-data.txt, then click the Save button. After this, the data in that file will automatically be cleared out each time you click this model's "Setup" button, and rewritten as the model runs. Time-series data is output as ordered pairs of the form [time , population], for example [6 , 56] for 6 time units and 56 plants. There is one row for each of these data points. Use the Stopall button to stop the program.
THINGS TO NOTICE
Watch the plot to see how the population changes over time.
EXPLORATIONS
Under the current setting, the agents can survive and reproduce up to a point. You can run the simulation with different initial-population size and the birth-frequency. Is the current environment capable of supporting an infinite number of agents, or is there a limit? How is that limit determined? How does the birth-frequency rate affect the shape of the graph? How does the initial-population affect the shape of the graph? How are these two quantities birth-frequency and the initial-population related in the population of turtles?
STARLOGO FEATURES
The turtles in this model are asked to move to an empty spot by leaping randomly. The graphs are implemented in the "old-style" rather than using the plot wizard.
Turtle procedures
;; grow procedure
;; called by Start-Growthe observer procedure
;; If the turtle is at the correct age to reproduce, it hatches a new turtle and moves it to an empty spot.
;; Age is increased by 1. If there are more than 4 turtles on a patch, the program stops.
;;
to grow
if ((age mod Birth-frequency) = 0)
[hatch [setc (color + 0.2) move-to-empty]]
if count-turtles > (4 * screen-height * screen-width) ;;Block overpopulation
[stopall]
set age age + 1
end
;; move-to-empty procedure
;; called by grow procedure
;; If there is more than one turtle here, wiggle and leap randomly to a new spot.
;;
to move-to-empty
if count-turtles-here > 1
[lt (random 15) rt (random 15) leap random 30]
end
Observer procedures
globals [time] ; time
turtles-own [age] ; age of turtle
;; to setup
;; called by the Setup button
;; Clears all and initializes time to 0
;; Creates the initial population, sets them in random positions,
;; sets their age to some random value between 0 - 49 then sets up the graph and the output file.
;;
to setup
ca
set time 0
create-and-do population
[setc 3
setxy random screen-width random screen-height
set age (random 50)]
setup-graph
reset-output-file
end
;; setup-graph procedure
;; called by setup procedure
;; Creates the graph, the title, axes, and colors of the curves.
;;
to setup-graph ;create the graph: title, axes, colors for the curves
pp 1 ppreset setppc black ppd ; population
setplot-title "Mad Growers"
setplot-yrange 0 200
setplot-xrange 0 10
viewplot
end
;; reset-output-file procedure
;; called by setup procedure
;; Sets the output file name, clears and saves the output window.
;;
to reset-output-file
set-output-name "simple-data"
clear-output ; reset the output window for data file clearing
save-output ; clear data file
set-output-name "simple-data"
end
;; output-data procedure
;; called by Start-Growth procedure
;; Types a new line of data into the output file with a carriage-return at the end of each line.
;;
to output-data
set time time + 1
type time type ","
print count-turtles
end
;; Start-Growth procedure
;; called by the Grow button
;; Each iteration the turtles are asked to grow and the count of turtles is plotted and output to
;; the simple-data file.
;;
to Start-Growth
loop
[ask-turtles [grow]
pp1 plot count-turtles
output-data]
save-output
end
