Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence:...

64
Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial ̶̶̶̶ Share Alike http://creativecommons.org/licenses/by-nc-sa/2.5/

Transcript of Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence:...

Page 1: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agent-based models and social simulation

Gilberto CâmaraTiago CarneiroPedro Andrade

Licence: Creative Commons ���� By Attribution ���� Non Commercial ���� Share Alikehttp://creativecommons.org/licenses/by-nc-sa/2.5/

Page 2: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Where does this image come from?

Page 3: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Where does this image come from?

Map of the web (Barabasi) (could be brain connections)

Page 4: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Information flows in Nature

Ant colonies live in a chemical world

Page 5: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Conections and flows are universal

Yeast proteins(Barabasi and Boneabau,

SciAm, 2003)

Scientists in Silicon Valley(Fleming and Marx, Calif Mngt

Rew, 2006)

Page 6: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Information flows in the brain

Neurons transmit electrical information, which generate conscience and emotions

Page 7: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Information flows generate cooperation

White cells attact a cancer cell (cooperative activity)

Foto: National Cancer Institute, EUA http://visualsonline.cancer.gov/

Page 8: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Information flows in planet Earth

Mass and energy transfer between points in the planet

Page 9: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Complex adaptative systems

How come that a city with many inhabitants functions and exhibits patterns of regularity?

How come that an ecosystem with all its diverse species functions and exhibits patterns of regularity?

Page 10: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

What are complex adaptive systems?

Systems composed of many interacting parts that evolve and adapt over time.

Organized behavior emerges from the simultaneous interactions of parts without any global plan.

Page 11: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

What are complex adaptive systems?

Page 12: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Universal Computing

Computing studies information flows in natural systems...

...and how to represent and work with information flows in artificial systems

Page 13: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents as basis for complex systems

Agent: flexible, interacting and autonomous

An agent is any actor within an environment, any entity that can affect itself, the environment and other agents.

Page 14: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agent-Based Modelling

Goal

Space

Representations

Communication

ActionPerception

Communication

Gilbert, 2003

Page 15: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents: autonomy, flexibility, interaction

Synchronization of fireflies

Page 16: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Why is it interesting?

Structure structure is emergent from agent interaction this can be directly modeled

Agency agents have goals, beliefs and act this can be directly modeled

Dynamics things change, develop, evolve agents move (in space and social location) and learn these can be directly modeled

Source: (Gilbert, 2006)

Page 17: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Is it qualitative or quantitative?

Agent-based models can handle all types of data quantitative attributes

age size of organization

qualitative ordinal or categorical (e.g. ethnicity), relational (e.g. I am linked to him and her)

vague A sends B a message about one time in three

Source: (Gilbert, 2006)

Page 18: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

It has been used in different areas of science

economy

sociology

archaeology

ecology

linguistics

political sciences

...

Page 19: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Source: http://www.leggmason.com/thoughtleaderforum/2004/conference/transcripts/arthur_trans.asp

Page 20: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents changing the landscape

An individual, household, or institution that takes specific actions according to its own decision rules which drive land-cover change.

Page 21: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Four types of agents

Natural agents, artificial environment

Artificial agents, artificial environment Artificial agents, natural environment

Natural Agents, natural environment

fonte: Helen Couclelis (UCSB)

Page 22: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Four types of agents

Natural agents, artificial environment

Artificial agents, artificial environment Artificial agents, natural environment

Natural Agents, natural environment

fonte: Helen Couclelis (UCSB)

e-science Engineering Applications

BehavioralExperiments

Descriptive Model

Page 23: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Is computer science universal?

Modelling information flows in nature is computer science

http://www.red3d.com/cwr/boids/

Page 24: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Bird Flocking (Reynolds)

Example of a computational model1. No central autority2. Each bird reacts to its neighbor3. Model based on bottom up

interactionshttp://www.red3d.com/cwr/boids/

Page 25: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Bird Flocking: Reynolds Model (1987)

www.red3d.com/cwr/boids/

Cohesion: steer to move toward the average position of local flockmates

Separation: steer to avoid crowding local flockmates

Alignment: steer towards the average heading of local flockmates

Page 26: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents moving

Page 27: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents moving

Page 28: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agents moving

Page 29: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Schelling segregation model

Page 30: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Segregation

Some studies show that most people prefer to live in a non-segregated society. Why there is so much segregation?

Page 31: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

SegregationSegregation is an outcome of individual choices

But high levels of segregation indicate mean that people are prejudiced?

Page 32: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Schelling’s Model of Segregation

< 1/3

Micro-level rules of the game

Stay if at least a third of neighbors are “kin”

Move to random location otherwise

Page 33: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Schelling’s Model of Segregation

Schelling (1971) demonstrates a theory to explain the persistence of racial segregation in an environment of growing tolerance

If individuals will tolerate racial diversity, but will not tolerate being in a minority in their locality, segregation will still be the equilibrium situation

Page 34: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Schelling Model for Segregation

Start with a CA with “white” and “black” cells (random)The new cell state is the state of the majority of the

cell’s Moore neighboursWhite cells change to black if there are X or more black

neighboursBlack cells change to white if there are X or more white

neighbours

How long will it take for a stable state to occur?

Page 35: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Schelling’s Model of Segregation

Tolerance values above 30%: formation of ghettos

Page 36: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

ABM in TerraME:Types and Functions

Page 37: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Agen

t

Spa

ce

Space Agent

TerraME: nature-society modelling

T. Carneiro, P. Andrade, et al., “An extensible toolbox for modeling nature-society interactions”. Enviromental Modelling and Software, 2013 (Two PhDs).

Nature represented in cellular spaces, society represented as agents

Page 38: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Geometry

Cellular SpaceSocial Network

Object

Types in TerraLib ecosystem: new tools, new types

Coverage

Time Series Trajectory Event

Agent

2002

2010

2014

Page 39: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

CellAgent

forEachAgent forEachCell

forEachCellforEachRelative forEachNeighbor

forEachAgent

CellularSpaceSociety

Group Trajectory

DBMS

Page 40: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

agents = cell:getAgents()if #(agents) == 0 then -- empty agent:leave(oldcell) agent:enter(cell)end

Agents within cells

Page 41: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Society

上海宋ABC

ACA

AACCCC

BBC

CBB

CAC

BBA

CCB

CBA

AAA

BAB

Page 42: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

createAgent = function(capital) return Agent { capital = capital, -- ... }end

data = {}data[1] = 100; data[2] = 50; data[3] = 25mag = Society(createAgent, data)

mag = Society(createAgent, 50)

capital = 100 capital = 50 capital = 25

Society

Page 43: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

function createAgent (capital) person = Agent { init = function (self), -- ...

}end

data = {}data[1] = 100; data[2] = 50; data[3] = 25mag = Society(createAgent, data)

mag = Society(createAgent, 50)

capital = 100 capital = 50 capital = 25

Society

Page 44: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

CCC

BBC

CBB

CAC

BBA

CCB

CBA

ABC

ACA

AAC

AAA

BAB

Group

Page 45: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

g = Group{mag, function(agent) return agent. capital > 40 end, function(a1, a2) return a1.capital > a2.capital end}

capital = 100 capital = 50 capital = 25

Group

Page 46: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

forEachAgent(mag, function(agent) agent.capital = agent.capital + 100end)

capital = 200 capital = 150 capital = 125

capital = 100 capital = 50 capital = 25

Traversing the Society

Page 47: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Emergence

source: (Bonabeau, 2002)

“Can you grow it?” (Epstein; Axtell; 1996)

Page 48: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Epstein (Generative Social Science)

If you didn´t grow it, you didn´t explain its generation

Agent-based model Generate a macro-structure

Agents = properties of each agent + rules of interaction

Target = macrostruture M that represents a plausible pattern in the real-world

Page 49: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Scientific method

Science proceeds by conjectures and refutations (Popper)

Page 50: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Explanation and Generative Sufficiency

Macrostructure

Spatial segregationBird flocking

Agent modelA1

Agent modelA2

Agent modelA3

?

Refutation

Conjectures

?

Page 51: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Explanation and Generative Sufficiency

Macrostructure

Occam´s razor:"entia non sunt multiplicanda praeter necessitatem", or

"entities should not be multiplied beyond necessity".

Agent modelA1

Agent modelA2

?

Page 52: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Explanation and Generative Sufficiency

Macrostructure

Popper´s view"We prefer simpler theories to more complex ones

because their empirical content is greater and because they are better testable"

Agent modelA1

Agent modelA2

?

Page 53: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Explanation and Generative Sufficiency

Macrostructure

Einstein´s rule:The supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of

experience"

"Theories should be as simple as possible, but no simpler.

Agent modelA1

Agent modelA2

?

Page 54: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Urban Growth in Latin American cities:exploring urban dynamics through agent-based simulation

Joana Xavier Barros

2004

Page 55: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Latin American cities

High rates of urban growth (rapid urbanization) Poverty + spontaneous settlements (slums) Poor control of public policies on urban development Fragmented urban fabric with different and disconnected

morphological patterns that evolve and transform over time.

Page 56: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Peripherization

São Paulo - Brasil Caracas - Venezuela

Process in which the city grows by the addition of low income ‐residential areas in the peripheral ring. These areas are slowly incorporated to the city by spatial expansion, occupied by a higher economic group while new low income settlements keep emerging on the periphery.‐ .

Page 57: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Urban growth

“Urban sprawl” in United States

“Urban sprawl”in Europe (UK)

Peripherization in Latin America

(Brazil)

Page 58: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Research question

How does this process happen in space and time?

How space is shaped by individual decisions? Complexity approachTime + Space automata model

Social issues agent‐based simulation)

Page 59: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Model: Growth of Latin American cities

Peripherisation module

Spontaneous settlements module

Inner city processes module

Spatial constraints module

Page 60: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Peripherization module

reproduces the process of expulsion and expansion by simulating the residential locational processes of 3 distinct economic groups.

assumes that despite the economic differences all agents have the same locational preferences. They all want to locate close to the best areas in the city which in Latin America means to be close to high‐income areas

all agents have the same preferences but different restrictions

Page 61: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Peripherization module: rules

1. proportion of agents per group is defined as a parameter2. high income agent –can locate anywhere ‐3. medium income agent –can locate anywhere except on high‐ ‐

income places4. low income agent –can locate only in the vacant space‐5. agents can occupy another agent’s cell: then the latter is

evicted and must find another

Page 62: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Peripherization module: rules

Page 63: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Peripherization module: rules

Spatial pattern:

the rules do not suggests that the spatial outcome of the model would be a segregated pattern

Approximates the spatial structure found in the residential locational pattern of Latin American cities

multiple initial seeds ‐resembles certain characteristics of metropolitan areas

Page 64: Agent-based models and social simulation Gilberto Câmara Tiago Carneiro Pedro Andrade Licence: Creative Commons ̶̶̶̶ By Attribution ̶̶̶̶ Non Commercial.

Comparison with reality

Maps of income distribution for São Paulo, Brazil (census 2000)

Maps A and B: quantile breaks (3 and 6 ranges)

Maps C and D: natural breaks (3 and 6 ranges)

No definition of economic groups or social classes