Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based...

43
History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University of California, Davis Computer, Computational, & Statistical Sciences Division Los Alamos National Laboratory Quantifying Social Fields, 2012 Williams, Agent-Based Modeling

Transcript of Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based...

Page 1: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based ModelingHistory and Applications

Sean Williams

Department of Computer ScienceUniversity of California, Davis

Computer, Computational, & Statistical Sciences DivisionLos Alamos National Laboratory

Quantifying Social Fields, 2012

Williams, Agent-Based Modeling

Page 2: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Outline

HistoryCellular AutomataCellular Automaton ApplicationsAgent-Based Models

ImplementationFour ConcernsInteractions

ResultsAgent-Based Computational Economics

Conclusion

Williams, Agent-Based Modeling

Page 3: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automata

Agents

“An agent is an entity whose state is viewed as consisting ofmental components such as beliefs, capabilities, choices, andcommitments. . . . [A]genthood is in the mind of theprogrammer: What makes any hardware or softwarecomponent an agent is precisely the fact that one has chosento analyze and control it in these mental terms.”

Shoham, Y. (1990). Agent-oriented programming. Artificial Intelligence. Williams, Agent-Based Modeling

Page 4: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automata

Early Computing Research

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 5: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automata

Definitions

von Neumann Neighborhood Moore Neighborhood

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 6: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automaton Applications

Wolfram’s One-Dimensional Automata

Rule 30Cryptographically Random

Rule 110Turing-Complete

Rule 90Sierpinski Automaton

Rule 184Basic Traffic Simulation

Wolfram, S. (2002). A New Kind of Science. Williams, Agent-Based Modeling

Page 7: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automaton Applications

Conway’s Game of Life

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 8: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automaton Applications

Schelling’s Model of Ethnic Segregation

Rules of the SimulationI Agents are divided into two groups: A and BI A space on the board can be unoccupied, or occupied by

an agent from either groupI An agent’s neighborhood uses Moore (8-way) adjacencyI An agent is content with its neighborhood if at least n% of

its neighbors are in the same groupI Resolve the simulation as follows:

I Choose a random agentI If it is not content, move it to the closest available space in

which it would be contentI Repeat until all agents are content

Schelling, T. C. (1971). Dynamic models of segregation. J. Math. Sociol. Williams, Agent-Based Modeling

Page 9: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Cellular Automaton Applications

Schelling’s Model of Ethnic Segregation

Initial Population Final Population

Schelling, T. C. (1971). Dynamic models of segregation. J. Math. Sociol. Williams, Agent-Based Modeling

Page 10: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

The SimCity Analogy

Williams, Agent-Based Modeling

Page 11: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

The SimCity Analogy

Williams, Agent-Based Modeling

Page 12: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

Why Agent-Based Modeling?

I RandomnessI HeterogeneityI Interactions

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 13: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

Why Agent-Based Modeling?

I Randomness

I HeterogeneityI Interactions

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 14: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

Why Agent-Based Modeling?

I RandomnessI Heterogeneity

I Interactions

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 15: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Models

Why Agent-Based Modeling?

I RandomnessI HeterogeneityI Interactions

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 16: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Main Elements of an Agent-Based Model

I AgentsI EnvironmentI Time-KeepingI Interactions

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 17: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Agents

I HeterogeneousI State-BasedI Contain InformationI Reproduction and DeathI Necessities of Life

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 18: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Environment

I Spatial RelationshipsI Travel RestrictionsI Interactions with Agents

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 19: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Time-Keeping

I Synchronous (“Time-Driven”)I Asynchronous (“Event-Driven”)

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 20: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Time-Keeping: Synchronous Time

Algorithm 1 Synchronous update schemeSet initial time.Set initial conditions for all agents and the environment.loop

for all agents in the model doInvoke update rule.

end forIncrement time to next time step.

end loop

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 21: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Four Concerns

Time-Keeping: Asynchronous Time

Algorithm 2 Asynchronous update schemeSet initial time.Set initial conditions for all agents and the environment.loop

Update time to that of the next event.Determine which agent(s) will be updated next and which

update rule will be applied.Apply the selected rule to the selected agent(s).Update the schedule.

end loop

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 22: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Artificial Intelligence

“If you stack bricks one atop the other, eventually you’ll reachthe moon.”

One of my graduate professors Williams, Agent-Based Modeling

Page 23: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Artificial Intelligence

I Knowledge and beliefI InferenceI Social modelsI Knowledge representationI GoalsI PlanningI LanguageI Emotions

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 24: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Production Systems

I RulesI Working memoryI Rules interpreter

I In other words, a lot of If/Else clauses

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 25: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Production Systems

I RulesI Working memoryI Rules interpreterI In other words, a lot of If/Else clauses

Gilbert, N. and Troitzsch, K. (1999). Simulation for the Social Scientist. Williams, Agent-Based Modeling

Page 26: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Example: Simple Model of MalariaRules of the Simulation

I Two types of agents: humans and mosquitosI Agents live in a rectangular environment of size L × LI Agents can be either infected or notI If a mosquito is infected, it infects all humans in radius bI If a mosquito is not infected, and there is an infected

human in radius b, the mosquito becomes infectedI Once infected, humans remain infected for Rh time steps,

while mosquitos remain infected for Rm time stepsI Each time step, each agent moves at most sh or sm

(humans and mosquitos, respectively) steps in a randomdirection

Barnes, D. and Chu, D. (2010). Introduction to Modeling for Biosciences. Williams, Agent-Based Modeling

Page 27: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

Other Techniques from Machine Learning

I Genetic AlgorithmsI Neural NetworksI Reinforcement Learning

Tesfatsion, L. (2003). Agent-Based Computational Economics. Williams, Agent-Based Modeling

Page 28: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

More Sophisticated Interactions

I Simplistic interaction models have given agent-basedmodeling a bad reputation

I Behavioral EconomicsI Behavioral Game TheoryI PsychologyI Philosophy of MindI Sociology

Williams, Agent-Based Modeling

Page 29: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

More Sophisticated Interactions

I Simplistic interaction models have given agent-basedmodeling a bad reputation

I Behavioral EconomicsI Behavioral Game TheoryI PsychologyI Philosophy of Mind

I Sociology

Williams, Agent-Based Modeling

Page 30: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Interactions

More Sophisticated Interactions

I Simplistic interaction models have given agent-basedmodeling a bad reputation

I Behavioral EconomicsI Behavioral Game TheoryI PsychologyI Philosophy of MindI Sociology

Williams, Agent-Based Modeling

Page 31: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Why Economics?

I Large-scale features emergentfrom microfoudnations

I Driven primarily by interactionsbetween market participants

I Extremely socially relevantI Feasible to model

I Video games, however, are not(currently) a real solution

Williams, Agent-Based Modeling

Page 32: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Why Economics?

I Large-scale features emergentfrom microfoudnations

I Driven primarily by interactionsbetween market participants

I Extremely socially relevantI Feasible to modelI Video games, however, are not

(currently) a real solution

Williams, Agent-Based Modeling

Page 33: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

LeBaron’s Model of Stock Price Volatility

Rules of the SimulationI Two types of securities:

I Risk-free bonds, in infinite supply, yielding 1% annually(compounded monthly)

I Risky stock, in limited supply, with a semi-random dividedhaving 2% annualized growth with 6% standard deviation

I Trading strategies are devised externally, and all agentscan select from the strategy pool

I Strategies are created using a feedforward neural networkI Each agent has a “memory length,” or, the length of time

over which they consider price history when evaluatingstrategies against historical data

LeBaron, B. (2001). Empirical regularities from interacting long and short horizon investors in an agent-based stock market. Williams, Agent-Based Modeling

Page 34: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

LeBaron’s Model of Stock Price VolatilityRules of the Simulation (continued)

I Periodically, the strategies are evolved using a geneticalgorithm, first by removing all strategies that were notused recently, then by randomly applying one of the threefollowing criteria:

I Change one weight (selected at random) in the strategyI Replace one weight (selected at random) in the strategy

with a new random valueI Combine two randomly-selected strategies into one new

strategyI Shares of the risky asset are traded by numerically

computing its expected equilibrium priceI Differences in memory length drive differences in strategy

choiceLeBaron, B. (2001). Empirical regularities from interacting long and short horizon investors in an agent-based stock market. Williams, Agent-Based Modeling

Page 35: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

LeBaron’s Model of Stock Price Volatility

All-Memory Long-Memory

LeBaron, B. (2001). Empirical regularities from interacting long and short horizon investors in an agent-based stock market. Williams, Agent-Based Modeling

Page 36: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate DemandRules of the Simulation

I Three agent types: households, firms, and onerepresentative commercial bank

I Real and monetary goods independentI Rules of the bank:

I Accepts deposits from householdsI Issues loans to firmsI If a firm defaults, it is issued a doubtful loan to cover its

previous loansI If a firm defaults on a doubtful loan, it goes into bankruptcy

and is removed from the simulationI Defaulted loans are absorbed by the bank’s capitalI If the bank cannot cover a default, it goes into bankruptcy

and the simulation ends

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 37: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate Demand

Rules of the Simulation (continued)

I Rules of firms:I Sets their quarterly production goals based on stocks left

from last quarterI Uses production goals to set an employment level, hiring or

firing as neededI If hiring, adjusts wages it posts to the labor market based

on its previous ability to fill posted positionsI Takes credit to cover payroll, if neededI Adjusts goods prices based on post-production inventoriesI Pays part of its profits as dividends

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 38: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate Demand

Rules of the Simulation (continued)

I Rules of households:I Has a reservation wage it would like to be paidI If unemployed, looks at a random set of job postings, and if

the highest posting is above its reservation wage, it takesthe job

I If unemployed for at least n months, cuts the reservationwage

I After being paid (if employed), saves some of its money inthe bank, and spends the rest on the goods market

I Households see a limited number of goods marketpostings, and buy the best deals

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 39: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate Demand

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 40: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate Demand

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 41: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Agent-Based Computational Economics

Seppecher: Wage Flexibility and Aggregate Demand

Seppecher, P. (2010). Flexibility of wages and macroeconomic instability in an agent-based computational model. . . Williams, Agent-Based Modeling

Page 42: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Conclusion

I Agent-based modeling has produced some promisingresults, with clear applications to the social sciences

I In particular, it is advantageous when a system containsrandomness, heterogeneity, and complex interactionsbetween agents

I A more comprehensive understanding of humandecision-making is likely needed to move the techniqueforward

Williams, Agent-Based Modeling

Page 43: Agent-Based Modeling - History and Applications...History Implementation Results Agent-Based Modeling History and Applications Sean Williams Department of Computer Science University

History Implementation Results

Questions

Williams, Agent-Based Modeling