Sei sulla pagina 1di 82

Introduction to Computing for

Complex Systems (Session II)

Daniel Martin Katz


University of Michigan - Ann Arbor

Thursday, July 22, 2010


Goals for Today

Quick Review From Our Last Session

Extended Exploration of the Forest


Fire Model and its Implementation

Thursday, July 22, 2010


Describe the
contribution of
each scholar to
Agent Based
Modeling
Conway

Von Neumann
Schelling
Thursday, July 22, 2010
Three Important Colors

CONTROLS

SETTINGS

VIEWS

Thursday, July 22, 2010


Wolf-Sheep Example
Buttons

Switchers

Sliders

Monitors

Plots

Thursday, July 22, 2010


Patches Turtles

What are the key features for each of these?

Thursday, July 22, 2010


Exploring the
Forest Fire Model
http://ccl.northwestern.edu/netlogo/models/Fire

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

Thursday, July 22, 2010


The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
The Forest
Fire Model

http://ccl.northwestern.edu/netlogo/models/Fire
Thursday, July 22, 2010
Tally the Average of
five model runs

For Values

50, 55, 60, 65

Thursday, July 22, 2010


The Forest Fire Model

Average
2.6
Thursday, July 22, 2010
The Forest Fire Model

Average Average
2.6 5.8
Thursday, July 22, 2010
The Forest Fire Model

Average Average Average


2.6 5.8 66.5
Thursday, July 22, 2010
The Forest Fire Model

Average Average Average Average


2.6 5.8 66.5 93.9
Thursday, July 22, 2010
Parallel Processing on
Percolation Threshold

Average Average
5.8 66.5

Thursday, July 22, 2010


Lets Do Some additional
in Class Data Collection
On Our Fire Model
56

57

58

59
Thursday, July 22, 2010
Now Lets
Discuss
The Results

Thursday, July 22, 2010


Explore the Code

Thursday, July 22, 2010


Thursday, July 22, 2010
Thursday, July 22, 2010
The Forest
Fire Model

Thursday, July 22, 2010


Thursday, July 22, 2010
;; is for
Comments
Not Active
code

Thursday, July 22, 2010


What is a Global?

Look it up in
the dictionary

Thursday, July 22, 2010


What is a Global?

Thursday, July 22, 2010


Thursday, July 22, 2010
Thursday, July 22, 2010
What is a breed?

again, look it up in
the dictionary

Thursday, July 22, 2010


What is a breed?

Thursday, July 22, 2010


The Forest
Fire Model

Thursday, July 22, 2010


The Forest
Fire Model

Thursday, July 22, 2010


The Complete Code
for the
Forest Fire model

Thursday, July 22, 2010


the setup
procedure

Thursday, July 22, 2010


1st Operation is to Clear Everything

Thursday, July 22, 2010


(a) The World Consists of
Turtles and Patches
(b) Turtle Can Assume
lots of Shapes
(c) Default is Now “square”

(d) What is the plain english


version of this line of
code?

(e) set-default-shape
for
turtles
to
“square”

Thursday, July 22, 2010


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

(b) But Only A Certain


Random Set of Patches

Thursday, July 22, 2010


look at the brackets,
what do these brackets do?

we need to learn these primitives:


ask patches
random-float

Thursday, July 22, 2010


The Ask Primitive

Thursday, July 22, 2010


Random-Float

Thursday, July 22, 2010


(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

Thursday, July 22, 2010


Again it is the
“ask” “patches with”

With What Criteria?


pxcor = min-pxcor
[Notice The Brackets]

Thursday, July 22, 2010


(a) Again it is the “Ask”
“Patches With”

(b) pxcor = min-pxcor

Here is where pxcor = min-pxcor


(c) To
(i.e. Where Pxcor Ingnite
=0)

Thursday, July 22, 2010


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

To Do What?
Ignite

How Does It Know


What “Ignite” Means?

Consult Netlogo
Dictionary?
Is it there?

Thursday, July 22, 2010


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

Thursday, July 22, 2010


Lets Look at the Set Command

Thursday, July 22, 2010


Thursday, July 22, 2010
set variable value

variable= initial-trees

value= count patches with


[patchcolor =green]

Thursday, July 22, 2010


set variable value

variable= burned-trees

value= numeric value of 0

Thursday, July 22, 2010


notice how
within ‘setup’
these globals
are ultimately
assigned a
value

Thursday, July 22, 2010


Modular Code:
notice how the
[ ignite ]
procedures are
defined below

Thursday, July 22, 2010


“sprout-fires 1” ?

Thursday, July 22, 2010


Thursday, July 22, 2010
“sprout-fires 1”
sprouting of a turtle
from breed = fires
and a 1 per patch

[ set color red]


note: color versus pcolor
this implies turtle not patch
(see dictionary for distinction)
fire turtle is set to red

set pcolor black


setting patch color to black

set burned-trees to burned-trees +1

Thursday, July 22, 2010


Modular Code:
now notice how
[fade-embers]
procedures are
defined below

Thursday, July 22, 2010


“ask embers”
embers are a breed

[ set color color - 0.3]


makes the red darker

if color < red - 3.5


‘If’ is a conditional
(balance of the command is
triggered if condition is met)

Allows a slow fading of embers


What does color < red - 3.5 imply?

Thursday, July 22, 2010


Thursday, July 22, 2010
“ask embers”
embers are a breed

[ set color color - 0.3]


makes the red darker

if color < red - 3.5


‘If’ is a conditional
(balance of the command is
triggered if condition is met)

Allows a slow fading of embers


What does color < red - 3.5 imply?

[set pcolor color die]

Thursday, July 22, 2010


We will focus
upon the ‘to go’
procedure in
the next class

Thursday, July 22, 2010


3-D perspective on the model
as it runs

Thursday, July 22, 2010


notice how these turtles on the terrain

Thursday, July 22, 2010


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

Thursday, July 22, 2010


Next Time:
Finish Fire Model
&

Thursday, July 22, 2010

Potrebbero piacerti anche