Introduction to Discrete Event Simulation
Material from Fall 2016. A new version is being prepared for the Winter 2027 course.
Slides of the course IFT3245 Simulation et modèles, taught in Fall 2016 at the Department of Computer Science and Operations Research (DIRO) of the Université de Montréal, with Jupyter notebooks in Julia. The course covers discrete event simulation, random number generation, confidence intervals and efficiency improvement techniques.
The slides are in French, most notebooks in English.
Basic principles
- Course overview8 slides Objectives, basic concepts, model types, software, the choice of Julia.
- Discrete event simulation principles17 slides Simulation clock and event list, GI/G/1 queue, Lindley’s recurrence, process-based approach and SimJulia.
- Lindley’s recurrencenotebook · .ipynb Queue waiting times simulated without an event list.
- Process-based M/M/1 queuenotebook · .ipynb Simulation of an M/M/1 queue with SimJulia, using the process-based approach.
Random number generators
The page on pseudo-random number generators covers this chapter in a more recent version (PCG, Philox, copulas), with a web tutorial.
- Generation of U(0,1) random variables19 slides Linear congruential generators, the minimal standard, implementation by approximate factoring or powers of 2.
- MRG generators13 slides Multiple recursive generators, characteristic polynomial, multiple substreams and jumps between streams.
- Structure of MRGs22 slides Lattice structure, distance between hyperplanes, uniformity measures, the glibc random function.
- Combined MRG generators6 slides Combining MRGs, MRG32k3a.
- Generators over F₂22 slides Tausworthe (LFSR), GFSR and twisted GFSR, Mersenne Twister, LFSR113.
- Statistical tests of generators19 slides TestU01, collision, birthday spacings and autocorrelation tests, results for widely used generators.
- Generation of non-uniform variates17 slides Inversion (continuous and discrete cases), triangular and normal distributions, composition, convolution.
- Generation of non-uniform variates (continued)18 slides Acceptance-rejection, the Box-Muller method, uniform distribution on the sphere.
- On cumulative distribution functionsnotebook · .ipynb Cumulative distribution function, empirical distribution function, quantiles.
- Inverting the cumulative distribution functionnotebook · .ipynb The inversion technique for continuous distributions, with the exponential distribution.
Confidence intervals
- Confidence intervals27 slides · Julia code Efficiency of estimators, finite horizon, normal approximation, binomial and lifetime examples.
- Sequential approach11 slides Two-stage procedure, intervals for quantiles, value at risk.
- Bootstrap method17 slides Plug-in principle, nonparametric bootstrap and bootstrap-t, bias estimation.
- Confidence intervals for the M/M/1 queuenotebook · .ipynb Confidence intervals on the results of the process-based M/M/1 simulation.
- Initial bias reduction13 slides Detecting the initial bias, Welch’s heuristic, truncated horizon.
- Delta method12 slides Delta theorem, ratio of two expectations, difference between two means (paired observations, Welch’s method).
- M/M/1 and the delta methodnotebook · .ipynb Confidence interval on the average waiting time using the delta theorem.
- Interval from a single simulation12 slides Batch means, regenerative simulation, renewal reward theorem.
- M/M/1 and batch meansnotebook · .ipynb Confidence interval on the average waiting time using batch means.
Efficiency improvement
- Efficiency improvement: principles18 slides Introductory example, indirect estimation, control variate, stratification, combined strategies.
- Common random numbers13 slides Comparing two systems, synchronization, inducing correlation, Lindley process example.
- Control variates11 slides Choosing the coefficient β, types of control variates, estimating β* and its asymptotic properties, pilot runs.
- M/M/1: control variates and stratificationnotebook · .ipynb Both techniques applied to the M/M/1 queue.
- Antithetic variates10 slides General method, antithetic pairs, combination with common random numbers, stochastic activity network.
- M/M/1: common random numbers and antithetic variatesnotebook · .ipynb Both techniques applied to the process-based M/M/1 simulation.
- Quasi-Monte Carlo methods19 slides Effective dimension, lattices and digital nets, discrepancy, Koksma-Hlawka inequality, error estimation.
- Conditional Monte Carlo9 slides General framework, conditional estimator, stochastic activity network and bank examples.
Julia
The models are implemented in Julia; the Julia page offers an introduction to the language. The notebooks date from 2016 and were written for Julia 0.4 and 0.5, with SimJulia (now ConcurrentSim.jl) and the former RandomStreams package: they need some changes to run with Julia 1. Today, streams of random numbers come from RandomDataStreams.jl.
Introductory notebooks
- Introduction to queueing systemsnotebook · .ipynb Arrival process, service mechanism, queue discipline, Kendall’s notation, performance measures, Little’s law.
- Exponential distributionnotebook · .ipynb The exponential distribution with Distributions.jl, and the Poisson process.
- Parameterization of distributionsnotebook · .ipynb Rate and scale parameters in Distributions.jl (exponential, gamma… distributions).
- Multivariate normal distributionnotebook · .ipynb Positive definite matrices, Cholesky factorization, normal vectors with MvNormal.
- A first example with SimJulianotebook · .ipynb Basic concepts of process-based simulation, adapted from the SimJulia documentation.
Julia code
- Tally collectorJulia code Mean, minimum, maximum and variance of a sequence of observations.
- TallyStore collectorJulia code Like Tally, keeping the observations.
- M/M/1 queueJulia code Summary code for the M/M/1 queue simulation.
- Confidence intervalsJulia code Confidence interval from the normal approximation.