Your First Model

EES 4760/5760

Agent-Based & Individual-Based Computational Modeling

Jonathan Gilligan

Class #5: Tues. January 23 2018



  • In the mushroom hunt, were there always 80 red patches?
  • Any questions about modified mushroom hunt model?
  • Let’s talk about ODD exercise.

Writing a model from an ODD

  • Questions about writing a model from Butterfly ODD?
  • Were there things the ODD was unclear about?

Digression on Turtles

Why “Turtles”?

Original Turtle Seymour Papert

Butterfly Model

Enhancing the Butterfly model

  visited? ; question mark means it's a true/false variable

to setup
  ask patches [
    set visited? false

Enhancing the Butterfly model

  • Put a slider for q
  • Add patches-own variable to indicate whether it was visited.
  • Add turtles-own variable to remember the patch where it started.
  • Increase the number of butterflies to 50.
  • Stop butterfly from moving if it’s at the top of a hill.
    • How can you tell whether it’s on the top?

Enhancing the Butterfly model

  • Write a reporter for corridor width

    \[ \text{Corridor width} = \frac{\text{# patches visited}}{\text{distance from start}} \]

  • Put an observer on the interface
  • Define a reporter:
to-report corridor-width
  let wid ... ; calculate corridor width
  report wid


Running Experiments: BehaviorSpace

  • Vary any parameter that has a control on the model’s interface
  • Writes output to .csv spreadsheet file (table output is the most useful).

    Behaviorspace experiment

Output from BehaviorSpace Experiments

  • Note: Data written in spreadsheet might be out of order.

    "BehaviorSpace results (NetLogo 5.3.1)"
    "01/25/2016 23:08:47:963 -0600"
    "[run number]","q","[step]","corridor-width"

Analyzing Behaviorspace Output




  • A tricky concept.
  • Growing Artificial Societies: “stable macroscopic patterns arising from the local interaction of agents.”
  • Epstein ten years later: “I have always been uncomfortable with the vagueness and occasional mysticism surrounding this word.”
  • Epstein now prefers to talk about “Generative Social Science”