GEOG3150 Semseter 2 Lecture 5 INTERACTION AND BEHAVIOUR Dr Nick Malleson Dr Alison Heppenstall Recap (last week) Emergence “The whole is greater than the sum of its parts.” (Aristotle ?) Complex structures emerge from simple rules Cellular Automata and the Game of Life 3 Simple rules Incredible, beautiful, fascinating worlds Attribution: Yewenyi at the English language Wikipedia https://en.wikipedia.org/wiki/User:Yewenyi Recap (last week) Non-linearity (non-linear systems) System output is not directly proportional to inputs Small changes -> complex outcomes A bunnies tale The logistic map Flocks Wolf / sheep predation xn1 rxn (1 xn ) Recap (last week) Chaos (chaotic systems) “Deterministic systems whose trajectories diverge exponentially over time” (url) The butterfly effect Usually a property of complex systems Highly dependent on initial conditions Very difficult to predict, in the long term Not random! Complexity (complex systems) Many interaction components “High dimensional chaos” Complex systems exhibit emergence, non-linearity and chaos Photo attributed to Gianfranco Reppucci on Flickr http://www.flickr.com/photos/giefferre/4446877066/ Today Interaction What is it? Why is it important in these models? How do we simulate interactions? Behaviour How should we model behaviour? How do we know which sorts of behaviour to include? Seminar The Ethics of Individual-Level Modelling Reading Kennedy, W.G., 2012. Modelling Human Behaviour in Agent-Based Models. in: Heppenstall, A.J., Crooks, A.T., See, L.M., Batty, M. (Eds.), Agent-Based Models of Geographical Systems. Springer Netherlands, pp. 167–179. See the reading list (at the library) Wooldridge, M (2000) Reasoning about rational agents MIT Press, Cambridge. (There is also a review of the book in the JASSS). Interaction and Behaviour Interaction What is it? How should we model it? Behaviour What to include? Modelling Behaviour Cognitive architectures Seminar - The Ethics of Individual-Level Modelling Attribution: Yewenyi at the English language Wikipedia https://en.wikipedia.org/wiki/User:Yewenyi Interactions: Global and Local Interactions: a key part of agentbased models One of the most powerful elements for modelling complex systems Global interactions Macro scale of the model: these can result in immediate massive changes on all agents. E.g.: A new policy on migration Climate change Limits on number of children couples allowed to have. Local interactions Interactions that occur at the micro or meso level. These only affect those in the local vicinity. Question Give me some examples of local and global interactions in the real world, or in your NetLogo models Local interactions: Global interactions: Interactions Interactions can be spatially constrained: Neighbourhood feuds Car crashes Or a-spatially (e.g. across social networks): Exchange of information between students about a cool new Level 3 course…! Not explicitly spatially defined. Twitter From interactions, new information, new interactions etc emerge. Interactions add to the complexity of the system. Getting the interactions correct is crucial. As the experts say… “In an agent-based model we can model interactions explicitly as ways that individual agents affect each other and their environment. Consequently, the effects of interaction, and even the kinds of interaction, can depend on the state of the agents (including…their location) and on their environment” Railsback and Grimm p.169, (2012) Types of Interactions Direct interaction: agents directly interacting with each other affect each other e.g. exchanging information. Mediated or indirect interaction: agents interact indirectly via a mediating resource e.g. competition for a shared resource. Question Give me some examples of direct and mediated interactions Direct interactions Real world examples Examples from agentbased models Mediated interactions Simple Example: Direct Interaction NetLogo > Models Library > Social Science > AIDS Simulates the spread of HIV through an isolated population. Turtle = Human People form sexual relationships Stand still in a relationship Otherwise walk around Everyone tests for HIV occassionally Infected status: Green -> uninfected Blue -> infected (unknown) Red -> infected (known) Known infected always use a condom (and these never fail) HIV Example (Direct Interaction) Setup Default settings Test frequency 0.3 times/year Results after ~1000 weeks Proportion infected stabilises at 19% What will happen if we reduce the length of commitment to 20 weeks? (more frequent sexual relationships) HIV Example (Direct Interaction) Setup Same as previous Commitment increased to 20 weeks Results after ~1000 weeks Proportion infected 83% (and growing) Altering the rules of the interactions have a dramatically different effect on the system. Simple Example: Indirect Interaction NetLogo > Models Library > Social Science > Cooperation Turtle = Cow Patch = Amount of grass on each patch variable. Short grass grows more slowly. Cows are competing for a resource. Successful cows reproduce more often Two behaviours: Cooperative: don’t eat short grass Greedy: always eat “Cooperative agents leave more food for the overall population at a cost to their individual well-being” Greedy versus Cooperative Default settings. Cooperative probability = 0.50 (Half cows cooperative) What happens if energy from grass reduces to from 51 to 20? (Cows will need to eat more grass). Greedy versus Cooperative Grass-energy = 20 (reduced from 50) Again, changing the nature of the interactions (cows and grass) has a considerable impact on the outcomes Interaction and Behaviour Interaction What is it? How should we model it? Behaviour What to include? Modelling Behaviour Cognitive architectures Seminar - The Ethics of Individual-Level Modelling Implementing interactions in NetLogo Taking the Cow example (competition for a resource). Two entities: Grass (represented as patches with variable amounts on) Cows (represented as turtles) Model is spatial (grass belongs to a field). Cows Initialisation Cow variables: Location Metabolism (amount of energy lost per turn) Cooperative (Red) Greedy (Blue) to setup-cows set-default-shape turtles "cow" ;; applies to both breeds create initial-cows [ setxy random-xcor random-ycor set energy ( metabolism * 4 ) ifelse (random-float 1.0 < cooperative-probability) [ set breed cooperative-cows set color red - 1.5 ] [ set breed greedy-cows set color sky - 2 ] ] end The interaction: Cows eat Grass to eat-cooperative ;; turtle procedure if grass > low-high-threshold [ set grass grass – 1 set energy energy + grass-energy ] end to eat-greedy ;; turtle procedure if grass > 0 [ set grass grass – 1 set energy energy + grass-energy ] end Interaction & Behaviour Example: Animal Predation Another example – direct interaction Wolf-sheep predation ask wolves [ move set energy energy - 1 let prey one-of sheep-here if prey != nobody [ ask prey [ die ] ;; wolves lose energy as they move ;; grab a random sheep ;; did we get one? if so, ;; kill it set energy energy + wolf-gain-from-food ;; get energy from eating ] if energy < 0 [ die ] reproduce-wolves ] ;; die if run out of energy Design concepts for simulating interactions (1) Basic Principles: This example looked at competition for a resource that is limited. Emergence: What happens to the amount of grass and cow population over time? These results emerge from the interactions between the two types of cows. Different patterns emerge at different time-scales. Design concepts for simulating interactions (2) Adaptive Behaviour At present this isn’t in here, but can you think of what sort of behaviour you could include and how to code it? Prediction Do the simulation results match what is reported in the literature or a commonly accepted hypothesis? Design concepts for simulating interactions (3) Interaction: Only one type of interaction here: between the cows and grass. Could we code in interaction between the greedy and cooperative cows? How might that change the final outcomes? Would you want the effect of any new interaction to affect all of the cows, or just some? Stochasticity Cows and patches of grass are randomly located. Order in which the patches of grass are eaten (and by whom) is random. Question What type of interactions have you been building in your NetLogo models during the practicals? Interaction and Behaviour Interaction What is it? How should we model it? Behaviour What to include? Modelling Behaviour Cognitive architectures Seminar - The Ethics of Individual-Level Modelling Modelling Behaviour Great advantage of ABM! But lots of important decisions about what to include in a model (and how). Photo attributed to Arts Electronica (CC BY-NC-ND 2.0) Modelling Behaviour Choose a number between 1 and 4 Submit your answers at: http://pollev.com/nickmalleson What percentage of people will choose 1:? 2:? 3:? 4:? https://www.polleverywhere.com/multiple_choice_polls/OLaZoLv2B2BQsFR Humans are not random! “Humans are not random. They (we) are strange and wonderful” (Kennedy, 2012) The previous example shows that even if we want to be, human decisions are not random. So, do I model the entirety of an organism’s behaviour? Two camps of thinking in building these models: Keep it descriptive, stupid (KIDS) Keep it simple, stupid (KISS) No ‘correct’ way to model behaviour. We recommend identifying the most important behaviour and building that into your models. Two contrasting views of KISS and KIDS approaches: Axelrod, R. (1997). Advancing the art of simulation in the social sciences. In Conte, R., Hegselmann, R., and Terna, P. (eds) Simulating Social Phenomena , pages 21–40. Springer-Verlag, Berlin. (Note: this book is available in the library, the author has also made a draft of the chapter available online: http://wwwpersonal.umich.edu/~axe/research/AdvancingArtSim2005.pdf ). Edmonds, B. and Moss, S. (2005). From KISS to KIDS: an ‘anti-simplistic’ modelling approach. In Davidsson, P., Logan, B., and Takadama, K., editors, Multi Agent Based Simulation 2004, Lecture Notes in Artificial Intelligence , pages 130–144. Springer. Available online: http://cfpm.org/cpmrep132.html (also here). How do I know what behaviour is important? Through the use of black magic! Published literature Talking to the experts Numerical experimentation Rigorous data analysis It is important to carefully research all the information there is about the system you are interested in modelling. Interaction and Behaviour Interaction What is it? How should we model it? Behaviour What to include? Modelling Behaviour Cognitive architectures Seminar - The Ethics of Individual-Level Modelling (Human) Behaviour in AgentBased Models Great advantage of ABM! But really, really difficult Subjective choices Complex psychology (Seemingly) irrational behaviour Photo attributed to Arts Electronica (CC BY-NC-ND 2.0) A number of different ways of implementing behaviour have been proposed Rule-based Systems Simple rule-based systems IF < hunger > is below < hungerThreshold1 > THEN agent-dies. IF < hunger > is above < hungerThreshold2 > THEN address-another-goal. IF < hunger > is between < hungerThreshold1 > and < hungerThreshold2> THEN search-for-food. Kennedy (2012) Node-based Similar to decision trees (Remember LOTR and MASSIVE ?) History: Building Autonomous Robots Long history of endowing robots with autonomous behaviour We can adapt this literature for use in agent-based modelling Robots became progressively more ‘intelligent’ Sensing environments Reflex actions Goal-based Plans Individual world view Learning / evolution … See Brooks, R. (1996) From Earwigs to Humans. Robotics and Autonomous Systems 20: 291--304 Early Behaviour: Reactive Agents Purely reactive – simply respond to input Behaviours layered hierarchically Behaviour at lower levels takes priority over abstract, higher level behaviours Early Behaviour: Reactive Agents Simple, robust, efficient, BUT: Purely reactive, only take local-info into account How to learn / improve performance? If many rules, interactions are too complex to understand. Conflicts between rules? More Advanced: Layered Behaviour Different subsystems to deal with proactive / reactive behaviours Horizontal / Vertical structure Horizontal: requires “mediator” function Vertical: one pass / two pass Behaviour Based Artificial Intelligence (BBAI) Example of layered behaviour Hierarchical layers of behaviour Alternative to “Good old fashioned artificial intelligence” (Brooks, 1996) Upper layers take control when they can No explicit input-output No overall goals Robot can default to lowerlevel behaviour Behavioural modules, working concurrently compete/contribute to overall behaviour See Brooks, R. (1996) From Earwigs to Humans. Robotics and Autonomous Systems 20: 291--304 Behaviour Based Artificial Intelligence (BBAI) Example uses Crime simulation Birks, D. J., Donkin, S., and Wellsmith, M. (2008). Synthesis over analysis: Towards an ontology for volume crime simulation. In Liu, L. and Eck, J., editors, Artificial Crime Analysis Systems: Using Computer Simulations and Geographic Information Systems, pages 160–192, Hershey, PA. Information Science Reference. An aside: this is geocomputation at its best! Adapting method from other fields (computer science, artificial intelligence, psychology, etc.) to build models and better understand the world. Criticisms of Layered Behaviour Very popular (?) Natural decomposition of functionality BUT Lack clarity Over-complicated with many layers Conflict between layers? Not similar to human cognitive process (?) Interaction and Behaviour Interaction What is it? How should we model it? Behaviour What to include? Modelling Behaviour Cognitive architectures Seminar - The Ethics of Individual-Level Modelling Beliefs Desires Intentions (BDI) Probably the most common / popular architecture in ABM Rational model All action requires some deliberation Good representation of human cognition (?). But: Core elements hard to observe directly Rational decisions only useful to a limited degree (e.g. pulling hand away from fire requires no rational thought) Beliefs: Internal knowledge about the world Memory of past experiences Desires Goals the agent is trying to achieve Can be short and long term (e.g. ‘eat food’, ‘raise children’ Can be contradictory Intentions The most important immediate goals Can alter the rapidity with which an agent changes intentions (e.g. ‘caution’). PECS Physical conditions, Emotional states, Cognitive capabilities and Social status Internal states Physical Emotional Cognitive Social Motives Intensity functions determine motive strength Include level of need, personal preference, environment, others.. Strongest motive becomes action guiding motive Interaction & Behaviour Example: Modelling Burglary Personal preference, p Drug level Intensity of drugs motive m=p/s Social level Personal preference, p Time of day, t Intensity of social motive Determine Strongest Motive m = p f(t) / s Sleep level Personal preference, p Time of day, t m = p f(t) / s Intensity of sleep motive Plan Actions Summary Correctly simulating interactions is crucial to the success of a model. Need to think about: Objective of the research What type of interactions are needed? turtle turtle turtle patch patch -> turtle?? What are the results of these interactions? Test the model carefully; KISS then build up slowly. Summary (2) Interactions form an important part of the behaviour. Behaviour is programmed as a set of rules that an agent will follow. Lots of different ways of organising the rules (e.g. using cognitive architectures, or something simpler) You must justify your choice of behaviour We will want to see this in your projects http://www.geog.leeds.ac.uk/courses/level3/geog3150/home/home/course_outline.php Now: Seminar Ethics of Individual-Level Modelling http://www.geog.leeds.ac.uk/courses/level3/geog3150/seminars/ seminar2/ http://bobnational.net/record/203575