Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/319556799

Foundations of Simulation Modeling

Chapter · January 2011


DOI: 10.1002/9780470400531.eorms0336

CITATIONS READS

6 7,283

2 authors, including:

Victor W. K. Chan
Tsinghua University
152 PUBLICATIONS 1,318 CITATIONS

SEE PROFILE

All content following this page was uploaded by Victor W. K. Chan on 28 September 2019.

The user has requested enhancement of the downloaded file.


FOUNDATIONS OF SIMULATION underestimated. Presentation is about how
MODELING to effectively collect and present simulation
results and how to communicate with rele-
WAI KIN vant people to improve, verify, and validate
VICTOR CHAN (or accredit) the model and results. None of
Department of Industrial and Systems the three steps should be omitted in a profes-
Engineering, Rensselaer Polytechnic sional simulation study.
Institute, Troy, New York This introductory article focuses on the
first step—modeling. In particular, it deals
Simulation modeling is an important step with computer-based simulation modeling.
of a simulation study. It concerns with the A computer-based simulation model has
creation of an efficient simulation model as the advantages of being low cost, fast, and
accurate as needed to mimic the behavior repeatable. Beginners sometimes find mode-
of the underlying system and to reproduce ling a time consuming task. This is perhaps
useful observations for subsequent analysis. due to unfamiliarity with either the mod-
This introductory article discusses three eling approach or the software package (or
main simulation modeling methods: discrete- both). This article addresses the former by
event simulation, continuous simulation, introducing different simulation modeling
and agent-based simulation. In particular, approaches. References for using software
three discrete-event simulation modeling packages are provided in subsequent discus-
paradigms are introduced: event scheduling, sion. One mistake that beginners often make
process interaction, and activity scanning. is the inclination of including as many details
Several modeling issues are exemplified by a as possible into their simulation models. It
simple single-server queuing system and a should be noted that a simulation model is
slightly more complex multiple-server finite created to satisfy the need of a simulation
capacity queuing system with impatient study, rather than to duplicate the real sys-
customers. Continuous simulation is briefly tem exactly. Therefore, the objective of the
discussed to draw the differences between study matters in simulation modeling.
discrete-event and continuous simulations. The modeling power of a simulation mod-
Simulating emergent behavior as a common eling approach and the functionalities of the
purpose of agent-based simulation is demon- underlying simulation package should also
strated by a classic game of life model and be evaluated separately. It is possible that
a variation model. Monte-Carlo simulation a less convenient modeling approach imple-
and other simulation modeling formalisms mented by a powerful software platform
are briefly highlighted. receives more attention than a more flexible
and scalable modeling approach that was
executed in a lower-level, less user-friendly
INTRODUCTION programming language. This article does
not review the usage, user interface, and
Basically, a simulation study involves three functionalities of simulation packages.
steps: modeling, analysis, and presentation. Depending on the state of a system and the
These three steps can be repeated until satis- need of a simulation study, the corresponding
faction. Modeling is about the creation of an simulation model can be discrete, continu-
efficient simulation model. Analysis here in a ous, or hybrid. Strictly speaking, a simulation
broad sense includes studies of inputs to and model is discrete (continuous) if all its state
outputs from the simulation model, design of variables are discrete (continuous). A model
experiments, and optimization. The impor- with both discrete and continuous state vari-
tance of the presentation step is sometimes ables is a hybrid simulation model. There are

Wiley Encyclopedia of Operations Research and Management Science, edited by James J. Cochran
Copyright © 2010 John Wiley & Sons, Inc.
1
2 FOUNDATIONS OF SIMULATION MODELING

also several other ways of classifying simula- allows modelers to focus on the events, their
tion models including, static versus dynamic, relationships, and durations. To put it in a
deterministic versus stochastic, analytic ver- simple way, creating a discrete-event sim-
sus numeric, and physical versus computer- ulation model is to identify these elements
based. For example, a simulation model is and put them together in a correct manner.
dynamic if time (simulation clock) is present This will be demonstrated by examples in the
and static otherwise. Monte-Carlo simula- following.
tion is one type of static simulation models. Several concepts in discrete-event simu-
Discrete-event and continuous simulations lation modeling are of importance:
are usually dynamic simulation models [1]. randomness, dynamics (time evolutions),
Besides discrete, continuous, and Monte- future-event list (or pending events list or
Carlo simulations, a relatively new simulat- event calendar), and resident and transient
ion paradigm—agent-based simulation—has entities.
received increasing attention in various Randomness is the uncertainty in the
fields over the past two decades. Basically, occurrences of events and durations. Time
agent-based simulation, being a bottom-up evolutions are the footprints of the system
approach, is capable of modeling systems state with respect to time (both occurred
with intelligent, heterogeneous, and auto- events and their times). Randomness and
nomous entities. An agent-based simulation time evolutions together differentiate a disc-
model can be discrete, continuous, or both rete-event simulation model from a standard
depending on the type of its state variables. computer program that is deterministic
One of the main purposes of agent-based and static (i.e., no time involved). Almost
simulation is to simulate know or unknown all simulation packages provide simple
macroscopic behavior emerging from micro- mechanisms to implement randomness
scopic interactions. (i.e., by specifying distributions for event
The rest of the article is organized as durations and relationships) and handle
follows. The section titled ‘‘Discrete-Event time evolutions (i.e., by providing access to
Simulation Models’’ discusses three discrete- the current and future simulated times).
event simulation modeling approaches. The A future-event list keeps track of the
section titled ‘‘Continuous Simulation Mod- events scheduled to occur in the simulated
els’’ outlines continuous simulation models. future. This list is updated whenever a new
The section titled ‘‘Agent-Based Models’’ event is scheduled to occur in the simulated
highlights several key concepts in agent- future. This list is automatically generated
based simulation. The section titled ‘‘Monte- and updated in most simulation packages.
Carlo Models’’ briefly introduces Monte- Users sometimes can also access and modify
Carlo simulation. The final section offers a this list.
conclusion. Resident entities are objects that reside in
the model for a long period of time compared
to the simulation run length, for example, a
DISCRETE-EVENT SIMULATION MODELS facility, a server, or a queue. Transient enti-
ties on the other hand appear in the model
One special property of a discrete-event sys- for a short period of time, for example, a job,
tem is that its state changes only at dis- a customer, or a message. The population
crete instants of time. These instants of time of resident entities is usually much smaller
represent the occurrences of certain events than that of transient entities. In a typical
that change the state of the system and are queuing model, the number of servers is usu-
referred to event occurrence times (or sim- ally less than a hundred while the number
ply, event times). The system state remains of jobs/customers can be tens of thousands
constant in between event times because or millions. The large population of transient
during which no events occur. This special entities poses a computational burden if each
property facilitates the modeling and anal- of them is stored in memory and requires
ysis of discrete-event simulation because it a certain amount of computation. A more
FOUNDATIONS OF SIMULATION MODELING 3

efficient modeling approach is to keep track in the simulation results. This is demon-
of the aggregated information of the tran- strated in the following example.
sient entities, such as the total number of A discrete-event simulation model can be
jobs in queue or the total waiting time of created using different world views, which
jobs in the system, rather than the indi- were first discussed in Kiviat [4] and Lack-
vidual information, such as the individual ner [5]. Three popular world views: event
waiting time of each job. Because this aggre- scheduling, process interaction, and activity
gated information is usually associated with scanning, are introduced in the following.
some resident entities, e.g., the queue size, Before that, let us first outline a typical algo-
this approach is called the resident-entity rithm for executing a discrete-event simula-
approach. The drawback of this approach tion model. This algorithm is essentially an
is that the individual characteristics of the event-scheduling algorithm. Most software
transient entities are lost. Nevertheless, this packages employ a similar execution algo-
approach has been shown to significantly rithm. If one prefers not to use existing sim-
improve simulation speed and memory usage ulation packages, he/she can also implement
[2, 3]. Indeed, it is sometimes possible to the algorithm by using a general-purpose pro-
avoid memorizing individual characteristics gramming language, such as C/C++.
and still be able to obtain the same accuracy

Discrete-Event Simulation Execution Algorithm


Initialize
Do until stop condition is satisfied
Advance clock to the time of next event
Execute event
Perform actions: change state variables, schedule events, collect statistics, etc.

Event Scheduling servers are the parallel CPUs (or operators)


handling these messages/requests.
We will use a single-stage multiple-server
A good starting point of building a
queuing system with finite capacity and
discrete-event simulation model is to have a
impatient customers (i.e., G/G/c/K) to
textual description of a simplified model and
illustrate several basic modeling issues of
discrete-event simulation. In this system, try to identify and combine the key events,
there is only one type of transient entities event relationships, and conditions into a
(called customers) and they arrive at the desired logic. After the simplified model
system in accordance with an arbitrary is finished, other features can be added to
stochastic process. Each arriving customer is augment the simplified model to create the
admitted if the current queue size is less than final model. We will employ this practice to
its capacity (denoted by K). Upon joining the first develop a single-server queuing system
queue, each customer starts a random impa- with infinite capacity and no impatient
tient time period; if he/she does not receive customers, and then modify this simplified
service by the end of the impatient time, model to model the original system. A tex-
he/she will depart the system without being tual description of the single-server queuing
served. The c servers are identical with no simulation is given in the following.
vacation and breakdown. This simple model ‘‘A simulation begins by having the first
can represent many real-world systems, for job enter the system. New jobs enter the sys-
example, a bank waiting line with multiple tem at random intervals of arrivals. When a
clerks, or a computer communication system job enters, if the resource is available the job
(or a call center) in which the entities are the can start service. Once a job starts, it will
messages or requests stored in buffer and the leave after a service time delay. Whenever
4 FOUNDATIONS OF SIMULATION MODELING

a job leaves, if there is more work waiting, returns an interarrival time generated from a
then service can start on the next job’’ [6]. given distribution (i.e., a = Fa−1 (u), where u is
Almost all information necessary to build a uniform random number between 0 and 1),
this single-server model is embedded in above s returns a service time duration generated
paragraph. To see this, we highlight the key from a given distribution (i.e., s = Fs−1 (u)).
words in three different formats: bold face, We now ready to extend this model
underline, and italics. The words in bold face to our final multiple-server system with
represent the events: ‘‘enter,’’ ‘‘start,’’ ‘‘leave,’’ queue capacity and impatient customers.
and the initial event ‘‘begin,’’ which only exe- Two important discrete-event simulation
cutes once. The underlined words denote the modeling techniques are used: Boolean
random time durations. Here, ‘‘random inter- expressions and look-ahead capability. To
vals of arrivals’’ are the interarrival times of model the queue capacity, we note that
the arriving entities, and ‘‘service time delay’’ when a customer arrives, the queue size will
is the service time duration of each service. increase by one if the current queue size is
The italicized words signify event-scheduling less than K (i.e., the customer is admitted),
conditions. To build the actual model, circle and remains unchanged otherwise (i.e.,
the events and add arcs starting from the the customer is rejected). This logic can be
corresponding preceding event and ending at implemented by using the following Boolean
the corresponding succeeding event in each expression:
sentence (see Fig. 1). These arcs represent
the event relationships. The delay time on Q = Q + (Q < K), (1)
each arc is specified by the underlined words
if present, or zero otherwise. The condition where (Q < K) = 1 if the condition is true and
on each arc is given by the italicized words on zero otherwise.
that sentence if present, or unconditional oth- To model impatient customers without
erwise. The resulting simulation model (the storing the waiting times of all customers
right panel of Fig. 1) is an event-scheduling- (i.e., without resorting to the transient entity
based simulation model, which is represented approach), we use the look-ahead capabil-
by a simulation modeling language called ity to obtain information in the simulated
event relationship graphs, or simply event future. For ease of exposition, we will use
graphs [7]. Two state variables (Q and R) and a two-server queuing system (i.e., c = 2) to
two random variables (a and s) are needed: illustrate the idea (it can be extended to more
Q returns or sets the current number of than two servers). The idea is as follows.
customers in the queue, R returns or sets When a customer arrives (say customer i), if
the current number of available servers, a he knows the maximum duration he needs

A simulation begins by having the first job enter the system.

(Q)
a
New jobs enter the system at random intervals of arrivals.
(R)
Begin Enter Start s Leave
When a job enters, if the resource is available the job can start service. Q=0 Q=Q+1 Q=Q–1 R=R+1
R=1 R=R–1
Once a job starts, it will leave after a service time delay.

Whenever a job leaves, if there is more work waiting, then service can start on the next job.

Figure 1. From textual description to simulation model.


FOUNDATIONS OF SIMULATION MODELING 5

to wait in queue, he can determine to stay he needs to wait is less than his impatient
or leave right away. The key modeling ques- time p(i.e., (T1 < Tc + p) == 1). The second
tion here is how to know such maximum wait equation will increase the queue size by one
duration. We use two auxiliary variables, T1 if the customer stays (i.e., Q = Q + 1).
and T2 , which record the first and second The state changes under the Stay event
earliest available times of the two servers. are
T1 and T2 are updated whenever a customer
arrives and decides to stay (recall that the s = Fs−1 (u)
state of a discrete-event simulation model w = (T1 − Tc )+
changes only at discrete instants). We add a T1 = min{Tc + w + s, T2 }
Stay event after the Enter event to update
T2 = max{Tc + w + s, T2 }.
T1 and T2 (see Fig. 2). The new values of
T1 and T2 will include the service duration
of customer i even though his service have The first equation simply generates and
not started yet. Calculating the finish time of stores the service time duration of a customer
every customer even before the beginning of in s. The second equation computes the actual
their services resolves the key modeling ques- waiting time of the customer. It is equal to
tion and provides future information for the 0 if the arriving customer finds an avail-
next arriving customer to decide whether to able server (i.e., T1 − Tc < 0). Otherwise, it
stay or depart. The waiting time of each cus- is equal to the amount of time before one
tomer is also calculated at the same moment. of the servers is available (i.e., T1 − Tc ). The
The Start and Finish events can be sched- notation ‘‘(.)+ ’’ represents the positive part of
uled to occur after, respectively, the waiting the waiting time (i.e., max{T1 − Tc , 0}). The
time and waiting time plus service time (see third and the last equations update the two
Fig. 2). earliest available times of the servers due to
In particular, let D be the decision variable this new arriving customer.
of whether to stay or not (stay if D == 1 and In Fig. 2, the impatient customers in
leave if D == 0). Let Tc be current simulation fact never joined the queue. If their con-
time, which can be obtained by using some tributions to the queue size are important,
system function in most simulation packages a new event can be added to include them
(e.g., CLK in Sigma [6] and TNOW in Arena into the queue. This event is scheduled
[8]). Let p be the impatient time period of by the Enter event with a condition of
a customer generated from a given distri- D == 0, a delay of p, and a state change
bution, that is, p ∼ Fp (p). The state changes of Q = Q − 1. The second equation of
that take place when an Enter event occurs the state changes in the Enter event
are as follows: will be modified to Q = Q + 1 × (Q < K).
The random impatient time p will also need
to be generated first and stored because it
D = (Q < K)&(T1 < Tc + p), is used in both the calculation of D and the
Q = Q + D. time delay of the new event.
One remark observed from this model is
The first equation says that a customer regarding the trade-off between speed and
will stay (i.e., D == 1) if the queue size is memory. Sometimes, a small amount of aux-
less than K(i.e., (Q < K) == 1) and the time iliary memory (variables) can greatly reduce

a
w+s
(D)
Begin Enter Stay w Start Leave

Q = 0, R = 1 Q=Q–1 R=R+1 Figure 2. A two-server queue with lim-


T1 = T2 = 0 R=R–1 ited capacity and impatient customers.
6 FOUNDATIONS OF SIMULATION MODELING

the speed or complexity of the simulation the data for each module (such as interar-
model, such as this one. rival time and service time distributions, and
defining the server) by double clicking the
Process Interaction modules. See Kelton et al. [8] for details of
using Arena.
Another popular simulation modeling para- Two issues of the process-interaction
digm is the process-interaction approach. approach should be mentioned: deadlock
Loosely speaking, for simple systems the and virtual entities. Deadlock could occur
process interaction approach is WYSIWYG when two entities are trying to seize the
(What You See Is What You Get) in the sense same resources in a wrong sequence. For
that what you create in the model is what example, consider two entities (A1 and A2)
you observe in the real simple system (see and two machines (M1 and M2). Let us
Fig. 3 and explanation in next paragraph). suppose that A1 is holding M1 and is trying
(However, this intuitive view diminishes to seize M2 to start a process. At the same
when the complexity of the system increases). time, E2 is holding M2 and needs M1 to start
This intuitive view is attractive to beginners another process. In this situation, unless
because it deals directly with the actual some mechanism is introduced to break the
objects of a real system. Together with their conflict, both entities and machines will
animation capability, process-interaction- be waiting forever. Therefore, acquisition
based simulation packages are by far the of resources should be carefully planned
most common in industry. when building a process-interaction model.
To illustrate the intuitive view of One good rule in practice is to seize all
process-interaction models, we model the required resources at one time. In the case
single-server queueing system by using three where several resources must be seized
process-interaction modules to mimic the sequentially (e.g., Process 1 requires only
three processes of the real system: (i) the Machine 1 and then immediately Process
process of customer arrivals, (ii) the process 2 requires both Machines 1 and 2), then
of queuing customers for service, and (iii) the release the previously seized resources first
process of customer departures. We then con- and then seize all needed resources at one
nect the three modules sequentially so that time (e.g., release Machine 1 first and then
the entities (customers) can flow through seize both Machines 1 and 2).
the three modules as they do in the real Virtual entities are needed when one
system. Figure 3 shows the implementation needs to model some abstract mechanisms
of this model using the simulation package or logics that have no physical counterparts
Arena 11 [8]. The mapping between the in the real system. This is because almost
three modules and the three real processes everything in a process-interaction model
are also shown in the figure. (including activities, logics, controls, and
To create the model in Arena, just drag the assigning values to variables) must be driven
modules from a built-in template of Arena, by flowing entities. For instance, to simulate
paste them into the model workspace, con- a traffic intersection, the right-of-way can
nect them based on the job flow, and specify be modeled as a ‘‘virtual resource’’ and

Simulation
Enter Start Leave
Model 96 85
7

Figure 3. Process-interaction single- Real


server queuing model and its real- System
world counterpart. Queue Service
FOUNDATIONS OF SIMULATION MODELING 7

108 Create 108


Enter Not Full? Assign ID Dummy Start Leave
Timer
127 70
108 38
19
Remove
Impatient Original Dispose Duplicated
Customer Entities If Found
Dispose from Queue 32
Customers due Impatient Search
to Capacity Duration Retrieve ID Customer Removed Entity
exceed from Queue Found Impatient
19 Customers Leave
10 Not Found 32

Dispose Duplicated
Entities If Not
Found 66

Figure 4. Process-interaction model of a capacitated queue with multiple servers and impatient
customers.

traffics from any directions will need to seize virtual entity can be disposed. If found,
this virtual resource in order to pass the the virtual entity will enter the ‘‘Remove
intersection. Impatient Customer from Queue’’ module
Another example of ‘‘virtual entities’’ and trigger the departure of the customer
appears in the multiple-server queuing from the queue. Both the virtual entity
system with impatient customers. In a and impatient customer (if found) are then
process-interaction model, an entity in queue disposed.
is a passive object in the sense that it cannot From a computational point of view, the
proactively trigger activities by itself when process of searching a customer from a queue
certain condition is met. Some mechanism could be inefficient when the queue size is
must be created to trigger the correspond- large. Moreover, the search is done for every
ing activity. For example, to trigger the customer regardless of whether the customer
departure of an impatient customer whose has left or not. A more efficient approach
impatient time has expired, a virtual entity such as Fig. 2 is therefore recommended for
is needed. We use the Arena model shown in large-scale congested systems.
Fig. 4 to explain this issue. Other situations where virtual entities are
An arriving customer, if accepted by the needed include the modeling of resource pre-
diamond ‘‘Not Full?’’ module based on the ventive maintenance and failures, or random
current queue size, is assigned an ID in events that could change the state of the
the ‘‘Assign ID’’ module. This customer is system. Indeed, virtual entities, when appro-
then duplicated before joining the queue priately and professionally handled, can be a
(the ‘‘Start’’ module). This duplicate is a powerful modeling technique.
virtual entity and will stay in the ‘‘Impatient
Activity Scanning
Duration’’ module for a random impatient
duration. When the impatient period expires, An activity-scanning simulation model works
this virtual entity first identifies itself in by scanning activities of the model and fires
the ‘‘Retrieve ID’’ module (because there (i.e., activates) the ones that meet certain
could be other virtual entities representing given conditions. One of the main benefits
other customers). It then enters the ‘‘Search of the activity-scanning approach is its ana-
Customer from Queue’’ module to see if the lytical property, which facilitates the con-
customer that it represents is still waiting struction of mathematical models and the-
in the queue. If not found, the customer oretical analysis. The main representative
either is being served or has left, and this approach of activity scanning is Petri-net
8 FOUNDATIONS OF SIMULATION MODELING

models [9]. A Petri net is a bipartite graph 1. Identify all activities, including zero
(i.e., a graph with two types of elements and time activities (one transition for each
no two elements of the same type connect activity) of the system,
to each other). The two types of elements 2. Identify the conditions for each activity
are circles (called places) and bars (called (one place for each condition),
transitions). Besides these two types of ele- 3. Connect the places and transitions to
ments, users can also add tokens to the graph make the net alive according to the
to make the Petri net run. Tokens, which model logic, and
are solid dots, are used to represent objects
4. Add tokens to represent the initial state
(e.g., jobs or machines) and model logics (e.g.,
of the system.
failure events). Each transition represents a
certain activity of the model. All the input
Fig. 5 presents the four-step implementation
places to a transition denote the conditions
of the Petri-net simulation model of the
required for the transition to fire. All the out-
single-server queuing system without capac-
put places from a transition are the results
ity and no impatient customers. There are
of the firing of the transition. In a standard
two activities in this simple system: arrivals
Petri net, a transition is enabled when there
of customers and services for customers,
is at least one token in each input place.
which are modeled by the two transitions, E
After a time delay associated with the tran-
and S (which respectively stand for ‘‘Enter’’
sition (which can be random, deterministic,
and ‘‘Start’’). The single token in Place A
or zero), the transition fires and one token denotes the arrival stream of customers (i.e.,
is removed from each input place. Imme- the process of arrivals). Every a random
diately, one token is added to each output time units, Transition E fires; it then places
place. The number of tokens entering and one token to Place Q, denoting an arrival
leaving from a transition may or may not of a customer to the queue, and also puts
equal. If the number of tokens in any place is one token back to Place A, initiating the
always below a certain number at any time, arrival of the next customer. The token in
the Petri net is called bounded, otherwise, Place R represents the single machine which
unbounded. At any time of the simulation, is available right now (adding more tokens
a snapshot of the token distribution (their here extends the model to a multiple-server
locations) gives the current state of the sim- system). Transition S has two input places,
ulation. This token distribution is called a signifying the two conditions for a service to
marking. start (i.e., an available server and a waiting
The aforementioned firing rule is called customer). When these two conditions are
remove-on-fire, in that the tokens are rem- satisfied, Transition S is enabled; and after
oved when the transition fires. Another firing s random time units, it fires, denoting the
rule is remove-on-enable, which removes the completion of a service. One token is then
tokens when the transition is enabled. It can placed in Place R, which allows the server to
be shown that these two rules are equivalent. work on the next customer if there is any.
To build a Petri-net simulation model, the One token is also deposited to Place L, which
following four-step procedure can be used: represents a processed customer.

R R R

A Q L Q L A Q L
A
a s a s a s a s
E S E S E S E S
Step 1 Step 2 Step 3 Step 4

Figure 5. Activity scanning model of a single-server queuing system.


FOUNDATIONS OF SIMULATION MODELING 9

Enrichments of Petri nets include using describing the dynamics of a discrete-event


colored tokens to represent different types system. It facilitates mathematical analysis
of entities, allowing multiple tokens to be of the underlying system [12]. Another
removed from or deposited into a place, and representation of discrete-event systems is
using inhibitor arcs to resolve conflictions based on optimization models. In this repre-
by assigning priorities to different activities. sentation, events are represented as decision
The inclusion of inhibitor arcs increases the variables, event relationships are modeled
modeling power of Petri nets to a Turing by constraints, event times are captured by
machine. the right-hand-sides of the constraints, and
event scheduling (i.e., execute an event as
Other Discrete-Event Modeling World Views soon as feasible) is realized by the objective
A discrete-event system can also be charac- function of the optimization model. The
terized by a state machine represented by benefits of the optimization representation
a state-transition diagram. A state machine include using dual variables for sensitivity
includes all the system states, transitions analysis, identifying deadlocks by examining
between states, and the corresponding feasibility of the optimization model, obtain-
actions. For example, in the single-server ing more efficient simulation models by
queuing system, the state could be the eliminations of redundant constraints [13].
number of customers in the system, the
transitions are the two events ‘‘arrival of a
new customer’’ and ‘‘departure of finished CONTINUOUS SIMULATION MODELS
customer,’’ and the actions are either to
increase the number of customers in the Continuous simulation models simulate
system by one (when the arrival transition systems with state variables that change
occurs) or decrease the number of customers continuously in time. One popular type of
in the system by one (when a departure tran- continuous simulation is system dynamics.
sition occurs). There is no need to include the This method is suitable for systems with
transition for the start of a service because feedback structures and for modeling high-
the state is the number of customers in level of abstraction of a real system. In a
the system, which does not change when a system dynamics simulation model, the state
service begins. There is a mapping between of the system is represented by stocks and the
the states, transitions, and actions of a state rate of change in the state as flows. The stock
machine and the state variables, events, and variables accumulate all past state values
conditions and state changes of an event and therefore, represent the current system
relationship graph. Therefore, the modeling state (e.g., x(t) and y(t) in the example below).
powerful of an event relationship graph is The flow variables (can also be parameters)
equivalent to a state machine (or a Turing are measured per unit of time such as the
machine) (see a formal proof in Savage changes in a state variable per second (e.g.,
et al. [10]). the growth and death rates in the example
Besides graphical representations, a below). Another type of continuous simula-
discrete-event can also be represented for- tion models frequently used in modeling and
mally as a mathematical model. One example simulating queuing systems is stochastic
is the formalism called Discrete event system fluid (flow) models. Continuous simulation
specification (DEVS). The DEVS formalism has been widely used in many fields, includ-
describes a discrete-event system by defining ing electrical engineering, chemistry, biology,
all the events, how the states change, how mechanical engineering, business, and so on.
the times of different activities advance, One simple continuous simulation model
how the events change the states and vice is the Lotka-Volterra’s predator-prey model,
versa both externally and internally [11]. which models the competition between two
Another well-known discrete-event modeling types of populations: prey and predators
formalism is the generalized semi-Markov [1]. Let x(t) and y(t) denote, respectively,
process (GSMP). GSMP is a formal way of the number of individuals in the prey and
10 FOUNDATIONS OF SIMULATION MODELING

predator populations at time t. Each popu- AGENT-BASED MODELS


lation is determined by two quantities, the
pure change rate of the population itself and In this section, we first discuss the connection
the interaction rate due to the interaction between agent-based simulation and the two
with the other population. The pure change simulation approaches: discrete-event and
rate of the prey is their growth rate in the continuous simulations. We then introduce
absence of the predators (denoted by a), while some concepts of agent-based simulation
the pure change rate of the predators is their (such as agents and interactions) and
death rate (or starvation rate) due to the outline a general algorithm for executing an
absence of the prey (denoted by −b, which agent-based simulation model. We exemplify
is negative because it is decreasing). The these concepts by using a simple agent-based
interaction rate of the prey is the decrease simulation model.
in their numbers due to the presence of Loosely speaking, an agent-based simu-
the predators (denoted by −cy(t), which is lation model is a hybrid discrete-conti-
proportional to the number of predators) nuous simulation model with proactive,
and the interaction rate of the predators is autonomous, and intelligent entities. Recall
the increase in their population due to the that entities in a discrete-event simulation
presence of the prey (denoted by dx(t), which model are rather simple with limited capabil-
is proportional to the number of prey). ities, and can only react to state changes. In
This model assumes exponential growth the process-interaction queuing model with
(or death) in both populations in the absence impatient customers, the customer entities
of the other, that is, the prey’s growth is cannot actively leave the system when their
x (t) = ax(t) and the predators’ death is y (t) = impatient times expire. A separated mech-
−by(t). The interaction between the two pop- anism by using virtual entities is needed
ulations are captured by the product of their to trigger the departure of the impatient
population sizes, that is, the decrease in the customers. The servers in this model are also
prey due to the predators is −cx(t)y(t) and reactive. For instance, if we model vacations
the increase in the predators due to the prey or breakdown (e.g., sick), then separated
is dx(t)y(t). Combining the pure change and mechanisms (such as vacation timers or
interaction terms for each population gives failure timers) will be needed.
two differential equations Agent-based simulation extends the cap-
ability of entities to allow autonomy and
x (t) = ax(t) − cx(t)y(t), (2) intelligence. The resulting autonomous obje-
cts (called agents) are able to proactively

y (t) = −by(t) + dx(t)y(t). (3) interact with other agents and the environ-
ment in which they situate. If an agent-based
This simple differential-equation model simulation model includes both discrete and
can be solved exactly to obtain analytical continuous state variables, it is a hybrid
solutions for x(t) and y(t). With boundary con- discrete-continuous simulation model with
ditions and given values for all parameters, proactive autonomous entities.
one can determine (i.e., simulate) the system The popularity of agent-based simulation
state at any time t. There is no randomness in is driven by the increasing complexity of
this simple model. To model randomness, one real-world systems and its capability of
can include (e.g., add) random factors, which handling these complex systems. A real-
can also be functions of t, to above equations, world complex system often contains a
for example, Gaussian noises. This will large number of interacting units that are
increase the complexity of the model. Indeed, autonomous, goal-driven, and adaptive (i.e.,
simulation models of many real-world ‘‘agents’’). For example, a large-scale health-
systems are so complex that no closed-form care network may consist of a number of
solutions can be obtained. Numerical meth- units from large facilities such as hospitals,
ods, such as the Runge-Kutta method, can medical supply warehouses, blood banks
be used to find approximate solutions [14]. to small service units such as ambulances,
FOUNDATIONS OF SIMULATION MODELING 11

operating rooms, and from personnel such be enforced to discourage bad behavior and
as doctors and nurses to patients and promote good ones. Emergent behavior here
other service providers. All these units can means arising coherent patterns of macro-
be considered as autonomous agents. For scopic behavior resulting from microscopic
example, warehouses react to demands by actions and interactions. This leads to the
providing inventory based on a certain rule, agent-based simulation approach, which has
ambulances operate in accordance with some been developed rapidly over the past two
dispatch policies and physical mechanical decades. It has been widely used in vari-
rules, and patients try to intelligently select ous fields including military, biology, social
doctors. In many cases, agents, while operat- science, economics, business, and so on. The
ing based on their own strategies, cooperate theoretical basis of agent-based simulation
or compete with each other in accordance lies mainly in cellular automata [15–17],
with certain mutual rules or agreements. complex system modeling, artificial life, and
It is natural to model agents as objects swarm intelligence [18,19].
in a computer program and simulate their The algorithm for executing an agent-
interactions to see what interaction rules based simulation model varies greatly across
lead to what consequences (i.e., emergent different agent-based platforms. A general
behavior). Mechanisms or policies can then scheme is outlined below.

Agent-Based Simulation Execution Algorithm


Initialize
Do until stop condition is satisfied
Advance clock by a given amount of time (e.g., a tick count)
Update all continuous state variables
For each agent (select an agent randomly or based on a specific order)
Perform actions: change state, communicate with other agents or environment, etc.

We now use the Conway’s Game of Life 3. Otherwise, the cell will die either of
model to illustrate the modeling of agents, loneliness or crowdedness in the next
their interactions, and the resulting emerg- time step.
ing behavior. Imagine that there is a two-
dimensional grid of size n × n, where n is the Implementing this model in a standard
number of rows (or columns) in the grid. Each agent-based simulation package (such as
entry of the grid lives a cell. The cells cannot Repast [20] or NetLogo [21]) and running
move. Each cell has only two states: alive and it for about one hundred iterations yields
a distribution of relatively stable patterns
dead. Each cell changes its state based on
of live cells as shown in the right panel of
the following three simple rules that describe
Fig. 6. Note that the middle panel of Fig. 6 is
its interactions with its eight neighbors (up,
the initial distribution of live cells.
down, left, right, and four diagonal cells). See
In fact, this example is so simple that it
the left panel of Fig. 6 for a visual description
can be considered as a cellular automaton.
of the rules.
A cellular automaton model considers a set
of cells residing in a two-dimensional lattice.
Moreover, this model only includes discrete
1. A live cell with exactly two or three live
state variables and therefore can also be mod-
neighbors will remain alive in the next
eled by using the discrete-event simulation
time step.
approach.
2. A dead cell with exactly three live To demonstrate the flexibility of this model
neighbors will come to life in the next in arriving different emergent behaviors, we
time step. generalize the original Game of Life model
12 FOUNDATIONS OF SIMULATION MODELING

Time t Time t + 1
Rule 1: Stay alive

Rule 2:
Come to life

Die of loneliness
Rule 3:
Die of crowdedness

Figure 6. Agent-based simulation model of Conway’s game of life.

by simply changing the number of live neigh- agents and their environment. Agents can
bors in Rules 1 and 2 to X, Y, and Z as defined also have internal memories and perceptions
below. To better visualize the emergent pat- to respond to outside and adjust their inside.
terns, we also color the cells based on the Agent-based simulation also allows different
number of live neighbors (see the legend of kinds of spatial environments, such as ring,
Fig. 7). lattice, random, or maps (such as GIS maps).
The variation of Conway’s game of life Agents can move freely in its environment.
model is as follows: This makes it applicable for modeling and
visualizing complex behavior in physical
1. A live cell with the number of live neigh- systems, such as simulations of traffic,
bors between X and Y, inclusively, will evacuations, biological systems, mechanical
remain alive in the next time step, systems, and so on.
One issue in agent-based simulation is the
2. A dead cell with exactly Z live neighbors
order in which the agents’ states are updated
will come to life in the next time step,
in each time step. If one agent is updated
3. Otherwise, the cell will die either of before its neighbors are updated, then its
loneliness or crowdedness in the next state at the current time step can affect the
time step, states of its neighbors at this time step, oth-
erwise, its state at the current time step will
where 0 ≤ X, Y, Z ≤ 8 and X ≤ Y. affect its neighbors in the next time step.
This variation has a total of 288 possi- One common practice is to randomize the
ble combinations of rules, (X, Y, Z). Some updating order.
of them are trivial but some produce clear The computational requirement of the
emergent patterns as shown in Fig. 7. These agent-based simulation execution algorithm
patterns also evolve in time. One can also use is high because it has to loop through all
a sequence of multiple rules to obtain differ- agents in each time step. Methods have been
ent combinations of patterns. The patterns proposed to avoid looping all agents, for
shown in Fig. 7 are obtained by using this example, only updating those agents whose
sequence of rules: (0, 7, 8)—(0, 7, 3)—(0, 7, state changes matter. Another approach is to
6)—(0, 7, 5)—(0, 7, 4)—(0, 5, 4)—(3, 5, 4), employ the discrete-event simulation algo-
where the first rule is to initialize the states rithm to advance the clock based on events
of all cells to dead. and only update the continuous variables in
Although cellular automata are already every time step. Different hardware (such
Turing complete, agent-based simulation as parallel CPUs or graphics processing
allows agents to have a greater degree of units—GPU) have also been used to improve
flexibilities and functionalities (such as the efficiency of agent-based simulation
learning and adaptation) and can accommo- models. It has been shown that execution
date more complicated interaction rules both speed can be improved by thousands of times
between agents and agents, and between when using GPU [22].
FOUNDATIONS OF SIMULATION MODELING 13

Legend
# of alive
neighbors 0 1 2 3 4 5 6 7 8
Color:

Figure 7. Emergent behavior of variation of Conway’s game of life model.

MONTE-CARLO MODELS The relationship between Monte-Carlo


simulation and other simulations such as
Monte-Carlo simulation approach is based discrete-event or continuous simulations
on repeated sampling from an algorithm, a is subtle and depends on how one defines
set of equations, or a given computer model. Monte-Carlo simulation. If one considers
Sampling here means two steps: (i) generate Monte-Carlo simulation as a static model
random numbers and (ii) evaluate the target that does not involve time or represents a
values using the generated random num- system at a particular time (as discussed
bers. In general, the sampling targets can in the section titled ‘‘Introduction’’), then
be static or dynamics, continuous or discrete, Monte-Carlo simulation is a special case of
or deterministic or stochastic. Sampling from other simulations that involve time. The
a deterministic target is needed when the relationship turns around if one allows the
response space of the target is large and only sampling target to evolve in time.
a certain amount of computing budget is allo- While different definitions of Monte-
cated to sample a fraction of the whole space. Carlo simulations can be found in the
14 FOUNDATIONS OF SIMULATION MODELING

literature, one popular definition is by REFERENCES


Law (2006) in which Monte-Carlo simu-
1. Law A. Simulation modeling and analysis. 4th
lation is defined as ‘‘a scheme employing ed. Boston: McGraw-Hill; 2006.
random numbers. . .used for solving certain
2. Law A, Kelton WD. Simulation modeling and
stochastic or deterministic problems where analysis. 3rd ed. Boston: McGraw-Hill; 2000.
the passage of time plays no substantive
3. Schruben LW, Roeder TM. Fast simulations
role.’’ This definition is well accepted in of large-scale highly congested systems. Sim-
the discrete-event simulation area as it ulation 2003;79(3):115–125.
clearly differentiates discrete-event dynamic 4. Kiviat PJ. Digital computer simulation: com-
simulation and static pure-sampling-based puter programming languages. Santa Monica
simulation. (CA): The Rand Corporation; 1969. Memoran-
Monte-Carlo simulation has various appli- dum RM-5883-PR.
cations in physics, mathematics, and finance, 5. Lackner MR. Digital simulation and system
such as simulating molecular dynamics, theory. Santa Monica (CA): System Develop-
global warming impacts, earthquakes, ment Corporation, SDC SP- 12; 1964.
solving diverse mathematical problems 6. Schruben D, Schruben LW. Graphical simu-
(from numerical integration to Markov lation modeling using SIGMA, Ithaca (NY):
chains, and from heuristics optimization Custom Simulation; 2001.
algorithms to games), and evaluation and 7. Schruben L. Simulation modeling with event
prediction (e.g., simulation of Economet- graphs. Comm ACM 1983;26(11):957–963.
rics models such as geometric Brownian 8. Kelton WD, Sadowski RP, Sturrock DT. Sim-
motion, diffusion models, and GARCH ulation with Arena. 4th ed. New York (NY):
models) [23]. McGraw-Hill; 2007.xxiv,668.
9. Peterson JL. Petri net theory and the mod-
eling of systems. New Jersey: Prentice-Hall;
CONCLUSION 1981.290.
10. Savage EL, Schruben LW, Yucesan E. On the
This introductory article introduces basic generality of event graph models. INFORMS
modeling concepts in discrete-event simula- J Comput 2005;17(1):3–9.
tion, continuous simulation, and agent-based 11. Zeigler BPA. Theory of modelling and simu-
simulation. It also highlights the relationship lation. Melbourne: Krieger Publishing Com-
among these modeling approaches as well pany; 1984. p. 460. Reprinted.
as different world views of discrete-event 12. Glynn P. A GSMP Formalism for Discrete
simulation models. Event Systems, Proceedings of the IEEE;
1989.
Besides these modeling approaches,
new simulation modeling methods are also 13. Chan WKV, Schruben LW. Optimization mod-
els of discrete-event system dynamics. Oper
being proposed and developed. Classical
Res 2008;56:1218–1237.
approaches tend to focus on aspects of effi-
14. Cellier F, Kofman E. Continuous system sim-
ciency, easy-to-learn, and animation-frien-
ulation. New York: Springer; 2006.
dly. New approaches are moving toward the
15. Von Neumann J. Theory of self-reproducing
need of an integrated simulation framework,
automata. Champaign (IL): University of Illi-
in which modeling, analysis, and presen- nois Press; 1966. p. 388.
tation are integrated. How a simulation
16. Beyer WA, Sellers PH, Waterman MS. Stanis-
model is created directly influences experi- law M. Ulam’s contributions to theoretical
mentations (analysis), and data collections theory. Lett Math Phys 1985;10:231–242.
and interpretation (presentation), which in 17. Wolfram S. Universality and complexity in
turn affect the validity (or credibility) of the cellular automata. Phys Nonlinear Phenom
simulation model and results. Therefore, 1984;10D:1–35.
the construction of a simulation model 18. Bonabeau EA, Dorigo MA, Theraulaz GA.
should be tied to the corresponding analysis Swarm intelligence: from natural to artificial
and presentation based on the need of the systems. New York: Oxford University Press;
underlying simulation study. 1999.
FOUNDATIONS OF SIMULATION MODELING 15

19. Macal CM, North MJ. Tutorial on agent-based 21. Wilensky U, NetLogo. http://ccl.northwestern.
modeling and simulation part 2: how to model edu/netlogo/. Center for Connected Learning
with agents. Proceedings of the 2006 Win- and Computer-Based Modeling, Northwestern
ter Simulation Conference. Monterey (CA), University, Evanston (IL). 1999.
Piscataway (NJ): Institute of Electrical and 22. Lysenko M, D’Souza RM. A framework for
Electronics Engineers; 2006. megascale agent based model simulations on
20. North MJ, Collier NT, Vos JR. Experiences graphics processing units. J Artif Soc Soc Sim-
creating three implementations of the repast ulat 2008;11(4):10.
agent modeling toolkit. ACM Trans Model 23. Hammersley JM, Handscomb DC. Monte
Comput Simulat 2006;16(1):1–25. Carlo methods. London: Methuen; 1964.

View publication stats

You might also like