SIMULATION
SIMULATION
A simulation is the imitation of the operation of a real-world process or system over time.
Steps include
o Generating an artificial history of a system
o Observing the behavior of that artificial history
o Drawing inferences concerning the operating characteristics of the real system
Use the operation of a bank as an example:
o Counting how many people come to the bank; how many tellers, how long each
customer is in service; etc.
o Establishing a model and its corresponding computer program.
o Executing the program, varying parameters (number of tellers, service time, arrival
intervals) and observing the behavior of the system.
o Drawing conclusions: increasing number of tellers; reducing service time; changing
queueing strategies; etc.
The behavior of a system as it evolves over time is studied by developing a
simulation model.
A model is a set of entities and the relationship among them.
For the bank example: entities would include customers, tellers, and queues. Relations
would include customers entering a queue; tellers serving the customer; customers leaving
the bank.
Once developped, a model has to be validated. There are many different ways to validate
a model: observation (measurement); analytical model comparison (analysis).
Sub-sections
Simulation enables the study of, and experiment with, the internal interations of a complex,
dynamic system, or a subsystem.
E.g. when setting up a telephone sales department (such as the 1998 World Cup Soccer
Game), how many operators are enough to handle the calls? Many factors can play a role
here: the number of tickets left, estimated number of people who want the ticket, capacity
of the phone lines, how long would it take to service one call, etc.
Informational, organizational, and environmental changes can be simulated and the effect
of these alterations on the model's behavior can be observed.
E.g. to study the behavior of a web server, we can simulate the client traffic and see how it
responds.
The knowledge gained in designing a simulation model may be of great value toward
suggesting improvement in the system under the investigation.
E.g. before actually building a cache system, one can simulation the various configuration
of the cache, study its behavior and find out the optimum solution.
By changing simulation inputs and observing the resulting outputs, valuable insight may
be obtained into which variables are most important and how variabls interact.
E.g. in studying the performance of a computer network, a number of parameters affect the
outcome, cable length, transmission speed, packet size, arrival rate, number of stations, etc.
which one is the most important on the delay? It's the ratio of arrival rate and service rate.
A system is a group of objects that are joined together in some regular interaction or
interdependence toward the accomplishment of some purpose.
A system is often affected by changes occurring outside the system. Such changes are said
to occur in the system environment. In modeling a system, it is necessary to decide on
the boundary between the system and its environment.
E.g. When studying cache memory using simulation, one has to decide where is the
boundary of the system. It can be simply the CPU and cache, or it can include main
memory, disk, O.S., compiler, or even user programs.
Components of a System
A discrete system is one in which the state variable(s) change only at a discrete set of points
in time. E.g. customers arrive at 3:15, 3:23, 4:01, etc.
A continuous system is one in which the state variable(s) change continuously over time.
E.g. the amount of water flow over a dam.
Model of a System
A model is defined as a representation of a system for the purpose of studying the system.
Many times one can't experiment with a real system such as a bank, or a highway system. One has
to expriment with a model of the real system. A model is often not exactly the same as the real
system it presents. Rather, it includes a few (or majority of) key aspects of the real system. It is
an abstraction of the real system.
Types of Models
Static vs. dynamic: A static simulation model, sometimes called Monte Carlo simulation,
represents a system at particular point in time. A dynamic simulation model represents
systems as they change over time.
Deterministic vs. stochastic: A deterministic simulation contains no random variable(s).
e.g. patients arrvie in a doctor's office at a pre-scheduled time. A stochastic simulation
involves one or more randome variables as input.
Discrete vs. continuous: (already discussed).
Subsections
Queueing Systems
Simulation of Inventory Systems
Other Examples of Simualtion
Queuing Systems
Note
o The flows are organized by the events, one for the departure event and the other for
the arrival event.
o The randomness of the events can be emulated by rolling a dice and recording its
face value (so the possible inter-arrival time would be between 1 and 6).
Tables listed 1) interarrival time 2) service time 3) various clock readings organized by
customers 4) chronological ordering of events
Customers arrive at the check-out counter at random from 1 to 8 minutes apart (interarrival
time between 1 and 8 minutes) (Table 2.6 on page 28)
Service time varies from 1 to 6 minutes with distribution shown in Table 2.7 on page 28.
Random digit assignment in the tables are used to separate different times. For example,
all interarrival time are evenly distributed with a probability of 0.125. When to use 1? When
to use 8? This is distincted by the random digit assignment where 1 is used if the RDA is
between 1 and 125, 8 is used if RDA is between 876-1000. They have the same length in
range (125).
Running of the simulation: Is one run enough to represent the situation? The answer is
'NO'. Typically, many random runs are required to generate sufficient statistical
significance.
Result calculation:
This can be compared with the expected service time from the service time probability
distribution
which is
The longer the simulation, the closer to their expected values (this is an indication of the
quality of the random number generators).
Note: typo on page 30, third equation: it should read ``total idle time ...'', rather than ``total
run time ...''.
The first example involves one server (one cashier). This example will show the case for two
servers, one serves faster than the other.
If both servers are idle when a new customer comes in, Able gets the work.
A few statistics:
Some amount M of goods is in stock to begin with. As sales continue, the stock decreases. At the
pre-defined interval, N, the stock level is checked, and the goods is re-ordered.
It is possible that the inventory becomes negative, meaning the goods is in shortage.
The lead time, which is the time between the issurance of re-order and the arrival of the
goods, can be considered as zero in many cases.
The paper seller buys the papers for 33 cents each and sells for 50 cents each.
The papers not sold at the end of the day are sold as scrap for 5 cents each.
Newspapers can be purchased in bundles of 10. Thus the paper seller can buy 40, 50, 60,
and so on. In the simulation shown in Table 2.18 the case of purchasing 70 newspapers is
demonstrated.
There are three types of newsdays, ``good'', ``fair'', and ``poor'' with probabilities of 0.35,
0.45 and 0.20.
The demand distribution is listed in Table 2.15 on page 37.
Profit is calculated as
downtime $5 / minute
repair-person $15/ hour
time to change the bearing 20 minutes for one bearing,
30 minutes for two, 40 minutes for three
bearing cost $16/each
Table 2.24 shows the result of replacing only the broken bearings.
Table 2.25 shows the result of the new policy: replace all three bearings if any one is
broken.
The net result is that the saving of the new policy is about $865 a year.
A squadron of bombers attempt to destroy an anmmunition depot (see Figure 2.8 on page
44)
If a bomb lands in an area of 600 meters (horizontal) by 300 meters (vertical) away from a
specified center, it is a hit. Otherwise it is a miss.
We use two numbers to indicate the position that a bomb hits, X for horizontal and Y for
vertical. Two separate normally distributed random numbers are generated, one for X and
the other for Y.
The result is shown in Table 2.26 on page 47.
This type of simulations doesn't involve time. They are called Monte-Carlo, or static
simulation.
GENERAL PRINCIPLES
This chapter develops a common framework for the modeling of complex systems using discrete-
event simulation. Discuss basic building blocks of discrete-event simulation: entities and
attributes, activites and events, states.
Subsections
System:
A collection of entities (e.g. people and machines) that interact together over time to
accomplish one or more goals.
Model:
An abstract representation of a system, usually containing structural, logical or
mathematical relationships which describe a system in terms of state, entities and their
attributes, sets, processes, events, activities, and delays.
E.g. a bank operation can be modeled as a queueing system: tellers being the server(s),
customers being the jobs in the queue. We ignore all other features of a bank in this model
(doors, receptionist, waiting areas, etc.)
System state:
A collection of variables that contain all the information necessary to describe the system
at any time.
E.g. In the Able-Baker carhop example, we may define the system state as (Able-busy,
Baker-busy, number-of-cars-waiting-in-line).
Entity:
Any object or component in the system which requires explicit representation in the model.
Attributes:
The properties of a given entity.
E.g. the priority of a waiting customer, the routing distribution of a job through a workshop.
List:
A collection of associated entities, ordered in some logical fashion.
E.g. when simulating a computer network with multiple computers, packets waiting to be
transmitted at each computer form a list ordered by the time of their generation. There will
be multiple instances of this kind of lists.
Event:
An instantaneous occurrence that changes the state of a system (such as an arrival or
departure of a customer).
Event notice:
A record of an event to occur at the current or some future time, along with any associated
information necessary to execute the event. At a minimum, the record includes the event
type and the event time.
E.g. when simulating the operation of an airport, we may have two types of events, take-
off and landing. With these two events, a possible event notice would take the following
form.
Event list:
A list of event notices for future events, ordered by time of occurrence; also known as the
future event list (FEL).
Activity:
A duration of time of spcified length (e.g. a service time or an inter-arrival time), which is
known when it begins (although it may be defined in terms of statistical distribution).
Note that the term time here is not necessarily a reading of the clock, rather it is a process
(e.g. life-time of a bearing).
E.g. take-off time: an aircraft will complete its take-off in three minutes after it starts its
engine.
E.g. a customer starts to be serviced at a barber shop, it may take the barber a random
amount of time to finish.
Delay:
A duration of time of unspecified indefinite length, which is not known until it ends.
E.g. a customer's delay in a last in, first out waiting queue which, when it begins, depends
on future arrivals (e.g. procedure call stack).
Clock:
A variable representing simulated time. CLOCK is used in the textbook examples.
With the basic concepts discussed, how is a typical discrete-event driven simulation executed? We
will describe this process by using an example: airport simulation (take-off and landing) with one
run way.
World Views
How to describe a simulation, or from what point of view to observe a simulation? There are a few
popular modes. These are called world views.
Only one sanp-shot (the current one) is kept in computer memory. A new snap-shot can be
derived only from the previous snap-shot, newly generated random variable values, and
the event logic. Past snap-shots should be ignored when advancing the clock. The current
snap-shot must contain all information necessary to continue the simulation.
See Figure 3.4 on page 69 for an example. From the view point that two processes interact
with each other.
Often specialized simulation package can support this view. These simulation packages
take care of the time advancing issues for the programmers. Programming in general
purpose high level language is difficult to use this process-interaction world view because
it will be too complicated for programmers to specify all the details.
activity-scanning world view:
With activity-scanning approach, a modeler concentrates on the activities of a model and
those conditions that allow an activity to begin. At each clock advance, the conditions for
each activity are checked and if the conditions are true, the corresponding activity begins.
See Figure 3.4 on page 69 for an example. From the view point that activities and
conditions.
Other Examples
System state:
System state:
(LQ(t), LS(t)) where LQ(t) is the number of customers in waiting line, and LS(t) is the
number of customers in service at time t.
Entities:
Server and customers.
Events:
Arrival (A)
Departure (D)
Stopping event (E), scheduled to occur at time 60.
Event notices:
Activities:
Further from Example 3.3, we want to collect some statistics, mean response time and mean
proportion of customers who spend 4 or more minutes in the system (time in the system includes
waiting time and service time).
Six dump trucks haul coal from the entrance of small mine to the railroad.
Each truck is loaded by one of the two loaders.
After loading, a truck moves immediately to the scale to be weighed as soon as the scale is
available.
The two loaders and the scal have a first-come-first-server queue.
The actual time for loading and weighing is negligible.
Aftger being weighed, the truck drives off and will come back to the same line, to get smore
coal. This process is repeated.
Subsections
Basics
Conservative Approach
Optimistic Mechanisms
References
Basics
Parallel discrete event simulation (PDES) refers to the execution of a single discrete event
simulation program on a parallel computer.
A discrete event simulation model assumes the system being simulated only changes state
at a discrete points in simulated time.
The simulation model jumps from one state to another upon the occurrence of an event.
In a real world system model, many things (events) can occur at the about same time, yet
few take place at the exact same moment. Also, they don't have a regular interval in
between occurrances.
Asynchronous systems where events are not synchronized by a global clock.
A possible mechanism of PDES is to use lock-step execution using a global simulation
clock among many processors. At each step of simulated time, event lists on different
processors are checked and the events due in time are executed.
This approach performs very poorly because very few events would have the exact same
time.
Concurrent execution of events at different points in simulated time is required! This
introduces interesting synchronization problems that are at the heart of the PDES problem.
Sequential simulations typically utilize three data structures:
1. the state variables that describe the state of the system,
2. an event list containing all pending events that have been scheduled, but have not
yet taken effect, and
3. a global clock variable to denote how far the simulation has progressed.
In this execution paradigm, it is crucial that one always select the smallest timestamped
event from the event list as the one to be processed next.
If an event with larger timestamp were executed before a smaller one that would schedule
this larger timestamped event, an logic error would occur. We call this type of
errors causality errors.
Example: if a customer's departure event is processed before its arrival event, a causality
error occured.
One can ensure that no causality errors occur if one adheres to the following constraint:
The above LCC essentially says if events are processed in non-decreasing timestamp order,
then we say it obeys the causality constraint; if events are not processed in non-decreasing
timestamp order, then we say it does not obey the causality constraint.
Adherence to this constraint is sufficient, though not always necessary, to guarantee that
no causality errors occur. In another words, violating causality constraint may not always
result in simulation error. This is because two events within a single LP may be independent
of each other, in which case processing them out of timestamp sequence does not lead to
causality error.
Example: a supermarket has a service desk and a number of check-out lines. The customers
who go through service desk can be considered independent of those who go through
check-out lines. If we process them out of timestamp order, it will not lead to causality
error.
On the other hand, if in the same check-out line for a single customer, if we process
the bagging event before the check-out event, a causality error has occured.
The challenge in PDES is to execute LPs concurrently and lead to correct simulation
results.
PDES mechanisms can be divided into two categories: conservative and optimistic.
Conservative approaches strictly avoid the possibility of any causality error. Typically
these approaches reply on some strategy to determine if it safe to process an event.
Optimistic approaches use a detect and recover strategy: causality errors are allowed, but
detected, and a rollback mechanism is invoked to recover the errors.
Conservative Approach
The key to conservative PDES is to make sure no causality error will occur before
processing an event. Different strategies exist.
Statically specify the links that indicate which processes may communicate with which
other processes. An LP can send messages only to specified LPs.
E.g.: when simulating the operation of a number of airports with airplanes taking-off and
landing, we may speicify that airplanes take off from A can only land on B and C. This
way we have a fixed link.
Messages arriving on each incoming link are stored in FIFO order for the LP to process.
Each of the incoming links maintains a clock that is equal to either the timestamp of the
message at the head of the queue if the queue is not empty, or the timestamp of the last
received message if the queue is empty.
The LP repeatedly selects the link with the samllest clock and, if there is a message in that
link's queue, processes it.
If the selected queue is empty, the process blocks.
The above protocol guarantees that each process will only process events in non-decreasing
timestamp order, thereby ensuring adherence to the local causality constraint.
Problems: if a cycle of empty queues arises that all have small clock value, each process in
the cycle must block, and the simulation deadlocks. (See Figure 2 on page 34 of Fujimoto's
1990 CACM paper).
To solve this problem, a null message is utilized. An LP sends messages to all of its out-
going links in a round-robin fashion. If at a time the LP doesn't have a message for on
particular out-going link, a null message with timestamp is sent to that link. Doing
so guarantees that the receiving LP will not have to block, thus deadlock is avoided.
The null message from with timestamp essentially tells the reciving process
that will not send events in the future to other LPs with timestamp smaller than
.
How to compute ? is the minimum of all incoming links timestamp and first
event's timestamp on LP's own event list.
This protocol works correctly. However, it generates large number of null messages, thus
waste of processing time.
Large amount of work has been done to improve the performance of conservative approach
to PDES.
Optimistic Mechanisms
Optimistic mechanism allow all LPs proceed because it is possible that causality error
might not occur.
If at a later stage an causality error is detected, the recover process takes place, undoing the
effects of the events that have been processed (rollback).
The event causing rollback is called a straggler.
An event may do two things that have to be rolled back:
1. it may modify the state of the logical process;
2. it may send event messages to other processes
Rolling back the state is accomplished by periodically saving the process's state, and
restoring an old state vector on rollback. The state has to be rolled back to a simulation
time that is equal or smaller than the time of the straggler.
"Unsending" a previously sent message is accomplished by sending a negative message or
an anti-message that annihilates the original message when it reaches its destination.
If a process receives an anti-message that corresponds to a positive message that has
already been processed, this anti-message becomes a straggler, causing rollback on this LP.
Recursively repeating this procedure allows all the effect of erroneous computation to
eventually be canceled. It can be proved that this process converges, and it always makes
progress under certain conditions.
The fundation of the optimistic approach is virtual time, which is one of the most important
concepts in distributed computing.
o A virtual time system is a distributed system executing in coordination with an
imaginary virtual clock that ticks virtual time.
o Virtual time itself is a global, one-dimentional, temporary coordinate system
imposed on a distributed computation.
It is used to measure computational progress and to define synchronization.
It may or may not have a connection with real time.
These rules are exactly what Lamport's Clock Conditions (the well-known
Happens-Before relation).
o The major constraint on the implementation of virtual time can be stated: If an event
A causes event B, then the execution of A and B must be scheduled in real time so
that A is completed before B starts.
This implies that if A does not cause B, B could be executed before A in real time,
even if the logical time of B is after that of A.
The virtual address space of a page is its spatial coordinate; the virtual time
of an event is its temporal coordinate.
The only acceptable memory maps are the one-to-one functions because
they preserve distinctness, mapping distinct virtual addresses (pages) to
distinct real addresses (frames). At any given moment, some virtual
addresses may be unmapped because they refer to pages not in memory.
Similarily, the only acceptable time maps are the strictly increasing function
because they preserve order, mapping distinct virtual times into disctinct
real times. At any given place, some events may be unmapped (not yet
scheduled) because they are in the local future.
For a process running under virtual memory, the page fault rate can usually
be reduced by increasing the number of pages it is permitted to have in main
memory. Similarly the time fault rate of a process running under a virtual
time can usually be reduced by increasing the number of events that are in
its near future. Essentially, more interaction among LPs reduces the chances
of time fault. But it may slow down the simulation progress.
If a process can have enough pages in memory, its page fault rate can be
reduced to zero; in general, this is undesirable because it leads to inefficient
use of main memory. Similarily, if a process has sufficiently large number
of events to process in a short period of time, its time fault rate can be
reduced to zero; this too is undesirable because this process then becomes
bottleneck, holding back the progress of GVT, leading to inefficient use of
real time (other processes have to wait).
o Interleaved state saving (How often?) Instead of saving every single input/output
events, interleaved state saving strategy only saves a snap shot of the state at certain
time. When a rollback is needed, the simulation is rolled back to the point where
the state is saved.
o Fossil collection: events that have a clock value smaller than GVT will never be
used again, removing them can recover some memory
lazy: don't collect until running our memory
aggressive: collect at a fixed interval or upon a certain event
o Return un-processed messages
When memory is running low, one can return un-processed input events back to the
sender to free up some memory. The ones with highest time stamps should be
returned first because they are less likely to have effects on the system.
Communications in PDES
o Communication overhead
o Difference between parallel simulation (shared physical memory) and distributed
simulation (message passing)
o In distributed simulation: less communication would reduce total delay, may cause
more rollback
o The relative value counts: i.e. the ratio of computing time vs. communication time
Performance models:
o Chen's work: unify the performance model for memory effect on message
distribution, rollback, GVT advances in shared memory environment using a
Markov's process model
o Gupta, Akyildiz, and Fujimoto: performance model for homogeneous and
heterogeneous multiprocessor, shared memory environment
o Kleinrock and Nicol have separately developed some bounds for the performance
of Time Warp system
o Lubachevsky, Weiss and Shwartz's work: the average time to complete the
simulation of a system with N nodes and R events on a p-processor PRAM satisfies
References
In this chapter, we discuss some of the most commonly used statistical models.
Motivation:
o So far we used only the uniformly distributed random numbers. They only fit a
fraction of the real applications.
o We need other kind of statistical models to describe various types of applications.
o These models can be used in other situations than simulation. But we discuss them
in the context of simulation.
There are two major categories of random numbers: Discrete and Continuous.
1. Bernoulli distribution
2. Binomial distribution
3. Geometric distribution
4. Poisson distribution
Note that here we discuss random variables that are discretely or contineously distributed.
This doesn't have a direct connection to discrete simulation vs. contineous simulation
where the concept is how the simulation clock is ticked.
We will talk about some of the basics of probabilities first. Then we will discuss various
distributions. Then we will study the Poisson process, a very important, yet relatively
simple distribution.
Subsections
Random variable: A variable that assumes values in a irregular pattern (or no particular
pattern).
Discrete random variables: Let X be a random variable. If the number of possible values
of X is finite, or countably infinite, X is called a discrete random variable.
1. for all .
2.
The function is called the probability density function (pdf) of the random
variable , which has to meet the following condition.
1. for all .
2. .
3. if is not in .
by , measures the probability that the random variable assumes a value less than
or equal to , .
o If is discrete, then
o If is contineous, the
4. .
5. .
1. Queueing system. This is one of the most often used models. We will study queueing
system in great detail later. Queueing system can have a lot of variations that can be used
to model many real life situation. We have seen a few examples in earlier chapters.
Queueing systems often include random variables such as service time at various server(s);
inter-arrival time for various customer streams; routing distribution of customers.
Example 6.8, 6.9 on page 193. Emphasize on the case where empirical data can produce
histogram which shows the trend, often close to a mathematical model.
2. Inventory system. This is another model used to simulation storage problems, inventory
problems. A typical inventory has three random variables: the number of units demanded
per order or per time period; the time between demands; the lead time.
3. Reliability and maintainability. Time to failure of a component, of a system.
4. Limited data. When complete data is not avaiable, three distributions can be used to model
the system, uniform, triangular, and beta distribution.
5. Other distributions. A few other distributions can be used to model systems that are not
covered above: Bernoulli and binomial distributions are for discrete system;
hyperexponential may be useful in other instances.
success, if it is a failure.
o A consecutive Bernoulli trails are called a Bernoulli process if
the trails are independent of each other;
each trail has only two possible outcomes (success or failure, true or false,
etc.); and
the probability of a success remains constant
o The following relations hold.
o Note that the "location" of the s don't matter. It is the count of s that is
important.
o Examples of Bernoulli trails include: a conscutive throwing of a "fair" coin,
counting heads and tails; a pass or fail test on a sequence of a particular components
of the "same" quality; and others of the similar type.
o For one trial, the distribution above is called the Bernoulli distribution. The mean
and the variance is as follows.
2. Binomial distribution.
o The number of successes in Bernoulli trials is a random variable, .
o What is the probability that out of trials are success?
o There are
Continuous Distributions
Continuous random variables can be used to describe phenomena where the values of a random
variable can be any value in an interval: the time to failure, or the length of a broken rod. Seven
distributions will be discussed.
1. Uniform distributin.
o pdf:
o cdf:
o mean:
o variance:
o the interval where can assume value can be arbitrarily long, but it cannot be infinite.
o Example 6.15 and 6.16 on page 202, 203
o cdf
o mean
o variance
1.
o memoryless property of the exponential distributed random variables: the future
values of the exponentially distributed values are not affected by the past values.
Compare this to, for example, a uniformly distributed random variable, one can see
the difference. For example, when throwing a fair coin, we can consider the
probability of head and tail is the same which has the value of 0.5. If, after a result
of head, we would expect to see a tail (though it may not happen). In exponentially
distributed random variable, we cannot have this type of expectation. In another
word, we know nothing about the future value of the random variable given a full
history of the past.
Mathematical proof.
o Example 6.17 and 6.18 on page 204 and 205 where Example 6.18 demonstrates the
memoryless property of the exponential distribution.
2. Gamma distribution.
o pdf
o variance
3. Erlang distribution.
o mean
o variance
4. Normal distribution.
o pdf
o cdf
o mean
o variance
o Notation:
o The curve shape of the normal pdf is like a "bell".
o properties:
and
this, .
the maximum value of the pdf occurs at (thus, the mean and the
mode are equal.
o Example 6.21 and 6.22 on page 211, 6.23 and 6.24 on page 213.
5. Weibull distribution. The random variable has a Weibull distribution if its pdf has the
form
customers
servers
network of queues
Subsections
Characteristics
Queue Bahavior and Queue Discipline
Service Time and Service Mechanisms
Queueing Notation
Long Term Measures of Performance of Queueing Systems
Markov Models and Its Evaluation
CHARACTERISTICS
Calling population:
The population of potential customers is refered to as the calling population. Use examples
from Table 7.1
System capacity:
the maximum number of customers allowed in the system is called the system capacity.
Examples:
Telephone booth: capacity is one. When the server is busy (the booth occupied),
the incoming customer is turned away.
A typical TCP/IP packet buffer has a limit of 4096 bytes.
The number of simultaneous connections allowed at a web server usually is a fixed
constant.
o Define runtime of a given customer as the length of the time from departure
from the queueing system until the customer's next arrival to the queue.
Runtime essentially is the time when the customer is being serviced.
The arrival rate in a finite population model is a function of the number of pending
customers.
Queueing Notation
A few notes:
A few special notations: M for exponential distribution, G for general distribution, D for
constant.
When the queueing capacity or the calling population size, or both are infinite, they can be
omitted from the notation, e.g. M/M/1 meaning expoential distribution for arrival and
service time with one server, the queueing capacity and the calling population size are both
infinite.
intuitively, it says the queue length is proportional to the arrival rate and the waiting time.
Waiting time is affected by two parameters the arrival rate and the service rate.
In a queueing system, if the service time and inter-arrival time are both expoentially distributed,
denoted by and respectively plus
then we can evaluate the queueing system using the so called Markov Model.
Let represent the probability the system has i customers (including the ones in queue and ones
in server).
Using the principle that the flow into a state is balanced by the flow out of the state, we have
...
we have
thus
where
so
The meaning of the probability with no customer in the system is the same as the server is idle. So
the measure can be considered as the probability that the server is busy, which is the utilization
Random numbers play a key role in discrete event simulation. We have used the uniformly
distributed random numbers in many programming assignments before simulation. In simulation,
we need random numbers with other distribution besides the uniformly distributed one.
Subsections
o expectation
o variance
In computer simulation, we often do not want to have pure random numbers because we
would like to have the control of the random numbers so that the experiment can be
repeated.
In general, a systematic way to generate pseudo-random number is used to generate the
random numbers used in simulation. Some algorithms are needed.
We generate the uniformly distributed random numbers first; then we use this to generate
random numbers of other distribution.
Some desired properties of pseudo-random number generators:
o The routine should be fast.
o The routine should be portable across hardware platforms and programming
languages.
o The routine should have sufficiently long cycle.
A cycle length represents the length of the random number sequence before
previous numbers begin to repeat themselves in an earlier order. For
example
4,9,5,6,9,3,8, 4,9,5,6,9,3,8, 4,9,5,6,9,3,8, ...
Many different methods of generating pseudo-random numbers are available. This text introduces
two of them, with one in great detail.
Subsections
The selection of a, c, m and drastically affects the statistical properties such as mean
and variance, and the cycle length.
When , the form is called the mixed congruential method; When c = 0, the form is
known as the multiplicative congruential method.
Example 8.1 on page 292
Issues to consider:
o The numbers generated from the example can only assume values from the set I =
{0, 1/m, 2/m, ..., (m-1)/m}. If m is very large, it is of less problem. Values
by or where k is an integer.
Examples 8.2, 8.3 and 8.4 on page 294 and page 295.
By combining two or more multiplicative congruential generators may increase the length of the
period and results in other better statistics. See Example 8.5 on page 297.
TESTS FOR RANDOM NUMBERS
When a random number generator is devised, one needs to test its property. The two properties we
are concerned most are uniformity and independence. A list of tests will be discussed. The first
one tests for uniformity and the second to fifth ones test independence.
1. Frequency test
2. Runs test
3. Auto correlation test
4. Gap test
5. Poker test
The algorithms of testing a random number generator are based on some statistics theory, i.e.
testing the hypotheses. The basic ideas are the following, using testing of uniformity as an example.
We have two hypotheses, one says the random number generator is indeed uniformly distributed.
We call this , known in statistics as null hypothesis. The other hypothesis says the random
number generator is not uniformly distributed. We call this , known in statistics as alternative
hypothesis.
To see why we don't say accept H null, let's ask this question: what does it mean if we had
said accepting H null? That would have meant the distribution is truely uniform. But this is
impossible to state, without exhaustive test of a real random generator with infinite number of
cases. So we can only say failure to reject H null, which means no evidence of non-uniformity has
been detected on the basis of the test. This can be described by the saying ``so far so good''.
On the other hand, if we have found evidence that the random number generator is not uniform,
we can simply say reject H null.
It is always possible that the is true, but we rejected it because a sample landed in
the region, leading us to reject . This is known as Type I error. Similarily if is false,
but we didn't reject it, this also results in an error, known as Type II error.
With these information, how do we state the result of a test? (How to perform the test will be the
subject of next a few sections)
Decreasing the probability of Type I error will increase the probability of Type II error.
We should try to strike a balance.
For a given set of random numbers produced by a random number generator, the more tests are,
the more accurate the results will be.
Frequency test
This test compares the cdf of uniform distribution F(x) to the empirical cdf of the sample
of N observations.
3. Compute
4. Determine the critical value, , from Table A.8 for the specified
significance level and the given sample size N.
5. If the sample statistic D is greater than the critical value , the null
hypothsis that the sample data is from a uniform distribution is rejected;
Chi-Square test
The chi-square test looks at the issue from the same angle but uses different method. Instead of
measure the difference of each point between the samples and the true distribution, chi-square
checks the ``deviation'' from the ``expected'' value.
where n is the number of classes (e.g. intervals), is the number of samples obseved in
the interval, is expected number of samples in the interval. If the sample size is N, in a
uniform distribution,
See Example 8.7 on page 302.
Runs Tests
The runs test examines the arrangement of numbers in a sequence to test the hypothesis of
independence.
See the tables on page 303. With a closer look, the numbers in the first table go from small
to large with certain pattern. Though these numbers will pass the uniform tests in previous
section, they are not quite independent.
A run is defined as a succession of similar events proceded and followed by a different
event.
HTTHHTTTHT
The first toss is proceded and the last toss is followed by a "no event". This sequence has
six runs, first with a length of one, second and third with length two, fourth length three,
fifth and sixth length one.
that is
The previous test for up runs and down runs are important. But they are not adquate to
assure that the sequence is random.
Check the sequence of numbers at the top of page 306, where they pass the runs up and
down test. But it display the phenomenon that the first 20 numbers are above the mean,
while the last 20 are below the mean.
Let and be the number of individual observations above and below the mean,
let b the total number of runs.
For a given and , the mean and variance of b can be expressed as
and
If the same pattern continues, two numbers below average, two numbers above average, it
is unlikely a random number sequence. But this sequence will pass other tests.
Let be the number of runs of length i in a sequence of N numbers. E.g. if the above
sequence stopped at 12 numbers (N = 12),
then and
Obviously is a random variable. Among various runs, the expected value for runs up
and down is given by
and
The number of runs above and below the mean, also random variables, the expected value
of is approximated by
where E(I) the approximate expected length of a run and is the approximate probability of
length .
is given by
E(I) is given by
The approximate expected total number of runs (of all length) in a sequence of length N is
given by
(total number divided by expected run length).
The appropriate test is the chi-square test with being the observed number of runs of
length i
where L = N - 1 for runs up and down, L = N for runs above and belown the mean.
See Example 8.10 on page 308 for length of runs up and down.
See Example 8.11 on page 311 for length of above and below the mean.
The tests for auto-correlation are concerned with the dependence between numbers in a
sequence.
The list of the 30 numbers on page 311 appears to have the effect that every 5th number
has a very large value. If this is a regular pattern, we can't really say the sequence is random.
The test computes the auto-correlation between every m numbers (m is also known as the
lag) starting with the ith number.
E.g. N = 17, i = 3, m = 4, then the above sequence would be 3, 7, 11, 15 (M = 2). The
reason we require M+1 instead of M is that we need to have at least two numbers to test
(M = 0) the autocorrelation.
and
After computing , do not reject the null hypothesis of independence if
Gap Test
The gap test is used to determine the significance of the interval between recurrence of the
same digit.
A gap of length x occurs between the recurrence of some digit.
See the example on page 313 where the digit 3 is underlined. There are a total of eighteen
3's in the list. Thus only 17 gaps can occur.
The probability of a particular gap length can be determined by a Bernoulli trail.
Step 1. Specify the cdf for the theoretical frequency distribution given by Equation (8.14)
based on the selected class interval width (See Table 8.6 for an example).
Step 2. Arrange the observed sample of gaps in a cumulative distribution with these same
classes.
Step 3. Find D, the maximum deviation between F(x) and as in Equation 8.3 (on
page 299).
Step 4. Determine the critical value, , from Table A.8 for the specified value of and
the sample size .
Step 5. If the calculated value of D is greater than the tabulated value of , the null
hypothesis of independence is rejected.
Poker Test
The poker test for independence is based on the frequency in which certain digits are
repeated in a series of numbers.
For example 0.255, 0.577, 0.331, 0.414, 0.828, 0.909, 0.303, 0.001... In each case, a pair
of like digits appears in the number.
In a three digit number, there are only three possibilities.
1. The individual digits can be all different. Case 1.
2. The individual digits can all be the same. Case 2.
3. There can be one pair of like digits. Case 3.
P(case 1) = P(second differ from the first) * P(third differ from the first and second) = 0.9
* 0.8 = 0.72
P(case 2) = P(second the same as the first) * P(third same as the first) = 0.1 * 0.1 = 0.01
P(case 3) = 1 - 0.72 - 0.01 = 0.27
Now that we have learned how to generate a uniformly distributed random variable, we will study
how to produce random variables of other distribution using the uniformly distributed random
variable.
The techniques discussed include inverse transform and convolution. Also discussed is the
acceptance-rejection technique.
All work here assume the existence of a source of uniform (0,1) random numbers,
cdf
The inverse transform technique can be used to sample from exponential, the uniform, the
Weibull and the triangle distributions.
The basic principle is to find the inverse function of F, such
that .
Exponential Distribution
pdf
cdf
Step 1.
Compute the cdf of the desired random variable .
Step 2.
Set R = F(X) on the range of .
Step 3.
Solve the equation F(X) = R for in terms of .
Generate (as needed) uniform random numbers and compute the desired
random variates by
In practice, since both AND are uniformly distributed random number, so the
calculation can be simplified as
and
Because is equivelant to , and is a non-decreasing function (so
This means
which means
This says the is the cdf for and has the desired distribution.
Once we have this procedure established, we can proceed to solve other similar distribution for
which a inverse function is relatively easy to obtain and has a closed formula.
Uniform Distribution
If we follow the steps outlined in previous section, we get the same result.
pdf for X
steps:
Step 1.
the cdf
Step 2.
Set
Step 3.
Solve for is terms of yields
which is the same as the earlier guess.
Step 4.
Weibull Distribution
Steps:
Step 1.
cdf
for
Step 2.
let
Step 3.
Solve for in terms of yields
Step 4.
Generate uniformly distributed from (0,1) feeding them to the function in Step 3 to
get .
Triangular Distribution
cdf
Steps
Step 1.
cdf
Step 2.
let and
Step 3.
Solve in terms of
Empirical Continuous Distributions
If the modeler has been unable to find a theoretical distribution that provides a good model
for the input data, it may be necessary to use the empirical distribution of the data.
A typical way of resolving this difficult is through ``curve fitting''.
Steps involved: (see Exmaple 9.2 on page 328)
o Collect empirical data and group them accordingly.
o Tabulate the frequency and cumulative frequency.
o Now assume the value of cumulative frequency as a function of the empirical data,
i.e. F(x) = r
o Establish a relation between x and r using linear interpolation
Example 9.3 on page 332: note that in this example, five response time are used which are
all distinct. If there are values are the same, or if the number of samples are large, we can
certainly group them in the different ways.
Many continuous distributions don't have a closed-form inverse function. Strictly speaking,
the inverse transform method discussed earlier cannot be applied.
If we are willing to accept numeric solution, inverse functions can be found. Here we have
an example for normal distribution.
One of the inverse cdf of the standard normal distribution was proposed by Schmeiser:
for which matches the true normal distribution with one
digit after decimal point. See Table 9.6 on page 335.
Discrete Distribution
All discrete distributions can be generated using the inverse transform technique.
This section discusses the case of empirical distribution, (discrete) uniform distribution,
and geometric distribution.
Empirical discrete distribution. The idea is to collect and group the data, then develop the
pdf and cdf. Use this information to obtain so that will be the random
number function that we look for.
o cdf
o Let F(X) = R
o Solve X in terms of R. Since x is discrete,
thus,
Consider the fact that i and k are integers and R is between (0,1). For the above
relation to hold, we need
Example 9.6 on page 339 gives us another flavor. When an inverse function has more
than one solution, one has to choose which one to use. In the example, one results in
positive value and the other results in negative value. The choice is obvious.
Example 9.7 on page 340: Geometric distribution.
o pmf
where
o cdf
o Let R = F(x), solve for x in term of R. Because this is a discrete random variate, use
the inequality (9.12) on page 337,
that is
Notice that
The item in the ceiling function before subtracting one is the function to generate
exponentially distributed variate.
In the previous section, a simple, but less accurate method of generating a normal distribution was
presented. Here we consider a direct transormation.
Convolution Method
The probability distribution of a sum of two or more independent random variables is called
a convolution of the distributions of the original variables.
Erlang distribution.
o an Erlang random variable X with parameters can be shown to be the sum
mean
o Using equation (9.3) that can generate exponential variable, an Erlang variate can
be generated by
Example: use following steps to generate uniformly distributed random numbers between
1/4 and 1.
Step 3. If another uniform random variate on [1/4, 1] is needed, repeat the procedure
begining at Step 1. Otherwise stop.
o The efficiency: use this method in this particular example, the rejection probability
is 1/4 on the average for each number generated. The number of rejections is a
geometrically distributed random variable with probability of ``success'' being p =
3/4, mean number of rejections is (1/p - 1) = 4/3 - 1 = 1/3 (i.e. 1/3 waste).
o For this reason, the inverse transform (X = 1/4 + (3/4) R) is more efficient method.
Poisson Distribution
o pmf
if and only if
essentially this means if there are n arrivals in one unit time, the sum of interarrival
time of the past n observations has to be less than or equal to one, but if one more
interarrival time is added, it is greater then one (unit time).
o The s in the relation can be generated from uniformly distributed random
number , thus
that is
Step 1.
Set n = 0, P = 1.
Step 2.
If , then accept N = n, meaning at this time unit, there are n arrivals. Otherwise,
reject the current n, increase n by one, return to Step 2.
Collect and analyze input data so that the simulation can be fed with appropriate data. This is a
very important task. Without proper input data, the good simulation model won't generate correct,
appropriate result.
Subsections
Goodness-of-Fit Tests
Subsections
Histograms
Selecting the Family of Distribution
Quantile-Quantile Plots
Parameter Estimation
Histograms
There are many different distributions that may fit into a specific simulation task. Though
exponential, normal and Poisson distributions are the ones used most often, others such as gamma
and Weibull distributions are useful and important as well.
Binomial: Models the number of successes in n trials, when the trials are independent with
common success probability, p.
Negative Binomial including the geometric distribution: Models the number of trials required
to achieve k successes.
Poisson: Models the number of independent events that occur in a fixed amount of time or space.
Normal: Models the distribution of a process that can be thought of as the sum of a number of
component processes.
Log-normal: Models the distribution of a process that can be thought of as the product of a number
of component processes.
Exponential: Models the time between independent events, or a process time which is
memoryless.
Gamma: An extremely flexible distribution used to model non-negative random variables.
Beta: An extremely flexible distribution used to model bounded random variables.
Erlang: Models processes that can be viewed as the sum of several exponentially distributed
processes.
Weibull: Models the time-to-failure for components.
Discrete or Continuous Uniform: Models complete uncertainty, since all outcomes are equally
likely.
Triangular: Models a process when only the minimum, most-likely, and maximum values of the
distribution are known.
Empirical: Resamples from the actual data collected.
Quantile-Quantile Plots
If X is a random variable with cdf F, then the q-quantile of X is the value such
that for .
When has an inverse, we write
Now we discuss how to use Q-Q plots to draw distributions.
where F is the distribution function under the consideration that fits the samples.
o Plot against . If the distribution fits, the line would form a straight
line. Use the measurement of deviation to decide whether or not the set of samples
fit the distribution function.
Example 10.4 on page 365.
Parameter Estimation
After a family of distribution has been selected such as Poisson, Normal, Geometric ..., the
next step is to estimate the parameters of the distribution.
Sample mean and sample variance can be used to estimate the parameters in a distribution.
and
where is the observed frequency in the jth class interval, is the midpoint of
the jth interval, and c is the number of class intervals.
Goodness-of-Fit Tests
Earlier we introduced hypothesis test to examine the quality of random number generators.
Now we will apply these tests to hypothesis about distributional forms of input data.
Goodness-of-fit tests provide helpful guidance for evaluating the suitability of a potential
input model.
The tests depends heavily on the amount of data. If very little data are available, the test is
unlikely to reject any candidate distribution (because not enough evidence to reject); if a
lot of data are available, the test will likely reject all candidate distributions (because none
fits perfectly).
Failing to reject a candidate should be viewed as a piece of evidence in favor of that choice;
while rejecting an input model is only one piece of evidence against the choice.
Chi-square test is for large sample sizes, for both discrete and continuous distributional
assumptions, when parameters are estimated by maximum likelihood.
o Arranging the n observations into a set of k class intervals or cells.
o The test statistic
where is the observed frequency in the ith class interval and is the expected
frequency in that class interval.
the random variable, X, conforms to the distributional assumption with the parameter(s)
given by the parameter estimate(s)
if .
o The choice of k, the number of class intervals, see Table 10.5 on page 377.
o Example 10.13 on page 377.
Chi-square test with equal probabilities:
o If a continuous distributional assumption is being tested, class intervals that are
equal in probability rather than equal in width of interval should be used.
o Example 10.14: Chi-square test for exponential distribution (page 379)
Let k = 8, thus
The end points for each interval are computed from the cdf for the
exponential distribution
thus
Chi-square test heavily depends on the class intervals. For the same data,
different grouping of the data may result in different conclusion, rejection
or acceptance.
The K-S goodness-of-fit test is designed to overcome this difficulty. The
idea of K-S test is from q-q plot.
The K-S test is particularly useful when sample size are small and when no
parameters have been estimated from the data.
Example 10.7 on page 383, using the method described in Section 8.4.1 on
page 299. A few notes:
So far, we have discussed how to run simulation, how to generate and test random number
generators, how to build input data models. This chapter discusses how one might verify and
validate a simulation model.
to produce a model that represents true system behavior close enough for the model to be
used as a substitute for the physical system
to increase to an accetable level of credibility of the model
Subsections
Steps involved
Observe the real system and the interaction among its various components, and collect data
on its behavior.
Construct a conceptual model - a collection of assumptions on the components and the
structure of the system, plus hypotheses on the values of model input parameters.
Translate the conceptual model into a computerized model.
Make sure the conceptual model is translated into a computerized model properly and
truthfully. Typically three intuitive mechanisms can be used.
1. Common sense
1. Have the computerized representation checked by someone other than its
developer.
2. Make a flow diagram which includes each logically possible action of a
system can take when an event occurs, and follow the model logic for each
action for each event type.
3. Closely examine the model output under a variety of settings of input
parameters.
4. Interactive Run Controller (IRC) or debugger is an essential component of
successful simulation model building, which allows the analysist or the
programmer to test the simulation program interactively.
5. If one is modeling certain queueing system, the simulation results can be
compared with theoretical results as upper or lower bound. For example, in
a queueing system, if the increase in arrival rate or service time does not
affect the queue length or waiting time, then something is suspicious.
2. Thourough documentation: by describing in detail what the simulation programmer
has done in design and implementing the program, one can often identify some
problems.
3. Trace: go through a few steps in an actual program to see if the behavior is
reasonable (Example 11.1 on page 404)
Verification of a simulation model is very similar in what a typical software product would
have to go through.
For a given program, while common sense verification is possible, strict verification of a
model is intractable, very much similar to the proof of correctness of a program.
Validation is a process of comparing the model and its behavior to the real system and its
behavior.
Calibration is the iterative process of comparing the model with real system, revising the
model if necessary, comparing again, until a model is accepted (validated).
Three-step approach in the validation process.
1. Build a model that has high face validity.
2. Validate model assumptions
3. Compare the model input-output transformations to corresponding input-output
transformation for the real system.
Face Validity
Validation of Model Assumptions
Validating Input-Output Transformations
Input-Output Validation: Using Historical Input Data
Face Validity
Build a ``reasonable model'' on its face to model users who are knowledgeable about the
real system being simulated.
Do some ``sanity check''
Validation of Model Assumptions
Model assumptions fall into two categories: structural assumptions and data assumptions.
Structural assumptions deal with such questions as how the system operates, what kind of
model should be used, queueing, inventory, reliability, and others.
Data assumtions: what kind of input data model is? What are the parameter values to the
input data model?
In the previous bank example and other places, we used some artificial data as input to a
simulation model.
An alternative is to use past data as input (historical input data). Sometimes this is
called trace-driven simulation.
To conduct a validation test using historical input data, it is important that all the input data
and all the system response data be collected during the same time period.
Example 11.3 (The Candy Factory)
o The Candy Factory has three machines, the Candy maker, the Candy packer, and
the Box maker.
o The three machines are connected by two conveyors.
o The machines have random break-down time.
o When a machine breaks down, it causes its incoming conveyors to be full and out-
going conveyors to be empty.
o The time-to-failure (operating time) and down-time of each machine is recorded.
For machine i
o The system responses: the production level , the number and the time of
o The differences between and can be used to build test statistics (in this case
the Student Test t) to see if the model is statistically the same as the real system.
o If there is only one set of input data, only one set of output can be obtained. The
result doesn't carry much statistical significance.
o If K sets of input data are available, K runs of tests can be conducted. See Table
11.6 for an example.
and
Subsections
Simualtion result is generated for a given input data. Essentially a model is an input/output
transformation.
Since the input variables are random variables, the output variables are random variables
as well, thus they are stochastic (probabilistic).
Example 12.1 (Able and Baker, revisited)
o Instead of a single run of simulation, four runs were conducted. The results are
shown in Table 12.1 on page 431.
observed utilization
o A terminating simulation is one that runs for some duration of time , where is
a specified event or set of events which stops the simulation.
o A steady-state simulation is a simulation whose objective is to study long-run, or
steady-state, behavior of a non-terminating system.
Examples of terminating simulation (Example 12.4 - 12.7) on pages 435-436.
Examples of steady-state simulation (Example 12.8 - 12.9) on page 437.
Consider a set of output values for the same measure (e.g. delays of n different runs,
or waiting times of n different runs). We want to have
Point Estimation
In general
In general
Interval Estimation
Valid interval estimation typically requires a method of estimating the variance of the point
estimator or .
It is desirable to have
This relation involves three parameters, estimator for mean, estimator for variance, and the
degree of freedom. How to determine these values?
o Estimator for mean is calculated as above as a point estimator
Estimator for the variance and for the degree of freedom has to consider two
separate cases
In this case,
If the simulation is long eough to have passed the transient phase, the output
Use independent replications, i.e. the simulation is repeated a total of R times, each run
using a different random number stream and independently chosen initial conditions.
The sample variance is essentially a measure of error. In statistics, we use its square root
as the standard error.
Example 12.10 on page 446 (The Able-Baker carhop problem, continued): calculate the
confidence interval for Able's utilization and average waiting time.
Example 12.11 on page 447: the more runs, the more accurate the result is.
Previous section discusses for a given set of replications to calcualte the confidence interval
and error. Sometimes we need to do the inverse, given a level of error and confidence, how
many replications are needed?
This says we need to run that many (R) replications to satisfy the error requirement.
Consider a single run of a simulation model whose purpose is to estimate a steady state,
or long run, characteristics of the system.
Subsections
There are several methods of reducing the point estimator bias which is caused by using artificial
and unrealistic initial conditions in a steady-state simulation.
1. Initialize the simulation in a state that is more representative of long-run conditions. E.g.
use a set of real data as initial condition.
2. Divide the simulation into two phases, warm-up phase and steady state phase. Data
collection doesn't start until the simulation passes the warm-up phase.
A set of 10 independent runs, each run was divided into 15 intervals. The data were listed
in Table 12.5 on page 453.
Typicall we calculate average within a run. Since the data collected in each run is most
likely autocorrelated, a different method is used to calculate the average across the runs.
Such averages are known as ensemble average.
Several issues:
1. Ensemble average will reveal a smoother and more precise trend as the number of
replications, R, is increased.
2. Ensemble average can be smoothered further by plotting a moving average. In a moving
average each plotted point is actually the average of several adjacent ensemble averages.
3. Cumulative averages become less variable as more data are averaged. Thus, it is expected
that the curve at left side (the starting of the simulation) of the plotting is less smooth than
the right side.
4. Simulation data, especially from queueing models, usually exhibits positive
autocorrelation. The more correlation present, the longer it takes for the average to
approach steady state.
5. In most simulation studies the analyst is interested in several measures such as queue
length, waiting time, utilization, etc. Different performance measures may approach stead
state at different rates. Thus it is important to examine each performance measure
individidually for initialization bias and use a deletion point that is adequate for all of them.
If initialization bias in the point estimator has been reduced to a negligible level, the method
of independent replications can be used to estimate point-estimator variability and to
construct a confidence interval.
If significant bias remains in the point estimator and a large number of replications are used
to reduce point estimator variability, the result confidence interval can be misleading.
o The bias is not affected by the number of replications R, but by deleting more data
1. The confidence interval shifts downward, reflecting the greater downward bias
In a steady-state simulation, a specified precision may be achieved either by increasing the number
Example 12.16 on page 462 shows an example of calculating R for a given precision.
Example 12.17 on page 463 shows an example of increasing for the given precision (recall