Modeling and Simulating Social Systems with MATLAB

Similar documents
Modeling and Simulating Social Systems with MATLAB

Course Summary Homework

Coordination and Control in Multi-Agent Systems

L Modeling and Simulating Social Systems with MATLAB

PARTICLE SWARM OPTIMIZATION (PSO)

Multiple Agents. Why can t we all just get along? (Rodney King) CS 3793/5233 Artificial Intelligence Multiple Agents 1

LECTURE 16: SWARM INTELLIGENCE 2 / PARTICLE SWARM OPTIMIZATION 2

THE EFFECT OF SEGREGATION IN NON- REPEATED PRISONER'S DILEMMA

Game Theory & Networks

Kyrre Glette INF3490 Evolvable Hardware Cartesian Genetic Programming

The Computational Beauty of Nature

L Modeling and Simulating Social Systems with MATLAB

QUANTUM BASED PSO TECHNIQUE FOR IMAGE SEGMENTATION

Using Game Theory To Solve Network Security. A brief survey by Willie Cohen

Random Boolean Networks and Evolutionary Game Theory

Key question: how to set CongestionWindow which, in turn, affects ARQ s sending rate? linear increase/exponential decrease AIMD

SWARM INTELLIGENCE -I

Traffic/Flocking/Crowd AI. Gregory Miranda

CS 231. Crowd Simulation. Outline. Introduction to Crowd Simulation. Flocking Social Forces 2D Cellular Automaton Continuum Crowds

Introduction to Computational Modeling of Social Systems

Using HMM in Strategic Games

Swarm Intelligence Particle Swarm Optimization. Erick Luerken 13.Feb.2006 CS 790R, University of Nevada, Reno

1/16. Emergence in Artificial Life. Sebastian Marius Kirsch Back Close

Network Selection and Handoff in Wireless Networks: A Game Theoretic Approach

Crowd simulation. Taku Komura

High-Dimensional Connectivity and Cooperation

Self-Repair of Cooperation Network under Nodes Failure

Introduction to Games and their Representation. Strategy and Game Theory

Lecture 8: Modelling Urban Morphology:

Failure in Complex Social Networks

Design Space Analysis for Modeling Incentives in Distributed Systems

From Selfish Nodes to Cooperative Networks Emergent Link-based incentives in Peer-to-Peer Networks 1

Graphs, Search, Pathfinding (behavior involving where to go) Steering, Flocking, Formations (behavior involving how to go)

Simple Channel-Change Games for Spectrum- Agile Wireless Networks

CS 378: Computer Game Technology

How do networks form? Strategic network formation

Week 9 Computational Intelligence: Particle Swarm Optimization

Meta- Heuristic based Optimization Algorithms: A Comparative Study of Genetic Algorithm and Particle Swarm Optimization

Chapter 3 Implementing Simulations as Individual-Based Models

An Introduction to Agent Based Modeling with Repast Michael North

Handling Multi Objectives of with Multi Objective Dynamic Particle Swarm Optimization

Evolutionary algorithms in communications

On the Computational Complexity of Nash Equilibria for (0, 1) Bimatrix Games

Do incentives build robustness in BitTorrent?

EE 553 Term Project Report Particle Swarm Optimization (PSO) and PSO with Cross-over

ARTIFICIAL INTELLIGENCE (CSCU9YE ) LECTURE 5: EVOLUTIONARY ALGORITHMS

Evolutionary Algorithms. CS Evolutionary Algorithms 1

Fault-Tolerant Wireless Sensor Networks using Evolutionary Games

MAY 2009 EXAMINATIONS. Multiagent Systems

CSE151 Assignment 2 Markov Decision Processes in the Grid World

Ant Colonies, Self-Organizing Maps, and A Hybrid Classification Model

Analysis and Modeling

A *69>H>N6 #DJGC6A DG C<>C::G>C<,8>:C8:H /DA 'D 2:6G, ()-"&"3 -"(' ( +-" " " % '.+ % ' -0(+$,

Introduction to Dynamic Traffic Assignment

CS 354 R Game Technology

Challenges in Ubiquitous Data Mining

1 Lab + Hwk 5: Particle Swarm Optimization

Fast Convergence of Regularized Learning in Games

Self-formation, Development and Reproduction of the Artificial System

Homework 5: Spatial Games : Programming for Scientists Due: Thursday, March 3, 2016 at 11:59 PM

1 Lab + Hwk 5: Particle Swarm Optimization

Introduction to Scientific Modeling CS 365, Fall Semester, 2007 Genetic Algorithms

CS 4700: Artificial Intelligence

BEHAVIOR OF SELF-MOTIVATED AGENTS IN COMPLEX NETWORKS

Prisoner s Dilemma in Graphs with Heterogeneous Agents

NUMB3RS Activity: Follow the Flock. Episode: In Plain Sight

Asynchronous Learning in Decentralized Environments: A Game Theoretic Approach

1 Lab 5: Particle Swarm Optimization

Pascal De Beck-Courcelle. Master in Applied Science. Electrical and Computer Engineering

Design Space Analysis for Modeling Incentives in Distributed Systems

How Bad is Selfish Routing?

Evolving Strategies for the Prisoner's Dilemma

Incentive for P2P Fair Resource Sharing

Evolutionary games and language

Game Theory Application for Performance Optimisation in Wireless Networks

Introduction to Game Theory

COMP SCI 5401 FS Iterated Prisoner s Dilemma: A Coevolutionary Genetic Programming Approach

CHAPTER 1 INTRODUCTION

Cooperative Wireless Networking. Frank H.P. Fitzek Aalborg University

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Using Reinforcement Learning to Optimize Storage Decisions Ravi Khadiwala Cleversafe

Optimal Power Flow Using Particle Swarm Optimization

Distributed Data Management. Christoph Lofi Institut für Informationssysteme Technische Universität Braunschweig

EE228a - Lecture 20 - Spring 2006 Concave Games, Learning in Games, Cooperative Games

Example 1: An algorithmic view of the small world phenomenon

Today s lecture. Competitive Matrix Games. Competitive Matrix Games. Modeling games as hybrid systems. EECE 571M/491M, Spring 2007 Lecture 17

CSC D84 Assignment 2 Game Trees and Mini-Max

Cooperation in Wireless Grids

CHAPTER 2 CONVENTIONAL AND NON-CONVENTIONAL TECHNIQUES TO SOLVE ORPD PROBLEM

Lecture 20: SW Testing Presented by: Mohammad El-Ramly, PhD

Towards Automatic Social Bootstrapping of Peer-to-Peer Protocols

ATI Material Do Not Duplicate ATI Material. www. ATIcourses.com. www. ATIcourses.com

Object-Oriented Analysis and Design Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology-Kharagpur

Coevolutionary Neural Population Models

Design and Implementation of Experimental Platform for Multiple Games

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Algorithms and Game Theory Date: 12/3/15

Rapid Application Development [RAD]

GPU-based Distributed Behavior Models with CUDA

Optimal Channel Selection for Cooperative Spectrum Sensing Using Coordination Game

Topics in Artificial Intelligence: Multiagent Systems Selfish Routing in Computer Networks

Transcription:

Modeling and Simulating Social Systems with MATLAB Lecture 7 Game Theory / Agent-Based Modeling Stefano Balietti, Olivia Woolley, Lloyd Sanders, Dirk Helbing Computational Social Science ETH Zürich 02-11-2015

Repetition: Cellular Automata Cellular automata are abstract representations of dynamics in discrete space and time Reduction of complexity to simple microscopic interaction rules based on neighborhoods in a grid Their simplicity is also a limitation of cellular automata: system dynamics cannot always be reduced to neighborbased interaction rules in a grid Can be test beds for complex systems: for example comparison of results of cellular automata and dynamical systems 02-11-2015 Modeling and Simulating Social Systems with MATLAB 2

Microscopic modeling Some real world processes can be reduced to simple local interaction rules (e.g. swarm intelligence) Microscopic modeling requires that dynamic components of a system are atomizable in the given context (e.g. pedestrians behave like particles) Represents a reductionist (or mechanistic) point of view in contrast to a systemic (or holistic) approach In line with methods that have fueled the success of natural science research in the past 200 years Game theory provides a powerful framework to formalize and reduce complex (strategic) interactions 02-11-2015 Modeling and Simulating Social Systems with MATLAB 3

Game Theory Mathematical framework for strategic interactions of individuals Formalizes the notion of finding a best strategy (Nash equilibrium) when facing a well-defined decision situation Definition and study of games Underlying assumption is that individuals optimize their payoffs (or more precisely: utility ) when faced with strategic decisions Repeated interactions are interesting for simulations (results can be completely different from one-shot games) 02-11-2015 Modeling and Simulating Social Systems with MATLAB 4

Game Theory - Human Cooperation Prisoner s dilemma 15,15 20,0 0,20 19,19 02-11-2015 Modeling and Simulating Social Systems with MATLAB 5

Game Theory: Assumptions Rationality: alignment between preferences, belief, and actions Players want to maximize their payoff A player's belief is something like: I am rational, you are rational. I know that you are rational, and you know that I know that you rational. Everybody knows that I know that you are rational, and you know Players act accordingly: best response 02-11-2015 Modeling and Simulating Social Systems with MATLAB 6

Nash Equilibrium Is the strategy that players always play with no regrets: best response No player has an incentive to deviate from a Nash equilibrium In many circumstances, there is more than one Nash equilibrium Some questions Is Nash an optimal strategy? What is the difference between a Paretoefficient equilibrium and a Nash Equilibrium? Why do players play Nash? Do they? 02-11-2015 Modeling and Simulating Social Systems with MATLAB 7

The Evolution of Cooperation (Axelrod, 1984) Often a very good strategy: Tit for tat be nice: cooperate first then do whatever your opponent did in the last round (punish defection; reward cooperation) Other possible strategies: Always cooperate / always defect Tit for tat, but defect on first round Win Stay, Lose Shift: repeat behavior if successful Shadow of the future probability that there will be a next round 02-11-2015 Modeling and Simulating Social Systems with MATLAB 8

Game Theory - Coordination Games 1,1 0,0 0,0 1,1 Game Examples: Stag-hunt / assurance game Chicken / hawk-dove game 02-11-2015 Modeling and Simulating Social Systems with MATLAB 9

Evolutionary Game Theory Classical game theory has its limitations too: assumption of hyper-rational players; strategy selection problem; static theory Evolutionary game theory introduces evolutionary dynamics for strategy selection, i.e. the evolutionary most stable strategy dominates the system dynamics Very suited for agent-based modeling of social phenomena as it allows agents to learn and adapt 02-11-2015 Modeling and Simulating Social Systems with MATLAB 10

Evolutionary Learning The main assumption underlying evolutionary thinking is that the entities which are more successful at a particular time will have the best chance of being present in the future Selection Replication Mutation 02-11-2015 Modeling and Simulating Social Systems with MATLAB 11

Evolutionary Learning Selection is a discriminating force that favors successful agents Replication produces new agents based on the properties of existing ones ( inheritance ) Selection and replication work closely together, and in general tend to reduce diversity The generation of new diversity is the job of the mutation mechanism 02-11-2015 Modeling and Simulating Social Systems with MATLAB 12

How agents can learn Imitation: Agents copy the behavior of others, especially behavior that is popular or appears to yield high payoffs Reinforcement: Agents tend to adopt actions that yielded a high payoff in the past, and to avoid actions that yielded a low payoff Best reply: Agents adopt actions that optimize their expected payoff given what they expect others to do (choosing best replies to the empirical frequency distribution of their opponents previous actions: fictitious play ) 02-11-2015 Modeling and Simulating Social Systems with MATLAB 13

From Factors to Actors (Macy, 2002) Simple and predictable local interactions can generate complex and sometimes surprising global patterns Examples: diffusion of information, emergence of norms, coordination of conventions, or participation in collective action Simulation of individual actors instead of modeling based on aggregated factors (e.g. dynamical systems) 02-11-2015 Modeling and Simulating Social Systems with MATLAB 14

From Factors to Actors (Macy, 2002) Agents are autonomous Agents are interdependent Agents follow simple rules Agents are adaptive and backward-looking 02-11-2015 Modeling and Simulating Social Systems with MATLAB 15

Swarm Intelligence Ant colonies, bird flocking, animal herding, bacterial growth, fish schooling Key Concepts: decentralized control interaction and learning self-organization 02-11-2015 Modeling and Simulating Social Systems with MATLAB 16

Boids (Reynolds, 1986) Boids (bird-like objects) as simulated individual objects moving in a 3-dimensional virtual space 02-11-2015 Modeling and Simulating Social Systems with MATLAB 17

More information: http://www.red3d.com/cwr/boids/ Separation: steer to avoid crowding local flockmates Alignment: steer towards the average heading of local flockmates Cohesion: steer to move toward the average position of local flockmates 02-11-2015 Modeling and Simulating Social Systems with MATLAB 18

Programming Agent-Based Simulations State update According to set of behavioral rules Time t Characterized by a state (location, dead/alive, level of excitation) Time t + dt New state Time line T1 dt T2 02-11-2015 Modeling and Simulating Social Systems with MATLAB 19

Programming Agent-Based Simulations State update According to set of behavioral rules, including neighborhood Time t Characterized by a state (location, dead/alive, level of excitation) Time t + dt New state Time line T1 T2 dt 02-11-2015 Modeling and Simulating Social Systems with MATLAB 20

Programming a simulator Programming an agent-based simulator often goes in five steps Initialization - Initial state; parameters; environment Time loop - Processing each time steps Agents loop - Processing each agents Update - Updating agent i at time t Save data - For further analysis Initialization Agents loop Update state end Save data 02-11-2015 Modeling and Simulating Social Systems with MATLAB 21

Programming a simulator Efficient Structure Define and initialize all variables in the very beginning of your program Execute the actual simulation as a function with the most important variables as inputs and the most important result values as outputs Automated analysis, visualization, etc. of the simulation results after retrieving the output of the main function 02-11-2015 Modeling and Simulating Social Systems with MATLAB 22

Programming a simulator Step 1: Defining the initial state & parameters % Initial state t0 = 0; dt = 1; T = 100; % begining of the time line % time step % number of time steps % Initial state of the agents State1 = [0 0 0 0]; State2 = [1 1 1 1]; % etc 02-11-2015 Modeling and Simulating Social Systems with MATLAB 23

Programming a simulator Step 1: Defining the initial state & parameters % Initial state t0 = 0; dt = 1; T = 100; % begining of the time line % time step % number of time steps % Initial state of the agents State1 = zeros(1,50); State2 = rand(1,50); 02-11-2015 Modeling and Simulating Social Systems with MATLAB 24

Programming a simulator Step 2: Covering each time step % Time loop for t=t0:dt:t end % What happens at each time step? % - Update environment % - Update agents 02-11-2015 Modeling and Simulating Social Systems with MATLAB 25

Programming a simulator Step 3: Covering each agent % Agent loop for i=1:length(states) % What happens for each agent? end 02-11-2015 Modeling and Simulating Social Systems with MATLAB 26

Programming a simulator Step 4: Updating agent i at time t % Update % % Example: Each agent has 60% chance to % switch to state 1 randomvalue = rand(); if (randomvalue < 0.6) State(i)=1; else State(i)=0; end 02-11-2015 Modeling and Simulating Social Systems with MATLAB 27

Programming a simulator Step 4: Updating agent i at time t % Update % % Example: Each agent has chance 'probsw' % to switch to state 1 randomvalue = rand(); if (randomvalue < probsw) State(i)=1; else State(i)=0; end define in first part 02-11-2015 Modeling and Simulating Social Systems with MATLAB 28

Programming a simulator Step 4: Updating agent i at time t % Initial state t0 = 0; % begining of the time line dt = 1; % time step T = 100; % number of time steps probsw = 0.6; % probability to switch state 02-11-2015 Modeling and Simulating Social Systems with MATLAB 29

Programming a simulator Step 5: Final processing % Outputs and final processing propalive = sum(states)/length(states); % propalive is the main output of the % simulation 02-11-2015 Modeling and Simulating Social Systems with MATLAB 30

Programming a simulator Encapsulating main part in a function: % simulation function % input: probsw % output: propalive function [propalive] = simulation(probsw) end %... propalive = sum(states)/length(states); 02-11-2015 Modeling and Simulating Social Systems with MATLAB 31

Programming a simulator Running the simulation: >> p=simulation(0.6) p = 0.54 >> p=simulation(0.6) p = 0.72 02-11-2015 Modeling and Simulating Social Systems with MATLAB 32

Programming a simulator Automatically run a large number of simulations: % Running N simulations N = 1000; % number of simulations probsw = 0.6; % probability to switch state for n=1:n p(n) = simulation(probsw); end 02-11-2015 Modeling and Simulating Social Systems with MATLAB 33

Programming a simulator Global variables: global alpha beta % mark as global alpha = 0.1; beta = 0.9; for n=1:n p(n) = simulation(probsw); end function [propalive] = simulation(probsw) % mark as global with the function too: global alpha beta %... end 02-11-2015 Modeling and Simulating Social Systems with MATLAB 34

Programming a simulator Alternatively: >> hist(p) 02-11-2015 Modeling and Simulating Social Systems with MATLAB 35

Object-oriented Programming in MATLAB MATLAB has support for object-oriented programming However, we do not encourage to use this feature, as it is not an efficient way of programming in MATLAB Use of vectors and matrices instead of objects If you still want to have a look at how object-oriented programming works in MATLAB: http://www.mathworks.com/company/newsletters/articles/introduction-to-object-oriented-programming-in-matlab.html 02-11-2015 Modeling and Simulating Social Systems with MATLAB 36

Exercise 1 There is some additional material on the iterated prisoner s dilemma available in the directory 'prisoner' of https://github.com/msssm/lecture_files Experiment with the code and try to find out what it does and how to interpret the results 02-11-2015 Modeling and Simulating Social Systems with MATLAB 37

Exercise 2 Start thinking about how to adapt the general simulation engine shown today for your project Problems: Workspace organization (files, functions, data) Parameters initialization Number of agents Organization of loops Which data to save, how frequently, in which format What kind of interactions are relevant 02-11-2015 Modeling and Simulating Social Systems with MATLAB 38

References Fudenberg & Tirole, Game Theory, MIT Press (2000) Meyerson, Game Theory, Harvard University Press (1997) Herbert Gintis, Game Theory Evolving, Princeton Univ. Press, 2 nd Edition (2009) Uhrmacher, Weyns (Editors), Multi-Agent Systems Simulation and Applications, CRC Press (2009) A step by step guide to compute the Nash equilibrium: http://uwacadweb.uwyo.edu/shogren/jaysho/nashnotes.pdf https://github.com/sandermatt/ethaxelrodnoise 02-11-2015 Modeling and Simulating Social Systems with MATLAB 39