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

Preview:

DESCRIPTION

 

Citation preview

Introduction to Computing for Complex Systems

(Lab Session 2)

Daniel Martin KatzMichigan State University

College of Law

The Complete Code for the

Forest Fire model

The Forest Fire Model

the setup procedure

1st Operation is to Clear Everything

(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”

(a) Call on Our Patches Using “Ask Patches”

(b) But Only A Certain Random Set of Patches

look at the brackets, what do these brackets do?

we need to learn these primitives:ask patchesrandom-float

The Ask Primitive

Random-Float

(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

With What Criteria?pxcor = min-pxcor[Notice The Brackets]

Again it is the “ask” “patches with”

(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)

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?

Here is How (We Will Return to This in a Few)

Lets Look at the Set Command

variable= initial-trees

value= count patches with[patchcolor =green]

set variable value

variable= burned-trees

set variable value

value= numeric value of 0

notice how within ‘setup’ these globals are ultimately

assigned a value

Modular Code:

notice how the [ ignite ]

procedures are defined below

“sprout-fires 1” ?

[ 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

Modular Code:

now notice how [fade-embers]

procedures are defined below

[ 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?

[ 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?

We will focus upon the ‘to go’

procedure in the next class

3-D perspective on the model as it runs

notice how these turtles on the terrain

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

Modify the Color of the Forest to Blue

What Elements of the Code Do We Modify?

The Forest Fire Model

Procedures

The Forest Fire Model

Procedures

Make the Fire Move North to South Instead of West to East

Make the Fire Move North to South Instead of West to East

What Elements of the Code Do We Modify?

The Forest Fire Model

Procedures

The Forest Fire Model

Procedures

Try this Instead:

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?

Lets Discuss the Results

Mapping of the Code

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

In what sense is this model random?

Thinking conceptually about the model procedures

Placement of the patches

subject to the selected density level

Watch the Model in 3D

Watch the Model in 3D

Watch the Model in 3D

Watch the Model in 3D

Watch the Model in 3D

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