+ All Categories
Home > Education > ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Date post: 13-Dec-2014
Category:
Upload: daniel-martin-katz
View: 279 times
Download: 1 times
Share this document with a friend
Description:
 
Popular Tags:
54
Introduction to Computing for Complex Systems (Lab Session 2) Daniel Martin Katz Michigan State University College of Law
Transcript
Page 1: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

The Forest Fire Model

Page 4: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

the setup procedure

Page 5: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

1st Operation is to Clear Everything

Page 6: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

(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

(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

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

The Ask Primitive

Page 10: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Random-Float

Page 11: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

(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

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

(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

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

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

Lets Look at the Set Command

Page 17: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
Page 18: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

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

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

“sprout-fires 1” ?

Page 23: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
Page 24: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

[ 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

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

[ 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
Page 28: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

[ 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

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

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

notice how these turtles on the terrain

Page 32: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
Page 33: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

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

The Forest Fire Model

Procedures

Page 37: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

The Forest Fire Model

Procedures

Page 38: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

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

The Forest Fire Model

Procedures

Page 42: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

Lets Discuss the Results

Page 45: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz
Page 46: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Mapping of the Code

Page 47: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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

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

Watch the Model in 3D

Page 50: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Watch the Model in 3D

Page 51: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Watch the Model in 3D

Page 52: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Watch the Model in 3D

Page 53: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

Watch the Model in 3D

Page 54: ICPSR - Complex Systems Models in the Social Sciences - Lab Session 2 - Professor Daniel Martin Katz

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


Recommended