ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
-
Upload
daniel-martin-katz -
Category
Education
-
view
280 -
download
1
description
Transcript of ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
![Page 1: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/1.jpg)
Introduction to Computing for Complex Systems
(Lab Session 2)
Daniel Martin KatzMichigan State University
College of Law
![Page 2: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/2.jpg)
The Complete Code for the
Forest Fire model
![Page 3: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/3.jpg)
The Forest Fire Model
![Page 4: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/4.jpg)
the setup procedure
![Page 5: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/5.jpg)
1st Operation is to Clear Everything
![Page 6: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/6.jpg)
(a) The World Consists of Turtles and Patches
(c) Default is Now “square”
(b) Turtle Can Assume lots of Shapes
(d) What is the plain english version of this line of code?
(e) set-default-shapefor turtlesto “square”
![Page 7: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/7.jpg)
(a) Call on Our Patches Using “Ask Patches”
(b) But Only A Certain Random Set of Patches
![Page 8: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/8.jpg)
look at the brackets, what do these brackets do?
we need to learn these primitives:ask patchesrandom-float
![Page 9: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/9.jpg)
The Ask Primitive
![Page 10: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/10.jpg)
Random-Float
![Page 11: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/11.jpg)
(a) Call on Our Patches Using “Ask Patches”
(b) But Only A Certain Random Set of Patches
(c) Patches With < “Density”
(d) Set Patch Color Green
![Page 12: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/12.jpg)
With What Criteria?pxcor = min-pxcor[Notice The Brackets]
Again it is the “ask” “patches with”
![Page 13: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/13.jpg)
(a) Again it is the “Ask” “Patches With”
(b) pxcor = min-pxcor
(c) To IngniteHere is where pxcor = min-pxcor(i.e. Where Pxcor =0)
![Page 14: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/14.jpg)
How Does It Know What “Ignite” Means?
With What Criteria?pxcor = min-pxcor[Notice The Brackets]
To Do What?Ignite
Consult Netlogo Dictionary?Is it there?
![Page 15: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/15.jpg)
Here is How (We Will Return to This in a Few)
![Page 16: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/16.jpg)
Lets Look at the Set Command
![Page 17: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/17.jpg)
![Page 18: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/18.jpg)
variable= initial-trees
value= count patches with[patchcolor =green]
set variable value
![Page 19: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/19.jpg)
variable= burned-trees
set variable value
value= numeric value of 0
![Page 20: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/20.jpg)
notice how within ‘setup’ these globals are ultimately
assigned a value
![Page 21: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/21.jpg)
Modular Code:
notice how the [ ignite ]
procedures are defined below
![Page 22: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/22.jpg)
“sprout-fires 1” ?
![Page 23: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/23.jpg)
![Page 24: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/24.jpg)
[ set color red]note: color versus pcolorthis implies turtle not patch(see dictionary for distinction)fire turtle is set to red
“sprout-fires 1”sprouting of a turtle from breed = fires and a 1 per patch
set pcolor blacksetting patch color to black
set burned-trees to burned-trees +1
![Page 25: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/25.jpg)
Modular Code:
now notice how [fade-embers]
procedures are defined below
![Page 26: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/26.jpg)
[ set color color - 0.3] makes the red darker
“ask embers”embers are a breed
if color < red - 3.5‘If’ is a conditional
(balance of the command is triggered if condition is met)
Allows a slow fading of embersWhat does color < red - 3.5 imply?
![Page 27: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/27.jpg)
![Page 28: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/28.jpg)
[ set color color - 0.3] makes the red darker
“ask embers”embers are a breed
[set pcolor color die]
if color < red - 3.5‘If’ is a conditional
(balance of the command is triggered if condition is met)
Allows a slow fading of embersWhat does color < red - 3.5 imply?
![Page 29: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/29.jpg)
We will focus upon the ‘to go’
procedure in the next class
![Page 30: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/30.jpg)
3-D perspective on the model as it runs
![Page 31: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/31.jpg)
notice how these turtles on the terrain
![Page 32: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/32.jpg)
![Page 33: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/33.jpg)
Exploration of the Forest Fire Model
(1) Modify the Color of the Forest to Blue
(2) Make the Fire Move North to South Instead of West to East
![Page 34: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/34.jpg)
Modify the Color of the Forest to Blue
![Page 35: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/35.jpg)
What Elements of the Code Do We Modify?
![Page 36: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/36.jpg)
The Forest Fire Model
Procedures
![Page 37: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/37.jpg)
The Forest Fire Model
Procedures
![Page 38: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/38.jpg)
Make the Fire Move North to South Instead of West to East
![Page 39: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/39.jpg)
Make the Fire Move North to South Instead of West to East
![Page 40: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/40.jpg)
What Elements of the Code Do We Modify?
![Page 41: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/41.jpg)
The Forest Fire Model
Procedures
![Page 42: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/42.jpg)
The Forest Fire Model
Procedures
Try this Instead:
![Page 43: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/43.jpg)
What is a Dependancy?
In Class Exercise: Identify Dependancies
in Fire Model
Why Does It Matter?
How Can We Represent Those Dependancies in Our Code?
![Page 44: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/44.jpg)
Lets Discuss the Results
![Page 45: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/45.jpg)
![Page 46: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/46.jpg)
Mapping of the Code
![Page 47: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/47.jpg)
In what sense is this model random?
In what sense is this model deterministic?
Thinking conceptually about the model procedures
all of these models involve a mixture of determinism and randomness
![Page 48: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/48.jpg)
In what sense is this model random?
Thinking conceptually about the model procedures
Placement of the patches
subject to the selected density level
![Page 49: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/49.jpg)
Watch the Model in 3D
![Page 50: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/50.jpg)
Watch the Model in 3D
![Page 51: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/51.jpg)
Watch the Model in 3D
![Page 52: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/52.jpg)
Watch the Model in 3D
![Page 53: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/53.jpg)
Watch the Model in 3D
![Page 54: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz](https://reader038.fdocuments.net/reader038/viewer/2022110302/548bb66ab47959ea278b46b9/html5/thumbnails/54.jpg)
In what sense is this model deterministic?
Thinking conceptually about the model procedures
The fire is really for G.U.I. purposes
result is basically already determined before the fire spreads