An Introduc+on to Agent based Modeling and Simula+on

An
Introduc+on
to
Agent‐based
 Modeling
and
Simula+on
 Dr.
Emiliano
Casalicchio
 [email protected]
 Download
@
 www.emilianocasalicchio.eu
 ...
Author: Peter Ward
5 downloads 0 Views 2MB Size
An
Introduc+on
to
Agent‐based
 Modeling
and
Simula+on
 Dr.
Emiliano
Casalicchio
 [email protected]
 Download
@
 www.emilianocasalicchio.eu
 (talks
&
seminars
sec+on)


Outline
 •  Part
1:
Simula+on


–  Fundamentals
concepts


•  Part
2:
An
introduc+on
to
Agent‐based
Modeling
and
Simula+on
(ABMS)
 –  –  –  – 

Mo+va+on
 What
is
an
agent
 The
need
for
ABMS
 Why
and
when
ABMS


•  Part
3:


–  ABMS
applica0ons
 –  How
to
do
ABMS


•  Part
4:


–  Supply
chain
example,
electricity
market
 –  ABMS
in
Workflows
and
BP
re‐engineering
 –  ABMS
in
cri+cal
infrastructures
interdependencies
analysis


ABMS
Applica+ons
 •  Prac+cal
agent‐based
modeling
 and
simula+on
is
ac+vely
being
 applied
in
many
areas

 •  modeling
agent
behavior
in
the
 stock
market
(LeBaron
2002)
 and
supply
chains
(Fang
et
al.
 2002)
 •  predic+ng
the
spread
of
 epidemics
(Huang
et
al.
2004)
 and
the
threat
of
bio‐warfare
 (Carley
2006),

 •  modeling
the
growth
and
 decline
of
ancient
civiliza+ons
 (Kohler
et
a.
2005)
 •  modeling
the
complexi+es
of
 the
human
immune
system
 (Folcik
and
Orosz
2006),

 •  and
many
other
areas


ABMS
Applica+ons
 •  ABMS
applica+ons
range
from



–  small,
elegant,
minimalist
models,
to
 –  large‐scale
decision
support
systems.


•  Minimalist
models
are
based
on
a
set
of
idealized
 assump+ons,
designed
to
capture
only
the
most
salient
 features
of
a
system.



–  a
wide
range
of
assump+ons/parameters
can
be
varied
over
 a
large
number
of
simula+ons.


•  Decision
support
models
tend
to
be
large‐scale
 applica+ons,
designed
to
answer
a
broad
range
of
real‐ world
policy
ques+ons.

 –  includes
real
data
 –  has
passed
some
degree
of
valida0on
tes+ng
to
establish
 credibility
in
their
results.


How
to
do
ABMS
 At
a
general
level,
one
goes
about
building
an
agent‐based
 model
in
much
the
same
way
as
any
other
type
of
model
 1.  iden+fy
the
purpose
of
the
model,
the
ques+ons
the
model
is
 intended
to
answer
and
engage
the
poten+al
users
in
the
 process.

 2.  systema+cally
analyze
the
system
under
study,
iden0fying
 components
and
component
interac0ons,
relevant
data
 sources,
and
so
on.

 3.  apply
the
model
and
conduct
a
series
of
“what‐if”
 experiments
by
systema+cally
varying
parameters
and
 assump+ons.

 4.  understand
the
robustness
of
the
model
and
its
results
by
 using
sensi+vity
analysis
and
other
techniques.


How
to
do
ABMS:
agent
perspec+ve
vs
 process‐based
perspec+ve
 •  Agent‐based
modeling
brings
with
it
a
few
unique
aspects
 owing
to
the
fact
that
ABMS
takes
the
agent
perspec+ve,
 first
and
foremost,
in
contrast
to
the
process‐based
 perspec+ve
that
is
the
tradi+onal
hallmark
of
simula+on
 modeling.
 •  Prac+cal
ABMS
requires
one
to:



1.  iden+fy
the
agents
and
get
a
theory
of
agent
behavior,

 2.  iden+fy
the
agent
rela+onships
and
get
a
theory
of
agent
 interac+on,

 3.  get
the
requisite
agent‐related
data,

 4.  validate
the
agent
behavior
models
in
addi+on
to
the
model
 as
a
whole,
and

 5.  run
the
model
and
analyze
the
output
from
the
standpoint
of
 linking
the
micro‐scale
behaviors
of
the
agents
to
the
 macroscale
behaviors
of
the
system.


How
to
do
ABMS:
not
yet
mature
 formalisms
 •  ABM
does
not
as
of
yet
have
a
mature
set
of
standard
 formalisms
or
procedures
for
model
development
and
 agent
representa+on
such
as
those
that
are
part
of
Systems
 Dynamics
modeling.

 •  Other
than
the
implemented
so`ware
code,
there
is
no
 scheme
for
unambiguously
represen+ng
an
agent‐based
 model.

 •  However,
agent
modeling
documenta+on
schemes
along
 these
lines
have
recently
been
proposed
with
the
intent
of
 promo+ng
agent
model
transferability
and
reproducibility
 (Grimm
et
al.
2006).

 •  Agent‐based
modeling
can
benefit
from
the
use
of
the
 Unified
Modeling
Language
(UML)
for
represen+ng
models.


How
to
do
ABMS:
UML
based
visual
modeling
 •  UML
is
a
visual
modeling
 language
for
represen+ng
 object‐oriented
(O‐O)
systems
 that
is
commonly
adopted
to
 support
agent‐based
models
in
 both
the
design
and
 communica+on
phases.
 •  UML
consists
of
a
number
of
 high‐structured
types
of
 diagrams
and
graphical
 elements
that
are
assembled
 in
various
ways
to
represent
a
 model.

 •  The
UML
representa+on
is
at
a
 high
level
of
abstrac+on,
 independent
of
the
model’s
 implementa+on
in
the
 par+cular
O‐O
programming
 language
used.


How
to
do
ABMS:
O‐O
modeling
paradigm
 •  Most
large‐scale
agent‐based
modeling
toolkits
that
provide
basic
 agent
func+onality
are
based
on
the
object
oriented
paradigm.

 •  The
O‐O
modeling
paradigm
is
a
useful
basis
for
agent
modeling,
 since
an
agent
can
be
considered
a
self‐directed
object
with
the
 capability
to
autonomously
choose
ac+ons
based
on
the
agent’s
 situa+on.
 •  The
O‐O
paradigm
is
natural
for
agent
modeling,
with
its
use
of
 object
classes
as
agent
templates
and
object
methods
to
 represent
agent
behaviors.
O‐O
modeling
takes
a
data‐driven
 rather
than
a
process‐driven
perspec+ve.

 •  One
way
to
begin
the
modeling
process
is
to
define
abstract
data
 types
and
objects.


How
to
do
ABMS:
5
general
steps
 1.  Agents:
Iden-fy
the
agent
types
and
other
objects
(classes)
 along
with
their
aeributes.
 2.  Environment:
Define
the
environment
the
agents
will
live
in
 and
interact
with.
 3.  Agent
Methods:
Specify
the
methods
by
which
agent
 aeributes
are
updated
in
response
to
either
agent‐to‐ agent
interac+ons
or
agent
interac+ons
with
the
 environment.
 4.  Agent
Interac-ons:
Add
the
methods
that
control
which
 agents
interact,
when
they
interact,
and
how
they
interact
 during
the
simula+on.
 5.  Implementa-on:
Implement
the
agent
model
in
 computa+onal
so`ware.


How
to
do
ABMS:
discovering
agents
 •  Iden+fying
agents,
accurately
specifying
their
 behaviors,
and
appropriately
represen+ng
agent
 interac+ons
are
the
keys
to
developing
useful
agent
 models.



–  Agents
are
generally
the
decision‐makers
in
a
system.
 These
include
tradi+onal
decision‐makers,
such
as
 managers,
as
well
as
nontradi0onal
decision‐makers,
such
 as
complex
computer
systems
that
have
their
own
 behaviors.


•  One
needs
a
theory
of
agent
behavior.


–  norma+ve
model
in
which
agents
aeempt
to
op+mize
and
 use
this
model
as
a
star+ng
point
for
developing
a
simpler
 and
more
descrip+ve
heuris+c
model
of
behavior.

 –  behavioral
model
if
applicable
behavioral
theory
is
 available
(e.g.
consumer
shopping
behavior).


How
to
do
ABMS:
more…
 •  Discovery
agents


–  Iden+fying
agents,
accurately
specifying
their
behaviors,
and
 appropriately
represen+ng
agent
interac+ons
 –  Agents
are
generally
the
decision‐makers
in
a
system.



•  tradi+onal
decision‐makers,
such
as
managers
 •  nontradi+onal
decision‐makers,
such
as
complex
computer
systems
that
have
 their
own
behaviors


•  ABMS
life
cycle


–  Developing
an
agent‐based
simula+on
is
part
of
the
more
general
 model
so`ware
development
process.
 –  Desktop
ABMS
 –  Large‐scale
ABMS


•  ABMS
toolkit


–  Repast
(North
et
al.
2006),
Swarm
(SDG
2006;
Minar
et
al.
1996),
 NetLogo
(NetLogo
2006)
and
MASON
(GMU
2006)


Outline
 •  Part
1:
Simula+on


–  Fundamentals
concepts


•  Part
2:
An
introduc+on
to
Agent‐based
Modeling
and
Simula+on
 (ABMS)
 –  –  –  – 

Mo+va+on
 What
is
an
agent
 The
need
for
ABMS
 Why
and
when
ABMS


•  Part
3:


–  ABMS
applica+ons
 –  How
to
do
ABMS


•  Part
4:


–  Supply
chain
example,
electricity
market
 –  ABMS
in
Workflows
and
BP
re‐engineering
 –  ABMS
in
cri0cal
infrastructures
interdependencies
analysis


The
Supply
Chain
Example
 •  A
supply
chain
consists
of
five
stages:
 –  –  –  – 

factories,

 distributors
(supplier),

 wholesalers,

 and
retailers



who
respond
to
customers’
demand.
 •  Mul+ple
agents
of
each
type
exist
at
 each
stage
forming
a
network
of
supply
 chain
agents
 •  Agents
only
have
access
to
local
 informa+on
 –  No
agent
has
a
global
view
of
the
supply
 chain
or
is
in
a
posi+on
to
op+mize
the
 system
as
a
whole
 –  Agents
adopt
decision
rules
that
only
 consider
this
local
informa+on
in
making
 their
decisions.


Assump+ons
 •  Various
simplifying
assump+ons
 for
this
example
 distributors
are
not
considered
 there
is
only
one
commodity,
 no
transforma+on
of
goods
is
made
 no
assembly
of
materials
into
 products
is
required
 –  Are
not
included
the
flows
of
 payments
and
the
complexi+es
of
 pricing,
nego+a+on,
and
financial
 accoun+ng
that
this
would
entail

 –  –  –  – 

•  Are
included
the
flows
of
goods
 and
informa+on
in
the
form
of
 orders
between
stages
(agents)
as
 well
as
physical
shipments


Agents
behavior
 •  Customer
 •  Retailer
 •  Wholesaler


Customer
agents
behavior
 1.  The
customer
places
an
order
with
the
retailer.


Agent
behavior
(cont)
 1.  The
retailer
fills
the
order
immediately
from
its
respec+ve
 inventory
if
it
has
enough
inventory
in
stock

 a. 

if
the
retailer
runs
out
of
stock,
the
customer’s
order
is
placed
on
backorder
 and
filled
when
stock
is
replenished


2.  The
retailer
receives
a
shipment
from
 the
upstream
wholesaler
in
response
 to
previous
orders.
 a. 

b.  c. 

The
retailer
then
decides
how
much
to
 order
from
the
wholesaler
based
on
an
 “ordering
rule.”
The
ordering
decision
is
 based
in
part
on
how
much
the
retailer
 expects
customer
demand
will
be
in
the
 future.

 The
retailer
es+mates
future
customer
 demand
using
a
“demand
forecas+ng”
 rule.

 The
retailer
then
orders
items
from
the
 wholesaler
to
cover
expected
demand
 and
any
shortages
rela+ve
to
explicit
 inventory
or
pipeline
goals.


Wholesaler
agent
behavior
 4.  each
Wholesaler
receives
a
shipment
from
the
upstream
 distributor,
forecasts
future
demand
by
the
downstream
 retailer,
and
places
an
order
with
the
distributor.
This
 process
con+nues
up
the
chain
to
the
factory
who
decides
 on
how
much
to
put
into
new
produc+on.


Agent’s
goals
 •  The
goal
of
the
supply
chain
agent,
other
than
customers,
is
 to
manage
their
inventory
in
such
a
way
as
to
minimize
 their
costs
through
judicious
decisions
based
on
how
much
 to
order
each
period.

 –  When
inventories
are
too
low
and
there
is
a
danger
of
running
 out
of
stock,
agents
order
more;

 –  when
inventories
are
too
large
and
agents
incur
high
inventory
 holding
costs,
agents
order
less.
Besides
the
inventory
holding
 charge,
agents
incur
a
backorder
charge
when
they
receive
an
 order
and
cannot
immediately
fill
it
because
they
are
out
of
 stock.

 –  Each
agent
strikes
a
delicate
balance
between
having
too
much
 inventory,
which
runs
up
inventory
holding
costs,
and
too
liOle
 inventory,
which
puts
the
agent
at
a
greater
risk
of
running
out
 of
stock
and
incurring
excessive
backorder
charges.


Building
the
supply
chain
agent
model:
step
1
 •  One
begins
developing
an
ABS
model
by
iden+fying
the
agent
 types
and
other
objects
(classes)
along
with
their
aeributes
 •  Each
agent
class
is
represented
by
a
set
of
aeributes
and
 methods
that
operate
on
the
agent
class.


Building
the
supply
chain
agent
model:
Step
2
 •  Determine
the
environment
in
which
the
agents
live
 and
interact
.

 •  the
environment
consists
of
external
(non‐agent)
 factors
that
influence
agent
behavior.
For
example
 –  variable
could
be
the
labor
rate
and
its
dependence
on
 geographic
locale,
which
could
also
be
included
as
an
 agent
aeribute.


Building
the
supply
chain
agent
model:
Step
3
 •  Specifies
the
methods
by
which
 agent
aeributes
are
updated
 during
the
simula+on
in
response
 to

 –  agent‐to‐agent
interac+ons
or

 –  agent
interac+ons
with
the
 environment



Step
3
(cont)
 •  In
the
supply
chain
model,
the
inventory
 level
is
an
aeribute
of
each
agent.

 –  Inventory
is
updated
when
orders
and
 shipments
are
received
and
sent.



•  Agent
methods
that
embody
processing
of
 orders
and
shipments
include:

 –  arriveOrder(),
sendOrder(),
 arriveShipment(),
and
sendShipment().

 –  These
methods
would
be
applied
to
the
 agents
upon
receipt
of
an
order
or
 shipment
and
affect
the
values
of
agent
 aeributes.


•  Methods
that
more
directly
embody
the
 agent’s
behavioral
decision
rules


–  a
rule
for
determining
how
much
to
order
 and
from
whom
at
any
point
in
+me,
 embodied
in
the
procedure
orderRule(),
 –  a
rule
for
forecas+ng
demand,
embodied
 in
the
procedure
forecastRule()


Building
the
supply
chain
agent
model:
Step
4
 •  Adds
the
methods
that
control

 –  which
agents
interact,

 –  when
they
interact,
and

 –  how
they
interact


•  For
example,
one
may
develop
a
 procedure
for
selec+ng



–  which
agents
to
interact
with
based
on
a
 bidding
process
in
which,
for
example,
 the
least‐costly
factory
agent
is
selected
 from
among
all
factory
agents
by
a
 distribu+on
agent
placing
an
order.

 –  The
agent
selec-on
procedure
could
be
 invoked
at
every
+me
period
or
when
 inventory
levels
reach
specified
 thresholds.

 –  The
agent
interac(on
procedure
would
 consist
of
placing
an
order
with
the
 selected
agent
at
the
determined
+me.


Step
4
(cont)
 •  In
addi+on
to
agents,
the
supply
chain
 model
consists
of
agent
rela+ons.
 •  If
agents
are
the
nodes
in
the
supply
 chain,
agent
rela+ons
are
the
links
or
 edges
in
the
network.
 •  Each
agent
rela+on
involves
two
agents.

 –  the
factory‐distributor
rela+on
includes
 the
aeributes
of
the
number
of
items
in‐ transit
from
factory
to
distributor
and
 the
order
in‐transit
from
distributor
to
 factory.


•  Agent
rela+ons
also
have
methods
that
 operate
on
them
just
as
agents
have
 –  getShipments(),
getOrders(),
 getUpstreamAgent(),
and
 getDownstreamAgent()


are
useful
methods
for
agent
rela+ons.


Building
the
supply
chain
agent
model:
Step
5
 •  Implementa+on
 –  wri+ng
an
object‐oriented
program
using,
for
 example,
the
Java
or
C++
programming
languages
 –  using
a
higher‐level
agent‐based
toolkit


EMCAS:
Electricity
Market
Complex
 Adap+ve
System
 •  It
is
a
large‐scale
agent
based
simula+on
model
of
 the
electric
power
market
designed

 –  to
inves+gate
market
restructuring
and
deregula+on.
 –  to
understand
the
implica+ons
of
the
coming
compe++ve
 market
in
Illinois
on
electricity
prices,
availability,
and
 reliability



•  It
is
an
example
of
an
agent‐based
model
that
has
 been
successfully
applied
to
a
real‐world
policy
issue
 and
provided
informa+on
that
would
otherwise
have
 not
been
available
using
any
other
modeling
 approach.


EMCAS
Agents
 •  The
agents
in
EMCAS
represent
the
par+cipants
in
the
 restructured
electricity
market
 •  Different
types
of
agents
capture
the
heterogeneity
of
 restructured
markets,
including

 –  –  –  –  –  – 

genera+on
companies,

 demand
companies,

 transmission
companies,

 distribu+on
companies,

 independent
system
operators,

 consumers.


•  The
agents
perform
diverse
tasks
using
specialized
decision
 rules.


EMCAS
agents


The
power
grid
model
 •  The
electric
power
grid
is
not
considered
an
agent
because
PURELY
 PASSIVE
with
no
individual
ac+vity
or
memory
 –  Transfer
electric
power
between
the
various
agents
and
passive
components
 within
the
system
 –  The
grid
provide
an
high
power
backbone

 –  The
grid
configura+on
match
the
real
physical
grid
being
studied
(data
from
 na+onal
published
state
sources)
 –  The
power
grid
has
several
thousand
components
(power
lines,
transformers,
 etc…)
 –  The
physical
components
are
grouped
into
electrical
buses
(or
tap
point)
 –  Each
tap
point
has
its
own
hourly
unique
electricity
price


EMCAS
Agents
 •  genera+on
companies,
are
 modeled
as
adap+ve
agents
 –  project
poten+al
future
market
 prices
 –  to
develop
bidding
porpolio


•  transmission
companies,
deliver
 power
from
supplier
to
retailer
 –  They
want
to
maximize
their
profits


•  distribu+on
companies,
are
 electric
power
retailer
 –  They
want
to
maximize
their
profits


•  demand
companies
 •  independent
system
operators,

 •  consumers.


Genera+on
Companies
agents

 •  Own
and
operate
individual
porpolios
of
generators

 •  Produce
power
that
is
sold
to
distribu+on
companies
 •  Are
modeled
as
adap+ve
agents.
Adap+ve
features
include


–  The
use
of
complex
sta+s+cs:
to
project
poten+al
future
market
prices;
 to
es+mate
the
future
prices
at
each
of
the
electricity
tap
points
where
 a
company
can
buy
or
sell
power
 –  The
use
of
heuris+cs
to
develop
bidding
porpolio:
to
determine
the
 price
for
their
individual
genera+on
bids;
to
determine
the
their
 individual
cost
of
produc+on


•  There
are
six
power
genera+on
markets


–  Privately
nego+ated
bilateral
power
market
 –  Publicly
cleared
spot
market
 –  Four
publicly
cleared
backup
service
markets


•  The
markets
differs
by


–  Time
availability
 –  Trade
op+ons
and
futures


•  The
want
to
maximize
their
profits


Transmission
Company
agents
 •  Deliver
power
from
supplier
to
 retailer
 •  Are
paid
in
different
way
 –  Fixed
fee
(per
unit
of
shipped
power)
 determined
by
government
regulatory
 body
 –  Open
or
sealed
transmission
service
 bidding
 –  Hourly
value
for
each
transmission
 line
base
on
the
price
arbitrage
 difference
between
power
grid
taps.


•  They
work
in
the
power
genera+on
 markets
 –  Privately
nego+ated
bilateral
power
 market,
Publicly
cleared
spot
market,
 publicly
cleared
backup
service
 markets


•  The
want
to
maximize
their
profits


Distribu+on
Company
agents
 •  Are
electric
power
retailer
 •  Buy
wholesale
power
from
 genera+on
companies
and
from
 intermediate
brokers
 •  Are
paid
by
customers
or
other
 distribu+on
companies
 •  They
work
in
the
power
genera+on
 markets
 –  Privately
nego+ated
bilateral
power
 market,
Publicly
cleared
spot
market,
 publicly
cleared
backup
service
markets


•  The
want
to
maximize
their
profits


Independent
System
Operator
agents
 •  Are
high
regulated
private
firm
 or
government
agencies
 –  
Acts
as
a
clearing
house
for
 pooled
bidding
 –  Are
charged
with
maintaining
the
 overall
stability
of
the
power
grid
 –  Handle
pool
market
payment
 clearing


•  Charge
distribu+on
companies

 –  for
the
opera+ons
fees
needed
to
 buy
reserve
power

 –  any
cost
necessary
to
exercise
 the
op+ons
in
+mes
of
crisis.


ABMS
in
cri+cal
infrastructures
analysis

 •  Cri+cal
Infrastructures
are
Complex
Adap+ve
 Systems
 •  Two
approaches
 –  micro
model:
each
system
component
is
 represented
by
an
agent
 –  macro
model:
each
infrastructure
or
sub
system
is
 represented
by
an
agent


Project


Technology


Goals


Limita0ons


CIMS®


Agent‐based,
graph
 based,
Federated
 Simula+on.
 GA/DSS


‐ 
High
portable
and
visual
tools
for
displaying
 interdependencies
weaknesses
and
vulnerabili+es
 ‐ 
High
level
modeling
and
simula+on
for
on‐the‐fly
 model
building
and
+mely
70%
solu+ons

 ‐
mission
assurance;
Mission
assurance
includes
the
 analysis
of
risk
and
impact
that
events
place
upon
 such
capabili+es


N.A.


Ac+vitySim
 Agent‐based,
parallel
 Daily
ac+vi+es
modeling
and
simula+on
to
understand
 Model
Re‐ simula+on
 infrastructure
networks
demand
profile

 engineering
 CISIA


popula+on
of
 nonlinear
mutually
 dependent
systems


High
level
modeling
and
simula+on
(macro‐ components)


Flexibility


Federated
 ABMS


Agent‐based/HLA
 based
federated
 simula+on


Probabilis+c
Interdependencies
analysis


Flexibility


SimCIP



Federated
 Simula+on/ propetary
 middleware




‐
Integrated
environment
for
interdependencies
 analysis
 ‐
High
level
and
detailed
simula+on
models


N.A.


Bibliography
 •  Charles
M.
Macal,
Michael
J.
North,
TUTORIAL
ON
AGENT‐BASED
 MODELING
AND
SIMULATION,
Proceedings
of
the
2006
Winter
Simula-on
 Conference
 •  Charles
M.
Macal,
Michael
J.
North,
TUTORIAL
ON
AGENT‐BASED
 MODELING
AND
SIMULATION
PART
2:
HOW
TO
MODEL
WITH
AGENTS,
 Proceedings
of
the
2006
Winter
Simula-on
Conference
 •  Charles
M.
Macal,
Michael
J.
North,
Managing
Business
Complexity:
 discovery
strategic
solu0on
with
agent‐based
modeling
and
simula0on,
 Oxford
University
Press,
2007


Suggest Documents