Agent-Based Modeling PSC 120 Jeff Schank Agent-Based Modeling • What Phenomena are Agent-Based Models Good for? • What is Agent-Based Modeling (ABM)? • What are the uses of ABM? • Model Assumptions • Analyzing Models • Comparing Models to Data What are they good for? • Complex systems • Emergent phenomena • When we understand the parts better than the whole • When we seek mechanistic explanations • When we are faced with multiple levels of organization What is ABM? • ABM is a general Style of modeling that focuses on individuals – Agents can represent people, animals, or entities at different levels of organization – The modeling of agents typically require the specification of rules for agent behavior and interactions • ABM is a style of modeling that has features of both experimental and mathematical styles of thinking – When designing an ABM it is often useful to think like an experimentalist • What behaviors and properties do/should agents have? • How should the environment be designed and controlled? • How should experiments be designed? – Most ABMs have probabilistic elements, so each simulation experiment may differ considerably even for the same parameter values – Thus, a large number of simulated experiments are often required to analyze an ABM for a given set of parameters – From a mathematical style of thinking, the emphasis should be on investigating the entire parameter space or regions of interest in more complex models What are the uses of ABM? • To model complex systems in which individual behavior and properties are better understood than the behavior and properties of the system – – – – Molecular and cellular biology Ecology Anthropology and other social sciences Animal behavior • Exploratory modeling – Artificial life – Evolutionary game theory • Investigating the robustness of analytical results – Evolutionary game theory – Ecology – Evolutionary Biology Analysis of Models • Parameter sweeps – Systematically vary one or move parameters of a model – The limitations are on the number of parameters • If there are two parameters and you want to look at 5 values for each parameter, then you must conduct 5 × 5 = 25 sets of simulations • As you can see, the number of sets of simulations to be conducted increases exponentially with the number of parameters to be swept • Another approach is to use genetic algorithms to evolve models that either fit some set of goals or data of interest • I’ll discuss an example of both approaches Ovarian-Cycle Synchrony • Does ovarian-cycle synchrony exist in mammals? • The problem of cycle variability • Ovarian cycles and female mate choice – The cost of synchrony Synchrony? • Studies have reported synchrony in – Women – Norway rats – Golden hamsters – Golden lion tamarins – Chimpanzees • All are fundamentally flawed and more recent studies have found no effects The Cost of Synchrony • There are two types of fitness costs for synchronized females – Male quality – Mating opportunities • To explore these costs, I built an ABM, based on J. B. Calhoun’s study: The Ecology and Sociology of The Norway Rat Calhoun’s Rats ABM • Aims and Design – Ecologically realistic – Based on data – 5 to 10 reproductive females at a given time – 61 adult males (7 high, 12 medium, 42 low) – Movement is determined by “collapsing” preferences into a local probability space surrounding a model rat Two views of the Pen The Trails Map ABM Model Synchrony Synchrony by Chance Synchrony Distributions Male Quality & Synchrony 0.78 Male Quality 0.73 N=5 N=6 N=7 N=8 N=9 N = 10 8 9 0.68 0.63 0.58 2 3 4 5 6 Synchrony Level 7 10 Matings & Synchrony 21 N=5 N=6 17 N=7 N=8 15 N=9 N = 10 Matings 19 13 11 9 7 5 2 3 4 5 6 Synchrony Level 7 8 9 10 Male Quality & Cycle Length 0.675 0.670 Male Quality 0.665 0.660 0.655 0.650 0.645 0.640 0.635 0.630 4 5 6 Cycle Length 7 Matings & Cycle Length 19 Maings 18 17 16 15 4 5 6 Cycle Length 7 Conclusions • Ovarian cycles may have evolved to facilitate female mate choice • Synchrony has fitness costs • Cycle variability may have fitness benefits in promiscuous mating systems The Development of Locomotion • How do animals do what they do? How do we answer this question? • Start simple and work to the complex • If we want to understand how something works in space and time, it is often a good idea to build it or something like it. • We cannot just build animals at different stages of development, but we can build models of them, which may help us understand them better (i.e., simulation, robotic) • Rat Pups • Born with very limited sensorimotor capabilities – Blind and deaf till days 13 to 15 – Legs cannot lift the body off the ground till after day 10 • However, they can aggregate in huddles and thermoregulate Locomotor Development Eyes and ears open First projections from brainstem CPG begin to function (birth) Motor Neurons Excitable Corticospinal Coupled activity Tract walking crawling In vitro and In vivo studies Fetal -7 -6 -5 -4 -3 Immature -2 -1 0 1 2 3 4 5 Transitory 6 7 8 9 10 Stages of Developement (Days) 11 12 13 Adult 14 15 16 17 18 19 Behavior in a Temperature Controlled Arena: A Simple Paradigm Metrics • Basic metric: tip of nose base of tail location • Derived metrics – Activity – Object Contact – Speed – Aggregation – Conditional Probabilities 7 and 10 Day Old Individual Locomotion: Examples 20 0.25 15 Day 7 10 0.2 0.15 0.1 0.05 5 0 0 0 5 10 15 20 25 30 20 0.45 0.4 0.35 15 Day 10 0.3 0.25 0.2 10 0.15 5 0.05 0 0.1 0 0 5 10 15 20 25 30 7 and 10 Day Old Individual & Group Locomotion Individual Group An Agent-Based Model Column Row P P W E E E E E Whole-Body Locomotion Kinematics 0 0 0 0 0 0 .5 0 .5 3 2 1,5 4,7,11 9 6,10 8 1: R, 2: L, 3: L, 4: R, 5: L, 6: R, 7: R, 8: L, 9: L, 10: R Whole-Body Locomotion Kinematics é0 0 0 ù ê ú ê.5 0 .5ú êë0 0 0 úû 3 9 8 5 10,11 7 6 2 4 1 1: R, 2: L, 3: L, 4: R, 5: L, 6: R, 7: R, 8: L, 9: L, 10: R Genetic Algorithms • Arrange the parameters of the into a “chromosome” r w f f fl l bl b … • Create a population of models • Perform mutation and crossover on pairs of models • Run a number of simulations and choose the parameters that best fit the data Locomotion Kinematic Results Day 7 Individual Group Day 10 é.090 .017 .090ù ê ú ê.091 0 .091ú êë.276 .070 .276úû é.068 .054 .068ù ê ú 0 .314ú ê.314 êë.056 .068 .056úû é.090 .017 .090ù ê ú ê.091 0 .091ú êë.276 .070 .276úû é.003 .401 .003ù ê ú ê.181 0 .181ú êë.114 .003 .114úû 7 and 10 Day Subgroup Formation Day 7 Day 10 7 and 10 Day Old Individual Locomotion: Examples 20 0.25 15 Day 7 10 0.2 0.15 0.1 0.05 5 0 0 0 5 10 15 20 25 30 20 0.45 0.4 0.35 15 Day 10 0.3 0.25 0.2 10 0.15 5 0.05 0 0.1 0 0 5 10 15 20 25 30 Model Examples 0.3 0.16 0.25 0.14 0.12 0.2 0.1 0.15 0.1 0.05 0.08 Day 7 0.06 0.04 0.02 0 0 0.35 0.35 0.3 0.3 0.25 0.25 0.2 0.15 0.1 0.05 0 Day 10 0.2 0.15 0.1 0.05 0