CS457 - System Performance Evaluation - Winter 2008
Questions and Comments
- Tutorial: MC4045, Monday March 10, 18.00 to 19.00
Lecture 25
Text: chapter 28 & 29
Continuous Random Variables
2. Exponential distribution
Use for infinite populations that produce finite event rates.
- f(x) = \lambda exp(-\lambda*x)
- F(x) = 1 - exp(-\lambda*x)
- u = F(x)
exp(-\lambda*x) = 1 - u
x = -log(1-u) / \lambda = -log(u) / \lambda
But, remember that there is a special case! (u = 0)
5. Normal distribution
Use when you want to add noise
- f(x) = exp(-(x^2)/2*\sigma^2)
- No easy form for F(x).
- But, f(x,y) = exp(-(x^2 + y^2) / 2*\sigma) has a simple F(x,y), which I
won't work out.
- Thus, you choose two uniform variates, u1 & u2.
- And you get back two independent random numbers
- x1 = \sigma*cos(2\pi*u1)* sqrt(-2log(u2))
- x2 = \sigma*sin(2\pi*u1)* sqrt(-2log(u2))
Random Number Generators - Pseudo-random Numbers
Text: Chapters 26 & 27
What we want
- Computationally efficient
- Gives good sequences of numbers
- Long periods
- Reproduce previous sequences for debugging
Linear Congruential Generators
X(n) = ( aX(n-1) + b ) mod m
- a, b, m are constants
- The quality of the sequence depends strongly on the values chosen
for a, b & m.
- Period is a divisor of m
- X(0) is the seed
- u(i) = X(i) / m has the correct range.
How to get a full period - all possible values appear before repeating.
- GCD( m, b ) = 1
- Every prime factor of m is a factor of a-1.
- If 4 divides m the 4 must divide a-1
Choose m = 2^k for efficiency.
- Is this really true in 2008?
Testing Sequences of Random Numbers
Serial test
- Get adjacent pairs of numbers as points in a plane.
- Put them into bins: kxk.
- If sequence is uniform and random then P(point is in a given cell) =
1/k^2
- Use Kolmogorov test (or chi-square test) to check the distribution.
Gap test
- Choose an interval between zero and one, of length p
- Then P( U in interval ) = p
- Look at runs of points outside interval
- P( run of 0 ) = p
- P( run of 1 ) = p(1-p)
- etc.
This is a geometric distribution
Practical Issues
Two Phases of a Simulation
Transient
Steady State
Look for a "knee"
Testing Paired Samples
Text: Section 13.4.1
This is a technique for getting more significance from a given set of
runs. It requires that you design the experiment correctly.
Comparing two alternative configurations
- Create a complete design
- the two configurations crossed with all other relevant
variables
Pair trials that are the same in all respects, except for
configuration
Compute the differences in performance metric between the pairs.
Test it against zero using a T-test.
How Long Should a Simulation Run?
How many replications should there be?
- Perform n replications
- Discard data from transient phase
- Calculate performance metric
- Result is m values {y1, y2, ... , yn}, the sample
- Calculate mean, m, and variance, s, of sample
- x% confidence interval is m \pm T(n-1, x%) (s/n^(1/2))
- Select n for the real runs so that you are sure the confidence interval
will exclude zero.
Return to: