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/ Where does this image come from? Where does this image come from? Map of the web (Barabasi) (could be brain connections) Information flows in Nature Ant colonies live in a chemical world Conections and flows are universal Yeast proteins (Barabasi and Boneabau, SciAm, 2003) Scientists in Silicon Valley (Fleming and Marx, Calif Mngt Rew, 2006) Information flows in the brain Neurons transmit electrical information, which generate conscience and emotions Information flows generate cooperation Foto: National Cancer Institute, EUA http://visualsonline.cancer.gov/ White cells attact a cancer cell (cooperative activity) Information flows in planet Earth Mass and energy transfer between points in the planet Complex adaptative systems How come that an ecosystem with all its diverse species functions and exhibits patterns of regularity? How come that a city with many inhabitants functions and exhibits patterns of regularity? 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. What are complex adaptive systems? Universal Computing Computing studies information flows in natural systems... ...and how to represent and work with information flows in artificial systems Agents as basis for complex systems An agent is any actor within an environment, any entity that can affect itself, the environment and other agents. Agent: flexible, interacting and autonomous Agent-Based Modelling Representations Goal Communication Communication Action Perception Environment Gilbert, 2003 Agents: autonomy, flexibility, interaction Synchronization of fireflies 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) 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) It has been used in different areas of science economy sociology archaeology ecology linguistics political sciences ... Source: http://www.leggmason.com/thoughtleaderforum/2004/conference/transcripts/arthur_trans.asp Agents changing the landscape An individual, household, or institution that takes specific actions according to its own decision rules which drive land-cover change. Four types of agents Artificial agents, artificial environment Artificial agents, natural environment Natural agents, artificial environment Natural Agents, natural environment fonte: Helen Couclelis (UCSB) Four types of agents e-science Artificial agents, artificial environment Behavioral Experiments Natural agents, artificial environment Engineering Applications Artificial agents, natural environment Descriptive Model Natural Agents, natural environment fonte: Helen Couclelis (UCSB) Is computer science universal? Modelling information flows in nature is computer science http://www.red3d.com/cwr/boids/ Bird Flocking (Reynolds) Example of a computational model 1. No central autority 2. Each bird reacts to its neighbor 3. Model based on bottom up interactions http://www.red3d.com/cwr/boids/ Bird Flocking: Reynolds Model (1987) 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 www.red3d.com/cwr/boids/ Agents moving Agents moving Agents moving Schelling segregation model Segregation Some studies show that most people prefer to live in a non-segregated society. Why there is so much segregation? Segregation Segregation is an outcome of individual choices But high levels of segregation indicate mean that people are prejudiced? Schelling’s Model of Segregation Micro-level rules of the game Stay if at least a third of neighbors are “kin” < 1/3 Move to random location otherwise 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 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 neighbours White cells change to black if there are X or more black neighbours Black cells change to white if there are X or more white neighbours How long will it take for a stable state to occur? Schelling’s Model of Segregation Tolerance values above 30%: formation of ghettos ABM in TerraME: Types and Functions TerraME: nature-society modelling Agent Agent Space Space Nature represented in cellular spaces, society represented as agents T. Carneiro, P. Andrade, et al., “An extensible toolbox for modeling nature-society interactions”. Enviromental Modelling and Software, 2013 (Two PhDs). Types in TerraLib ecosystem: new tools, new types 2014 Time Series Trajectory Cellular Space 2010 Agent Event Social Network Object 2002 Geometry Coverage forEachRelative forEachCell Agent forEachNeighbor Cell forEachAgent forEachAgent forEachCell Society CellularSpace Group Trajectory DBMS Agents within cells agents = cell:getAgents() if #(agents) == 0 then -- empty agent:leave(oldcell) agent:enter(cell) end Society CBB CAC CBA CCB ACA CCC AAC BBC ABC AAA 上海宋 BBA BAB Society createAgent = function(capital) return Agent { capital = capital, -- ... } end data = {} data[1] = 100; data[2] = 50; data[3] = 25 mag = Society(createAgent, data) capital = 100 capital = 50 capital = 25 mag = Society(createAgent, 50) Society function createAgent (capital) person = Agent { init = function (self), -- ... } end data = {} data[1] = 100; data[2] = 50; data[3] = 25 mag = Society(createAgent, data) capital = 100 capital = 50 mag = Society(createAgent, 50) capital = 25 Group CBB CAC CBA CCB ACA CCC AAC BBC AAA BBA ABC BAB Group 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 Traversing the Society capital = 100 capital = 50 capital = 25 forEachAgent(mag, function(agent) agent.capital = agent.capital + 100 end) capital = 200 capital = 150 capital = 125 Emergence “Can you grow it?” (Epstein; Axtell; 1996) source: (Bonabeau, 2002) Epstein (Generative Social Science) If you didn´t grow it, you didn´t explain its generation Agent-based model Generate a macrostructure Agents = properties of each agent + rules of interaction Target = macrostruture M that represents a plausible pattern in the real-world Scientific method Science proceeds by conjectures and refutations (Popper) Explanation and Generative Sufficiency Conjectures Agent model A1 Macrostructure ? Agent model A2 Agent model A3 Spatial segregation Bird flocking ? Refutation Explanation and Generative Sufficiency Agent model A1 Macrostructure ? Agent model A2 Occam´s razor: "entia non sunt multiplicanda praeter necessitatem", or "entities should not be multiplied beyond necessity". Explanation and Generative Sufficiency Agent model A1 Macrostructure ? Agent model A2 Popper´s view "We prefer simpler theories to more complex ones because their empirical content is greater and because they are better testable" Explanation and Generative Sufficiency Agent model A1 Macrostructure ? Agent model A2 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. Urban Growth in Latin American cities: exploring urban dynamics through agent-based simulation Joana Xavier Barros 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. Peripherization 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.. São Paulo - Brasil Caracas - Venezuela Urban growth “Urban sprawl” in United States “Urban sprawl”in Europe (UK) Peripherization in Latin America (Brazil) Research question How does this process happen in space and time? How space is shaped by individual decisions? Complexity approach Time + Space automata model Social issues agent‐based simulation) Model: Growth of Latin American cities Peripherisation module Spontaneous settlements module Inner city processes module Spatial constraints module 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 Peripherization module: rules 1. proportion of agents per group is defined as a parameter 2. high‐income agent –can locate anywhere 3. medium‐income agent –can locate anywhere except on high‐income places 4. 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 Peripherization module: rules 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 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 Processos intra-urbanos – exercícios de simulação Estudo comparativo entre dois padrões diferentes de desenvolvimento urbano: urban sprawl nas cidades dos EUA e Europa e o crescimento urbano das cidades latino-americanas. Objetivo de testar hipóteses e teorias sobre processos intra-urbanos de transformação urbana em áreas residenciais e verificar a aplicabilidade dessas teorias para cidades de diferentes culturas. Cidade latino-americana 10 40 50 d=3 steps = 2 steps2 = 4 1000 cells Cidade EUA e Europa steps3 = 2 decayStartPoint = 800 consolidationLimit = 600 2000 cells steps3 = 8 decayStartPoint = 400 consolidationLimit = 400 3000 cells 4000 cells 5000 cells 6000 cells 40 50 10 d=2 steps = 2 steps2 = 7 7000 cells Processos intra-urbanos – exercícios de simulação Processos de filtragem, decadência do centro, e movimento das elites em direção ao anel periférico são de natureza semelhante em ambas cidades. O padrão locacional espacial reverso parece ser causado por uma combinação de diferenças em grau em processos de natureza similar. As diferenças na composição das sociedades urbanas de cada país parece exercer um grande impacto no resultado desses processos no padrão espacial urbano de localização residencial. Módulo de Barreiras Espaciais Introduz barreiras espaciais ao modelo de simulação Barreiras espaciais corpos de água, áreas com altas declividades, or qualquer outra área onde a urbanização é impossível Implementação feita através da introdução de “áreas cinzas” como condição inicial. Agent’s rules: Agentes não se assentam ou caminham em sobre as áreas cinzas Para cada movimento que os agentes fazem em direção a uma nova célula, eles checam se a nova posição é uma célula cinza ou não, e caso seja, eles retornam as suas posições iniciais e modificam suas direções para evitar que retornem para a mesma célula. Exercícios com Barreiras Espaciais Objetivo: testar os impactos das barreiras espaciais nas tendências de desenvolvimento espacial mostradas pelo modelo nos experimentos anteriores, e verificar como essas tendências podem ser relacionadas com a realidade. ] Mostra como a simples introdução de áreas inatingíveis dentro da malha pode moldar o desenvolvimento espacial de maneiras tão diferentes. Exercícios com Módulo de Periferização posição inicial dos agentes no centro da malha posição inicial dos agentes na célula-semente Exercícios com Barreiras Espaciais Exercícios com Módulo de Processos Intra-urbanos posição inicial dos agentes no centro da malha posição inicial dos agentes na célula-semente importância das barreiras espaciais para que a simulação produza um padrão mais realístico. o papel das barreiras espaciais para o entendimento da morfologia urbana. Comparação com a realidade Mapas of distribuição de renda para Porto Alegre. (Censo 2000) Mapas A e B: quantile breaks (3 and 6 ranges) Mapas C e D: natural breaks (3 and 6 ranges) Não trabalhamos com definição de grupos de renda.