Replication in Agent Based Models Using Formal Methods and Multiple Updating Strategies
Total Page:16
File Type:pdf, Size:1020Kb
Replication in Agent Based Models using Formal Methods and Multiple Updating Strategies Joseph Kehoe BSc MSc A Thesis submitted for the degree of Doctor of Philosophy Supervisors: Dr. Martin Crane, Prof. Heather Ruskin School of Computing Dublin City University June 2017 Declaration I hereby certify that this material, which I now submit for assessment on the pro- gramme of study leading to the award of PhD is entirely my own work, and that I have exercised reasonable care to ensure that the work is original, and does not to the best of my knowledge breach any law of copyright, and has not been taken from the work of others save and to the extent that such work has been cited and acknowledged within the text of my work. Signed: (Candidate) ID No.: 58118713 Date: 5th May 2015 i Abstract Replication in Agent Based Models using Formal Methods and Multiple Updating Strategies Joseph Kehoe Agent based Modelling is now a standard form of modelling in the field of so- cial simulations. One of the outstanding issues in this field is known as the Repli- cation Problem. Simply stated this is the inability of researchers to independently replicate the results of Agent Based Models published by other researchers. This thesis outlines a two-part proposed solution to this problem that uses formal meth- ods to precisely specify Agent Based Models and employs multiple updating strate- gies to demonstrate that any simulation results are independent of updating strat- egy. A novel synchronous updating algorithm is presented that allows synchronus updating to be extended from Cellular Automata based simulations to Agent Based Simulations. Asymptotic analysis of the novel synchronous algorithm shows that it is Θ(n log n) in time and Θ(n) in space. It is demonstrated that the new algo- rithm does not suffer from the deficiencies of existing asynchronous algorithms and that it also allows collision detection to be incorporated into agent behaviours. The applicability of this approach is demonstrated by specifying and then repro- ducing the results of Sugarscape, a well known and complex Agent Based Social Simulation. The first formal specification of Sugarscape is presented and used to identify the ambiguities that have made replication of the original results so diffi- cult. A framework is developed that implements the new algorithm alongside ex- isting asynchronus algorithms and is used to implement Sugarscape and compare the different updating approaches. This is the first synchronous implementation of Sugarscape and the only synchronous implementation of any Agent Based Model of comparable complexity. It is also the first comparison of synchronous and asyn- chronus updating applied to the same Agent Based Model. Keywords: Agent Based Models, Agent Based Social Simulations, Replica- tion Problem, Formal Methods, Z Notation, Synchronous Updating, Asynchronous Updating, Algorithms. i Contents 1 Introduction 2 1.1 Agent-Based Modelling . .2 1.2 Ensuring Reproducibility of Results . .4 1.3 Outline of Thesis . .6 2 Agent Based Models (ABM) 7 2.1 Introduction . .7 2.2 Computer Simulations . .7 2.2.1 What are Simulations? . .7 2.2.2 The Purpose of Simulation . 10 2.3 What are Agent Based Models? . 12 2.3.1 Characteristics . 12 2.3.2 Topologies . 13 2.3.3 Neighbourhood . 15 2.3.4 History of ABM . 16 2.4 Alternatives to ABM . 20 2.4.1 Introduction . 20 2.4.2 Dynamic Micro-Simulation (DMS) . 21 2.4.3 Equation-Based Modelling (EBM) . 21 2.4.4 Discrete Event Simulation (DES) . 22 2.5 Toolkits . 23 2.5.1 Introduction . 23 2.5.2 NetLogo . 24 2.5.3 Repast . 25 2.5.4 Mason . 26 2.5.5 Ascape . 27 2.5.6 Other Toolkits . 27 2.6 The Replication Problem . 28 2.6.1 Overview, Design concepts, and Details . 29 2.6.2 Model Alignment . 30 2.6.3 A Model Driven Approach . 31 2.6.4 Executable Papers . 31 2.6.5 Data Sharing . 32 ii 2.6.6 Reproducibility versus Replication . 32 2.7 Application Areas . 33 2.7.1 ABSS . 33 2.7.2 Computer Games . 34 2.8 Comparing Synchronous and Asynchronous Updating . 35 2.8.1 Asynchronous Updating . 36 2.8.2 Synchronous Updating . 37 2.9 Synchronous ABM . 39 2.9.1 Influences and Reaction . 39 2.9.2 Synchronous IBM . 40 2.9.3 Transactional Cellular Automata . 41 2.9.4 Pedestrian Traffic . 42 2.9.5 Turmites . 42 2.9.6 Synchronous Objects . 44 2.9.7 Combined Synchronous and Asynchronous . 45 2.10 Summary . 45 3 Concurrency 48 3.1 Introduction . 48 3.2 Issues in Concurrency . 49 3.3 Measuring Concurrent Performance . 51 3.3.1 Concurrency Metrics . 51 3.3.2 Strong Scalability: Amdahl’s Law . 53 3.3.3 Weak Scalability: Gustafson-Barsis’ Law . 54 3.3.4 Asymptotic Analysis . 56 3.3.5 OpenMP . 59 3.4 Heterogeneous Processing in Agent Based Models . 60 3.5 Summary . 62 4 Sugarscape 63 4.1 Sugarscape’s Place in ABM . 63 4.2 The Definition of Sugarscape . 64 4.3 The Lattice . 64 4.4 The Agents . 65 4.5 The Rules . 66 4.5.1 Growback . 66 4.5.2 Seasonal Growback . 66 4.5.3 Pollution Formation . 66 4.5.4 Pollution Diffusion . 67 4.5.5 Replacement . 67 4.5.6 Movement . 68 4.5.7 Agent Mating . 68 4.5.8 Agent Inheritance . 69 4.5.9 Agent Culture . 69 iii 4.5.10 Agent Combat . 70 4.5.11 Credit . 71 4.5.12 Agent disease processes . 73 4.5.13 Agent Trade . 74 4.6 Conclusion . 75 5 Formally Specifying Agent Based Models 76 5.1 Introduction . 76 5.2 The Replication Problem . 76 5.3 Formal Specification . 77 5.4 Specifying Sugarscape . 78 5.4.1 Overview . 78 5.4.2 Types and Constants . 80 5.4.3 State . 82 5.4.4 Initial State . 88 5.4.5 Specifying Behaviours . 89 5.4.6 Synchronous Rule Specification . 92 5.4.7 Specifying Conflict Resolution . 95 5.4.8 Specifying Asynchronous Updating Strategies . 97 5.4.9 Overview of Specification Process . 103 5.5 Results of the Specification . 104 5.6 Issues . 105 5.7 Conclusion . 106 6 Extending Synchronous Updating to Agent Based Modelling 109 6.1 Introduction . 109 6.2 Distinguishing Sequential and Concurrent Updating . 110 6.3 DES versus ABM . 114 6.4 Asynchronous versus Synchronous . 115 6.5 Instantaneous Information Leakage between Neighbourhoods . 117 6.5.1 Probability of Instantaneous Information Transfer Accross Local Boundaries . 120 6.6 Conflict Resolution . 125 6.7 Rule Classification . 127 6.8 Synchronous Algorithms . 129 6.8.1 Independent Actions . 130 6.8.2 Read-Dependent Actions . 131 6.8.3 Write-Dependent Actions . 134 6.8.4 Synchronous DES . 145 6.8.5 Issues with Asymptotic Complexity . 145 6.9 Conclusion . 148 iv 7 Sugarscape: A Case Study in Replication 150 7.1 Introduction . 150 7.2 The Framework . 151 7.2.1 Using the Framework . 153 7.2.2 Framework Overview . 156 7.3 Results from reproducing Sugarscape . 158 7.3.1 Carrying Capacity . 158 7.3.2 Effect of Metabolism and Vision on Carrying Capacity . 164 7.3.3 Comparing effects of SU and AU on Carrying Capacity . 166 7.3.4 Convergence of Culture . 169 7.3.5 Mating and Evolution . 170 7.4 Conclusion . 176 8 Conclusion 180 8.1 Overview of Thesis . 180 8.2 What we Achieved . 181 8.2.1 Improving Replication of ABM through Formal Specification181 8.2.2 Detecting Artefacts through Multiple Updating Strategies 182 A Empirical Benchmarks 185 A.1 Overview of Benchmarks . 185 A.1.1 Sequential Benchmarks.