Logistic Growth
WHAT IS IT?
This project explores logistic growth of a plant population. In this model, agents represent plants. Agents disperse seeds every birth-frequency units of age and seeds must have a plant-less spot to grow upon.
HOW TO USE IT
Running the model simply means setting the initial population with the slider so named, and choosing how many age units must pass between seeds being produced and dispersed 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 logistic-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.
THINGS TO NOTICE
Watch the plot to see how the plant population changes over time.
EXPLORATIONS
Under the current setting, the agents can survive and spread seed as long as space allows. 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. Note that the plants are implemented as patches and the seeds are implemented as turtles.
Turtle procedures
;; move-to-empty procedure
;; called by grow-SpaceLovers observer 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 > 0
[lt (random 15) rt (random 15) leap random 10]
end
Observer procedures
patches-own [SpaceLover-age] ; age of the plant
globals [time] ; time
;; setup-graph procedure
;; called by setup-Spacelovers
;; Creates the graph, the title, axes, and colors of the curves.
;;
to setup-graph
pp 1 ppreset
setppc green
ppu
setplot-title "SpaceLovers"
setplot-yrange 0 200
setplot-xrange 0 10
viewplot
end
;; to setup-SpaceLovers
;; called by the Setup button
;; Creates the initial population of plants, sets them in random positions,
;; sets their age to some random value between 0 - 49, and stamps the spot
;; below the turtle green, then has the turtles die.
;; Then sets up the graph and the output file.
;;
to setup-SpaceLovers
ca
create-and-do initial-population
[setxy (random screen-width) (random screen-height)
set SpaceLover-age random 50
stamp green
die]
setup-graph
reset-output-file
end
;; to grow-SpaceLovers
;; called by the Grow button
;; Each iteration, the plant age is incremented and if the plant is at the correct age to reproduce,
;; and it is green, then this turtle sprouts a new one. The newly sprouted turtle or "seed" is given
;; a random heading and asked to find an empty spot. Once the seed has found a spot, it colors the
;; spot green (becomes a plant) and has age set to 1.
;; Time is incremented and the plot and output are updated.
;; If there are no more empty spots, the output is saved and the program stops.
;;
to grow-SpaceLovers
ask-patches [
set SpaceLover-age (SpaceLover-age + 1)
if ((SpaceLover-age mod Birth-frequency) = 0) and (pc = green) [
sprout [
seth random 360
move-to-empty
stamp green
set SpaceLover-age 1
die
]
]
]
set time time + 1
pp1 plot count-pc green
output-data
if (count-pc black) = 0
[save-output stopall]
end
;; output-data procedure
;; called by grow-SpaceLovers
;; Types a new line of data into the output file with a carriage-return at the end of each line.
;;
to output-data
type time
type ","
print count-turtles
end
;; reset-output-file procedure
;; called by setup-SpaceLovers
;; Sets the output file name, clears and saves the output window.
to reset-output-file
set-output-name "logistic-data"
clear-output ; reset the output window for data file clearing
save-output ; clear data file
set-output-name "logistic-data"
end
