Adaptive Behavior
and Objectives

EES 4760/5760

Agent-Based & Individual-Based Computational Modeling

Jonathan Gilligan

Class #12: Monday, Feb. 19 2018

Getting Started

Getting Started

Announcements

  • Analysis of the published model: Due date extended to next Sunday (Feb. 25)

  • From here on, no further homework from the book.
    • Focus on working on your team project and individual project.

Sensing

  • Options for sensing:
    • Omnisicence: max-one-of [ expected-utility ] patches
    • Neighbors: max-one-of [ expected-utility ] neighbors
    • Limited radius: max-one-of [expected-utility ] patches in-radius 5
    • Social network: max-one-of [ expected-utility ] my-social-network
  • Context:
    • NetLogo has four types of entities:
      1. Patches
      2. Turtles
      3. Links
      4. The Observer

Social Networks and Links

  • Links
    • Connect turtles
    • Directed (create-link-from, create-link-to) or undirected (create-link-with)
    • Can have properties (color, size, etc.)
  • Using links:
    • my-links, my-in-links, my-out-links
      • report agent-sets of links connected to a turtle
    • link-neighbors, out-link-neighbors, in-link-neighbors
      • report agent-sets of turtles connected to a turtle.
    • Lots more you can do with links (read NetLogo dictionary)
  • But links can be slow if you have a big model with lots of links.
    • Sometimes it’s better to use turtles-own variables to keep track of connections

Subsetting

Subsetting

  • Open the Class_12 model in NetLogo
  • Click setup and set up turtle 5
  • Turn all the turtles red
  • Turn turtle 5 green
  • Ask turtle 5 to identify all the patches that are exactly 2 patches away from the turtle’s patch (not a 2-patch radius from turtle-2)

    illustration

Hints:

  • There are many ways to do this. Let’s look at a way to do this with the neighbors primitive.
  • Hints:
    • Use member? primitive (member <agent> <agent-set>)
    • Use patch-set primitive to turn an list of many patch-sets into a single patch-set
  • Suggestion:
    1. Start by turning all neighbor patches (patches exactly 1 patch away) blue
    2. Next turn all patches within 2 patches blue
    3. Now turn all patches black again
    4. Now turn all patches within a 2-patch distance blue except the turtle’s patch
    5. Now turn all patches black again
    6. Now turn all patches within a 2-patch distance blue except the turtle’s patch and the patches 1 patch away.

A solution

ask turtle 5 [ 
  ask (patch-set [neighbors] of [neighbors] of self) with                      
    [not member? self [(patch-set neighbors patch-here)] of myself] 
  [ 
  set pcolor blue
  ]
]
  • What does self refer to in patch-set [neighbors] of [neighbors] of self?
  • What does self refer to in not member? self [(patch-set neighbors patch-here)] of myself?

Another solution

ask turtle 5 [
  ; This is a big solid square
  let donut (patch-set [neighbors] of [neighbors] of patch-here)
  ; This is a smaller hole in the middle
  let hole (patch-set patch-here [neighbors] of patch-here)
  ; This is the big square with the hole removed
  set donut (patch-set donut with [not member? self of hole])
  ask donut [set pcolor blue]
]
  • Making complicated sets in smaller steps makes it both easier to understand and easier to catch errors
  • Note: [neighbors] of [neighbors] of self is a list of patches. We turn this into a patch-set with (patch-set [neighbors] of [neighbors] of self)

Sensing

Expected Utility Function

Adaptation

Adaptation and Objectives

  • Making decisions:
    • Perfect rationality:
      • Pick a goal (objective function)
      • List possible actions
      • Calculate how well each will satisfy goal
      • Choose action that will best accomplish goal
    • Imperfect rationality:
      • Goal may be unclear or inconsistent
      • May not list all possible actions
      • May not calculate results of actions
      • May not act on best option
  • Real-life agents may not act rationally

Bounded Rationality

  • Perfect rationality and chess …
    • Evaluating all possible moves may not be possible
      • Limited time, memory, computing power
    • Cost of rationality
      • Getting, processing information
      • It may be more rational to be slightly irrational

Satisficing

  • Define goal (objective function)
  • Define criteria for good enough result
  • Evaluate possible actions until the first one that is good enough.
    • Do that action.

Satisficing

  • Make a new slider and call it wealth-increase-threshold
  • Make a satisfice function:

    to satisfice
      ; Move if expected wealth increase rate is below the threshold
      ; Potential destinations do NOT include the current patch
      if expected-utility-of self < wealth * (1 + wealth-increase-threshold)
      [
        let potential-destinations neighbors with [not any? turtles-here]
        if any? potential-destinations [ move-to one-of potential-destinations]
      ]
    end