Table Of ContentObject-Oriented Computer
Simulation of Discrete-Event
Systems
THE KLUWER INTERNATIONAL SERIES
ON DISCRETE EVENT DYNAMIC SYSTEMS
Series Editor
Yu-Chi Ho
Harvard University
TIMED PETRI NETS: Theory and Application
Jiacun Wang
ISBN: 0-7923-8270-6
GRADIENT ESTIMATION VIA PERTURBATION ANALYSIS
P. Glasserman
ISBN: 0-7923-9095-4
PERTURBATION ANALYSIS OF DISCRETE EVENT DYNAMIC SYSTEMS
Yu-Chi Ho and Xi-Ren Cao
ISBN: 0-7923-9174-8
PETRI NET SYNTHESIS FOR DISCRETE EVENT CONTROL OF
MANUFACTURING SYSTEMS
MengChu Zhou and Frank DiCesare
ISBN: 0-7923-9289-2
MODELING AND CONTROL OF LOGICAL DISCRETE EVENT SYSTEMS
Ratnesh Kumar and Vijay K. Garg
ISBN: 0-7923-9538-7
UNIFORM RANDOM NUMBERS: THEORY AND PRACTICE
Shu Tezuka
ISBN: 0-7923-9572-7
OPTIMIZATION OF STOCHASTIC MODELS: THE INTERFACE BETWEEN
SIMULATION AND OPTIMIZATION
Georg Ch. Pflug
ISBN: 0-7923-9780-0
CONDITIONAL MONTE CARLO: GRADIENT ESTIMATION AND
OPTIMIZATION APPLICATIONS
Michael FU and Jian-Qiang HU
ISBN: 0-7923-9873-4
SUPERVISORY CONTROL OF DISCRETE EVENT SYSTEMS USING PETRI
NETS
John O. Moody and Panos J. Antsaklis
ISBN: 0-7923-8199-8
Object-Oriented
Computer Simulation of
Discrete-Event Systems
Jerzy Tyszer
Poznan University of Technology, Poznan, Poland
SPRINGER SCIENCE+BUSINESS MEDIA, LLC
ISBN 978-1-4613-7287-5 ISBN 978-1-4615-5033-4 (eBook)
DOI 10.1007/978-1-4615-5033-4
Library of Congress Cataloging-in-Publication Data
A C.I.P. Catalogue record for this book is available
from the Library of Congress.
Copyright © 1999 by Springer Science+Business Media New York
Originally published by Kluwer Academic Publishers in 1999
Softcover reprint ofthe hardcover Ist edition 1999
All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system or transmitted in any form or by any means, mechanical, photo
copying, recording, or otherwise, without the prior written permission of the
publisher, Springer Science+Business Media, LLC.
Printed on acid-free paper.
To Dorota and Janusz
Contents
Preface xi
1 Getting started 1
1.1 Basic notions 2
1.2 Manual simulation 5
1.3 Activity scanning. 9
2 Event scheduling 17
2.1 Main paradigm · .... 18
2.2 ABC approach · .... 24
2.3 Events versus activities 25
3 Event lists 29
3.1 Doubly linked linear list 30
3.2 Indexed linear list 35
3.3 Henriksen's list · ... 39
3.4 Two-level indexed list 42
3.5 Heaps ......... 48
3.6 Splay trees ...... 52
3.7 Run-time efficiency of event scheduling. 58
4 Process interaction 65
4.1 Basic operations 66
4.2 Environment in C++ 68
4.3 Distributed simulation 77
4.3.1 Decomposition of a simulation 77
4.3.2 Conservative mechanisms ... 79
viii Contents
4.3.3 Optimistic mechanisms 83
5 Random number generators 87
5.1 Uniform random variables 88
5.2 Statistical tests ...... . 95
5.2.1 Chi-square test .. . 96
5.2.2 Kolmogorov-Smirnov test 97
5.2.3 Poker test . . . . ... . 98
5.2.4 Runs test ....... . 99
5.2.5 Coupon's collector test. 101
5.2.6 Gap test ........ . 101
5.2.7 Autocorrelation test .. 102
5.3 Non-uniform variate generation 103
5.3.1 Inverse transformation method 105
5.3.2 Convolution . . . . 107
5.3.3 Rejection method . 110
5.3.4 Further examples . 112
6 Design of simulation experiments 115
6.1 Validation of models 116
6.2 Analysis of variance 128
6.3 Linear regression . . 134
7 Collection and analysis of simulation results 139
7.1 Gathering of results ..... . 140
7.2 Transient phase characteristics 144
7.2.1 Estimation of mean .. 145
7.2.2 Estimation of variance. 147
7.3 Estimation of steady-state phase characteristics 148
7.3.1 Length of the transient period 148
7.3.2 Independent replications method 152
7.3.3 Method of batch means 156
7.3.4 Regenerative method. 158
7.4 Variance reduction methods 164
7.4.1 Control variables . . . 164
7.4.2 Antithetic variates .. 165
7.4.3 Common random number streams 168
8 Examples of simulation models 171
8.1 A simple preemptive system ........ . 172
8.2 A system with priorities and group servers. 178
8.3 Assembly line ................ . 185
Contents ix
8.4 Finite-population queuing model 191
8.5 Satellite communication system 196
9 Epilog 207
10 Exercises 213
A Probability distributions 237
A.l The standard normal distribution. 238
A.2 The Student's t distribution . 239
A.3 The chi-square distribution ... . 240
A.4 The F distribution ........ . 241
A.5 The Kolmogorov-Smirnov distribution 245
Bibliography 247
Index 255
Preface
A
few years ago, a friend of mine inherited a restaurant from a relative he
had never met. The restaurant was everything but a profitable institu
tion. Many potential customers were being notoriously turned away because
of insufficient number of tables and lack of waiters. Unfortunately, his vigor
ous decisions to rent extra space and hire new staff made the situation even
worse. After the changes, many tables were never taken, he kept paying more
to the building owner, and staff costs went higher. Furthermore, the inventory
level of many products he was ordering went too high, so when the products
validity expired, many of them had to be thrown away. At some point he ar
rived with a basic question: is it possible to avoid such a disastrous scenario
of running painful experiments until being declared bankrupt? This book is
about an alternative scenario he was looking for. It is going not only to answer
the last question positively by advocating computer simulation as a valuable
and safe investigation tool, but also it will demonstrate how to use simulation
to estimate quantities of interest based on data we can provide to computer
programs.
Simulation is the art and science of constructing models of systems for the
purpose of experimentation. In particular, computer simulation is a technique
used to imitate, on computers, systems exhibiting complex, time-dependent
behavior. These systems, often not subject to direct experimentation, cannot
be studied by any other reasonable means. Consequently, computer simula
tion is becoming the dominant technique in many human activities. Examples
include designing manufacturing facilities and evaluating their performance,
designing transportation systems and projecting their behavior under various
traffic loads, designing communication networks and testing protocols used to
operate these networks, and many others. Clearly these systems can be all
treated as collections of objects bound into a web of complex and stochastic
xii
relations. Consequently, building either prototypes to run "real experiments"
or actual systems based on rough approximations is not a feasible solution as
too expensive and too risky a venture. Before we go on to discuss simulation
as a remedy for the problems like those listed above, a few words concerning
existing texts are in order.
A careful review of many textbooks on simulation available on the market
indicates clearly that they often lack harmony between two main aspects: the
programming techniques relevant to simulation and the statistical methodol
ogy devoted to proper answering questions about systems being simulated. It
can be easily observed that most of these books concentrate either on simu
lation programming or statistical foundations of simulation at the expense of
modeling aspects. Consequently, the reader needs to refer to other books for
missing information, or is left with incomplete data. This often precludes op
timal design decisions and leads to inefficient implementations. In some cases
a customized simulation software is provided as a supplement to some of these
texts. Although usually easy to learn, it inherently deemphasizes the impor
tance of many distinct elements of simulation programming art, and eventually
creates a kind of a package-dependent rather than well-educated modeler.
The main purpose of this book is to offer a complete and fairly balanced
yet not overlength presentation of a wide repertoire of computer simulation
techniques available to the modelers of dynamic systems. It will guide the
reader through the maze of alternative therapies, solutions, rules, and issues
relevant to computer simulation. Eventually, it will also help the reader to be
come comfortable with creating computer simulation models and to appreciate
the powerfulness of this technique. This is achieved by covering all basic and
generic concepts used in computer simulation of discrete event systems in a
comprehensive, uniform and self-contained manner. In addition, the presenta
tion benefits from the object-oriented methodology which is used throughout
the book as its main programming platform. The reader is expected to have
only some programming experience in C++ and some background in the theory
of probability and statistics.
In the following chapters we will discuss a wide variety of paradigms, theo
retical concepts and practical scenarios concerned with design, programming,
and exploitation of discrete-event simulation models. We will show that even
the simplest techniques provide a very high potential for the integration of
their features into efficient and portable simulation packages. In Chapter 1
the basic definitions associated with the discrete event systems and their sim
ulation models are introduced. They are illustrated by means of an example
simulation model of automatic teller machines. The simulation experiment is
conducted here manually in order to demonstrate the concepts of simulation
clock and system state variables as well as time management methods and
event sequencing procedures. The chapter concludes with one of the simplest