Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Próxima SlideShare
Cargando en…5
×

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

2.109 visualizaciones

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Sé el primero en comentar

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

1. 1. Introduction to Computing for Complex Systems (Lab Session 5) daniel martin katz illinois institute of technology chicago kent college of law @computationaldanielmartinkatz.com computationallegalstudies.com
2. 2. Simple Birth Rates
3. 3. Simple Birth Rates
4. 4. Simple Birth Rates
5. 5. Simple Birth Rates take a few minutes and play around with the model consider the questions offered above
6. 6. Thinking Conceptually: Simple Birth Rates What Does the Turtle Movement Add to the Model? Are Turtles Added to the Model? and If So How? Are Turtles Removed from the Model? and If So How?
7. 7. Simple Birth Rates: Exploring the Code
8. 8. Simple Birth Rates
9. 9. Experiment Basic Setup Simple Birth Rates Death Plots Reproduction Movement
10. 10. Simple Birth Rates “To Setup” Procedures
11. 11. Simple Birth Rates “To Go” Procedures
12. 12. Simple Birth Rates Turtle Movement Procedures
13. 13. Simple Birth Rates Please Review “ifelse” How does it work?
14. 14. Simple Birth Rates Take a Look at the Reproduction Procedures
15. 15. Simple Birth Rates Death Procedures Plot Procedures
16. 16. Step 1: map the dependancies Step 2: learn the syntax and functionality for all unknown primitives Step 3: read each line of code and determine what it doing Simple Birth Rates Step 4: sketch a procedures map that follows the chronology of your program At this point it is more Important for you to go though the models line by line on your own using the above protocol
17. 17. Wolf-Sheep Predation
18. 18. The Lotka-Volterra Equation is Traditional Approach to this Question is Differential Equation Classic Predator-Prey Question to answer ... what do we learn through the Agent Based Implementation that is not captured the standard approach?
19. 19. Wolf-Sheep Predation
20. 20. Wolf-Sheep Predation A Mini Eco-System Model Sheep rely on Grass Wolf rely upon Sheep Implicitly Wolf rely upon grass
21. 21. Wolf-Sheep Predation Set Different Starting Values for Sheep Return Rates for Food Can Differ There are Birth Rates for Grass, Sheep, Wolves
22. 22. Wolf-Sheep Predation Lots of Parameters Grass switcher Shows how close an agent is to death Plots are Useful for observing model stability
23. 23. Wolf-Sheep Predation
24. 24. Wolf-Sheep Predation
25. 25. Wolf-Sheep Predation Relies upon a number of different rules that we have seen in prior models reproduction rule death rule different initial conditions spatial movement around the landscape etc.
26. 26. Wolf-Sheep Predation This is default settings with grass on What is happening in the model?
27. 27. Wolf-Sheep Predation What is happening in the model? Changed 1 parameter “sheep gain from food” (From 4 to 8)
28. 28. Wolf-Sheep Predation Notice the difference in the 4 model runs Changed 1 extra parameter “wolf gain from food” Still “sheep gain from food” (From 4 to 8) Now also “wolf gain from food” (From 20 to 40)
29. 29. Wolf-Sheep Predation Wolf Sheep is more of an agent based model remember in simple birth rates there was a system level carrying capacity Here we keep track of individual turtles and they can die based upon individual values And of course individual spatial interactions Sheep vs. Grass wolf v. sheep
30. 30. Wolf-Sheep Predation You can observe these interactions and the declining energy counts mr. wolf better get some food
31. 31. Wolf-Sheep Predation This energy count might useful in a number of models Simulated Market where “energy” could become money, etc. Agents could make various cost / benefit calculations as they undertake a given action Those agents need not make the “optimal” choice (i.e. they could have cognitive biases, etc. and you could write those into the model)
32. 32. Novel Recombinations of Code We are trying to show a set of models with useful features to your substantive question(s) of interest Then you can develop various novel combinations of these and other models
33. 33. Recycle & Reuse Code You should re-use as much code as possible also, a code “scrapyard” from which you might acquire parts to fix your model Lots of Code Examples in existing models Lots of Code Examples online
34. 34. Getting to the Code “Scrapyard”
35. 35. Some Examples From The Code “Scrapyard”
36. 36. The Flocking Model
39. 39. The Flocking Model
40. 40. The Flocking Model
41. 41. The Flocking Model Take a few minutes and explore the model including these questions
42. 42. The Flocking Model
43. 43. The Flocking Model
44. 44. The Flocking Model What is “Population”? It is a variable on the slider What is happening in the “To Setup”? create population set turtles to random shades of yellow set the size to 1.5 start with random x,y heading coordinates clear all
45. 45. ask turtles [flock] The Flocking Model (We will get to [flock] in just a moment) to understand how “display” helps the interface remove it from code and then re-run the model interface notice it is giving the model the smooth movement
46. 46. The Flocking Model What is [ask turtles [FD 0.2]? Turtles are moving FD .2 Immediately Updated using the “display” command .2 x (repeat 5) = 1 this is the same as [ fd 1] then the model “ticks” forward and does not stop until button is turned off
47. 47. The Flocking Model back to ask turtles [flock] which is used in the “to go” “to flock” gateway to balance of the model
48. 48. The Flocking Model flockmates = turtles-own agentset of nearby turtles We use the “Set” Command to assign it a value “Set” to an agentset of “other turtles in-radius vision”
49. 49. What is “other turtles in-radius vision”? Other = All Turtles in Radius Except for the Calling Turtle Radius = Allows for an agentset that is defined by distance from a calling agent Vision = parameter value that was set on the slider
50. 50. It is going to use an “if” springing condition If no flockmates than it is going to tick the model forward (rinse and repeat) If it does find a flockmate than notice there is also an “ifelse” within the “if” “To Flock” Procedure
51. 51. “find-nearest-neighbor” First how does it do the “find-nearest-neighbor”? it has to “set” a value for this looks within the “flockmates” and selects “min one of” “flockmates” relative to distance from myself “min-one-of” handles ties by selecting at random
52. 52. remember “ifelse” sets up two possible conditions ... the “ifelse” split in the road Take a look at how it is split up Notice the brackets If Condition is satisfied than [ separate ] If Condition is not satisfied (i.e. else) [ align cohere]
53. 53. Cohere, Align & Separate If Condition is satisfied than [ separate ] If Condition is not satisfied (i.e. else) [ align cohere] Please Review the Cohere, align & Separate Procedures on your own
54. 54. Cohere, Align & Separate relies upon other procedures as shown above = slider variable = nested procedure
55. 55. The Hawk/Dove Model http://ccl.northwestern.edu/netlogo/models/community/
56. 56. The Hawk/Dove Model In the Community Models it is called “game theory” http://ccl.northwestern.edu/netlogo/models/community/ Download the “gametheory.nlogo” file and save it to the desktop or to a folder of your choosing
57. 57. The Hawk/Dove Model Easiest Thing is to simultaneously install 3.1.5 along with Netlogo 4.1 Current Version of “gametheory” is Implemented in Netlogo 3.1.5 you should be able run netlogo 3.1.5 and 4.1 on the same machine If you do not already have netlogo 3.1.5 as well as 4.1 --- please install it on your machine