Computer Science, Informatik 4 Communication and Distributed Systems
Simulation
“Discrete-Event System Simulation”
- Dr. Mesut Güneş
Simulation Discrete-Event System Simulation Dr. Mesut Gne Computer - - PowerPoint PPT Presentation
Computer Science, Informatik 4 Communication and Distributed Systems Simulation Discrete-Event System Simulation Dr. Mesut Gne Computer Science, Informatik 4 Communication and Distributed Systems Chapter 5 Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems
Computer Science, Informatik 4 Communication and Distributed Systems
Computer Science, Informatik 4 Communication and Distributed Systems 3 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 4 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 5 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 6 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 7 Chapter 5. Random-Number Generation
1
+
i i
The multiplier The increment The modulus
i i
Computer Science, Informatik 4 Communication and Distributed Systems 8 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 9 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 10 Chapter 5. Random-Number Generation
private final static long multiplier = 0x5DEECE66DL; private final static long addend = 0xBL; private final static long mask = (1L << 48) - 1; protected int next(int bits) { long oldseed, nextseed; ...
nextseed = (oldseed * multiplier + addend) & mask; ... return (int)(nextseed >>> (48 - bits)); }
Computer Science, Informatik 4 Communication and Distributed Systems 11 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 12 Chapter 5. Random-Number Generation
1 1 , 1
= −
k j j i j i
1 1 1 i i i i
1 2 1
−
k k
The coefficient: Performs the subtraction Xi,1-1
Computer Science, Informatik 4 Communication and Distributed Systems 13 Chapter 5. Random-Number Generation
Step 1: Select seeds
Step 2: For each individual generator, X1,j+1 = 40,014 X1,j mod 2,147,483,563 X2,j+1 = 40,692 X1,j mod 2,147,483,399.
Xj+1 = (X1,j+1 - X2,j+1 ) mod 2,147,483,562.
+ + + +
1 1 1 1 j j j j
Computer Science, Informatik 4 Communication and Distributed Systems 14 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 15 Chapter 5. Random-Number Generation
b P i b i
) 1 (
−
Computer Science, Informatik 4 Communication and Distributed Systems 16 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 17 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 18 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 19 Chapter 5. Random-Number Generation
i i N
Computer Science, Informatik 4 Communication and Distributed Systems 20 Chapter 5. Random-Number Generation
≤ ≤ − ≤ ≤ +
i N i i N i
) ( 1 ) ( 1
Computer Science, Informatik 4 Communication and Distributed Systems 21 Chapter 5. Random-Number Generation
Arrange R(i) from smallest to largest D+ = max {i/N – R(i)} D- = max {R(i) - (i-1)/N} 5 4 3 2 1 i 0.13 0.21 0.04
R(i) – (i-1)/N 0.07
0.26 0.15 i/N – R(i) 1.00 0.80 0.60 0.40 0.20 i/N 0.93 0.81 0.44 0.14 0.05 R(i)
Computer Science, Informatik 4 Communication and Distributed Systems 22 Chapter 5. Random-Number Generation
=
n i i i i
1 2 2
n is the # of classes Oi is the observed # in the i-th class Ei is the expected # in the i-th class
Computer Science, Informatik 4 Communication and Distributed Systems 23 Chapter 5. Random-Number Generation
0.05,9=16.9
0=11.2 < X2 0.05,9
11.2 100 100 S 1.6 16 4 10 14 1.0 10 10 10 0.9 9 0.9 9
10 7 0.8 8 10 10 0.7 7 0.9 9 3 10 13 0.6 6 3.6 36 6 10 16 0.5 5 1.6 16
10 6 0.4 4 2.5 25
10 5 0.3 3 0.1 1
10 9 0.2 2 10 10 0.1 1 (Oi-Ei)^2/Ei (Oi-Ei)^2 Oi-Ei Ei Oi Upper Limit Interval
0=11.2
Computer Science, Informatik 4 Communication and Distributed Systems 24 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 25 Chapter 5. Random-Number Generation
im
1
im im
Computer Science, Informatik 4 Communication and Distributed Systems 26 Chapter 5. Random-Number Generation
im
im
ρ
ˆ
im
ρ M k )m (k i km i im
1
= + + +
Computer Science, Informatik 4 Communication and Distributed Systems 27 Chapter 5. Random-Number Generation
ˆ 35
35
ρ
Computer Science, Informatik 4 Communication and Distributed Systems 28 Chapter 5. Random-Number Generation
Computer Science, Informatik 4 Communication and Distributed Systems 29 Chapter 5. Random-Number Generation