You are on page 1of 37

System Dynamics and

Applied Agent Based


Modeling
by Andrei Borshchev

Workshop
“Agent Based Modeling:
Why Bother?”
International System
Dynamics Conference
Boston, July 2005

© 2002-2005 XJ Technologies www.xjtek.com


Warning!

There
There are
are tons
tons of
of literature
literature on
on
agent
agent based
based modeling.
modeling. MostMost of
of itit
is
is about
about toy
toy worlds
worlds like
like shown
shown
here:
here: fascinating
fascinating toto watch
watch –– but
but
not
not really
really practically
practically useful.
useful.

© 2002-2005 XJ Technologies www.xjtek.com 2


Modeling from different perspectives
System Dynamics Perspective Discrete Event Perspective
Key aggregate variables, Processes: sequence of
Global feedbacks operations, resources

THE
SYSTEM

Individual parameters
and state variables,
Personal decisions

Agent Based Perspective

© 2002-2005 XJ Technologies www.xjtek.com 3


From SD to AB: model of diffusion

Potential
SD AB
Adopters
Adopters

Let us consider how an AB


model of product (or innovation)
diffusion can be built on the
basis of an SD model

© 2002-2005 XJ Technologies www.xjtek.com 4


First step: disaggregate

Potential
SD AB
Adopters
Adopters

Imagine
Imagine stocks
stocks areare not
not
tanks
tanks with
with liquid
liquid but
but boxes
boxes
with
with discrete
discrete items
items

© 2002-2005 XJ Technologies www.xjtek.com 5


Think in terms of States…

Potential
SD AB Potential
Adopters
Adopters Adopter

Now
Now look
look at
at the
the dynamics
dynamics from
from Adopter
an
an individual
individual item
item viewpoint
viewpoint ––
you
you will
will distinguish
distinguish between
between the
the
two
two states
states

© 2002-2005 XJ Technologies www.xjtek.com 6


…and transitions

Potential
Adoption
Rate SD AB Potential
Adopters
Adopters Adopter

Advertizing
B
+ exponential
Effectiveness
Adoption
+ from Adopter
Advertising Adoption
Adoption from
from AdAd is
is aa
+
transition
transition happening
happening withwith
Advertising
Effectiveness aa (stochastic)
(stochastic) timeout
timeout

© 2002-2005 XJ Technologies www.xjtek.com 7


Use direct interaction between agents

Potential
Adoption
Rate SD AB Potential
Adopters
Adopters Adopter

Total Advertizing
B
+ + exponential “Buy it!”
R Population Effectiveness
+
Adoption Adoption
+ from from Word Adopter
-
Advertising B of Mouth Adoption
+
+ + Fraction
+
Advertising Contact exponential( Contact Rate * Adoption Fraction )
Effectiveness Rate
<random agent>.”Buy it!”

Adoption
Adoption from
from WOM
WOM is is
a)
a) agents
agents telling
telling other
other agents
agents “Buy
“Buy it!”
it!”
b)
b) Other
Other agents
agents reacting
reacting to
to this
this by
by
taking
taking aa transition
transition

© 2002-2005 XJ Technologies www.xjtek.com 8


Simulation results: few agents

Potential
Adoption
Rate SD AB Potential
Adopters
Adopters Adopter

Total Advertizing
B
+ + exponential “Buy it!”
R Population Effectiveness
+
Adoption Adoption
+ from from Word Adopter
-
Advertising B of Mouth Adoption
+
+ + Fraction
+
Advertising Contact exponential( Contact Rate * Adoption Fraction )
Effectiveness Rate
<random agent>.”Buy it!”

Potential Adopters Potential Adopters


Adopters Adopters

100 agents

© 2002-2005 XJ Technologies www.xjtek.com 9


Simulation results: more agents

Potential
Adoption
Rate SD AB Potential
Adopters
Adopters Adopter

Total Advertizing
B
+ + exponential “Buy it!”
R Population Effectiveness
+
Adoption Adoption
+ from from Word Adopter
-
Advertising B of Mouth Adoption
+
+ + Fraction
+
Advertising Contact exponential( Contact Rate * Adoption Fraction )
Effectiveness Rate
<random agent>.”Buy it!”

Potential Adopters Potential Adopters


Adopters Adoters

10,000 agents

© 2002-2005 XJ Technologies www.xjtek.com 10


Capturing more with AB model
What
What ifif WOM
WOM effect
effect of
of aa
person
person depends
depends on on how
how
Person recent
recent isis aa purchase
purchase
(adoption)?
(adoption)?

Potential
Adopter
Advertizing
exponential
Effectiveness “Buy it!”

Adopter

exponential( Contact Rate * Adoption Fraction )


<random agent>.”Buy it!”

© 2002-2005 XJ Technologies www.xjtek.com 11


We can store individual information
No
No problem!
problem! WeWe can
can
remember
remember thethe time
time of of
Person purchase
purchase inin an
an agent’s
agent’s
variable
variable and
and let
let WOM
WOM
effect
effect depend
depend on on it!
it!
Time Purchased

Potential
Adopter
Advertizing
exponential
Effectiveness “Buy it!”

Time Purchased = Now Time Purchased = Now

Adopter

exponential( Contact Rate * Adoption Fraction( Now – Time Purchased ) )


<random agent>.”Buy it!”

© 2002-2005 XJ Technologies www.xjtek.com 12



Same
Same for
for Age
Age –– just
just
remember
remember the
the birth
birth date
date
Person
Birth date

Time Purchased

Potential
Adopter
Advertizing
exponential
Effectiveness “Buy it!”

Time Purchased = Now Time Purchased = Now

Adopter

exponential( Contact Rate * Adoption Fraction( Now – Time Purchased ) )


<random agent>.”Buy it!”

© 2002-2005 XJ Technologies www.xjtek.com 13


We can maintain social networks
People
People only
only have
have aa limited
limited
number
number of
of contacts?
contacts? We We
Person can
can model
model any
any kind
kind ofof
Birth date social
social network!
network!
Time Purchased

Potential
Adopter
Advertizing
exponential
Effectiveness “Buy it!”

Time Purchased = Now Time Purchased = Now

Adopter

exponential( Contact Rate * Adoption Fraction( Now – Time Purchased ) )


<one of my contacts>.”Buy it!”

Parents MyContacts Children

© 2002-2005 XJ Technologies www.xjtek.com 14


We can model co-behaviors!
Need
Need to
to model
model the
the
(changing)
(changing) level
level of
of
Person education?
education? Include
Include another
another
Education
Birth date statechart
statechart concurrent
concurrent toto the
the
agent
agent purchase
purchase behavior!
behavior!
Time Purchased

Potential None
Adopter
Advertizing
exponential
Effectiveness “Buy it!”
Elementary
Time Purchased = Now Time Purchased = Now

Adopter
HighSchool

exponential( Contact Rate * Adoption Fraction( Now – Time Purchased ) )


<one of my contacts>.”Buy it!”
Graduate

Parents MyContacts Children

© 2002-2005 XJ Technologies www.xjtek.com 15


Can you do that in SD? You can try…
Consider
Consider aa population…
population…

© 2002-2005 XJ Technologies www.xjtek.com 16


... + Gender

© 2002-2005 XJ Technologies www.xjtek.com 17


... + Age

© 2002-2005 XJ Technologies www.xjtek.com 18


… + Education
Note
Note that
that some
some of
of the
the
buckets
buckets are
are empty
empty by
by
definition…
definition…

© 2002-2005 XJ Technologies www.xjtek.com 19


… + Wealth
Poor

Rich

© 2002-2005 XJ Technologies www.xjtek.com 20


… + Has used our services within N months
Imagine
Imagine we we are
are interested
interested
in
in selling
selling aa certain
certain kind
kind of
of
services…
services…

© 2002-2005 XJ Technologies www.xjtek.com 21


… + ???

© 2002-2005 XJ Technologies www.xjtek.com 22


… and finally:

• You may end up having more buckets in the


stock than there are people in the
region/city/country/world
• In this case agent based model will not only be
more compact and adequate, it will be even
computationally efficient

© 2002-2005 XJ Technologies www.xjtek.com 23


Is AB a replacement for SD?
• No! There is a huge class of problems best modeled with SD
• But: there are problems best addressed with AB
• And: in many cases combined, multi-approach modeling is
the answer:
… System Dynamics Sub-Models inside
discretely communicating Agents
… Application example: Supply Chain.

Agents live in an Environment modeled in


System Dynamics way
Application example: City Population
© 2002-2005 XJ Technologies www.xjtek.com 24
Traditional tools: support one paradigm

SD DE AB DS

VenSim Arena [Academic MATLAB


PowerSim Extend software:] VisSim
iThink SimProcess Swarm LabView
ModelMaker AutoMod RePast Easy 5
PROMODEL AgentSheets …
Enterprise ASCAPE
Dynamics SeSam
FlexSim NetLogo
eMPlant …

© 2002-2005 XJ Technologies www.xjtek.com 25


The challenge

• The increasing demand for global business


optimization have caused leading modelers to
look at AB and combined approaches to get
deeper insight into complex interdependent
processes having very different natures

Therefore

• There is a request for platforms that would allow


for integration and efficient cooperation between
different modeling paradigms

© 2002-2005 XJ Technologies www.xjtek.com 26


AnyLogic

SD DE AB

AnyLogic – Multi-Paradigm Simulation Tool

• You can easily vary and adjust the level of


abstraction
• You can switch from one approach to another
• You can mix approaches
• All that on one solid object-oriented platform

© 2002-2005 XJ Technologies www.xjtek.com 27


AnyLogic example models
High Abstraction Aggregates, global feedback dynamics, …
Less Details
Macro Level Urban Dynamics
Strategic Level
Competition in Paper Pulp Market

Alcohol Use Dynamics


Middle Abstraction
Average Details
Meso Level Adaptive Supply Chain
Tactical Level
Emergency Department

Subway station
Low Abstraction
More Details Pendulum – A Dynamic System
Micro Level
Operational Level Individual objects, exact sizes, distances, velocities, timings, …

© 2002-2005 XJ Technologies www.xjtek.com 28


Lowest abstraction level: dynamic system
Design time view: differential equations
Run time view: charts and animation

© 2002-2005 XJ Technologies www.xjtek.com 29


Pedestrian dynamics: Subway station

Design time view:


chart defining pedestrian flows

Run time view:


interactive pedestrian simulation

© 2002-2005 XJ Technologies www.xjtek.com 30


Discrete event: Emergency department

Design time view: layout markup Run time view: process animation
Design time view: process flowchart and statistics

© 2002-2005 XJ Technologies www.xjtek.com 31


SD+AB: Supply chain

SD model of production process

Design time view (Producer)

Discrete model of communication


with suppliers and customers

Run time view: ordering pattern

© 2002-2005 XJ Technologies www.xjtek.com 32


Agent based: Alcohol use dynamics

Design time view:


statechart defining individual person behavior

Run time view: control and intervened group


dynamics and financial outcome

© 2002-2005 XJ Technologies www.xjtek.com 33


Agent based: Competition in global market
Design time view:
company strategy function

Run time view: geo based competition


visualization

© 2002-2005 XJ Technologies www.xjtek.com 34


System dynamics: Urban dynamics
Design time view:
hierarchical OO
stock and flow diagram

Run time view:


“Flight simulator”

© 2002-2005 XJ Technologies www.xjtek.com 35


Summary

• Choosing modeling approach and the level of


abstraction adequate to the goals of the
modeling project is a key to success
• Using a flexible, multi-paradigm platform
AnyLogic multiplies your capabilities and saves
significant amount of model development efforts

© 2002-2005 XJ Technologies www.xjtek.com 36


Thank you!

• Questions?

© 2002-2005 XJ Technologies www.xjtek.com 37

You might also like