Está en la página 1de 7

IEGR 410: Discrete Event Simulation

Spring 2014
M. Salimian

Test 1: Time 100 Minutes


Name: ------------------------

1. (15 points) Generate as many U(0,1) random numbers that is possible using LCG
(m=27, a=4, c=11, and X0=19). What is the period of this LCG? What is the 1038017th
random number generated by this LCG starting from X1?

LCG ( 27, 4, 11, 19 )


a= 4
c = 11
m = 27
X 0 = 19
n Xn-1 Xn Un
0 19
1 19 6 0.222222
2 6 8 0.296296
3 8 16 0.592593
4 16 21 0.777778
5 21 14 0.518519
6 14 13 0.481481
7 13 9 0.333333
8 9 20 0.740741
9 20 10 0.37037
10 10 24 0.888889
11 24 26 0.962963
12 26 7 0.259259 P
13 7 12 0.444444 E
R
14 12 5 0.185185
I
15 5 4 0.148148 O
16 4 0 0 D
17 0 11 0.407407
18 11 1 0.037037
19 1 15 0.555556
20 15 17 0.62963
21 17 25 0.925926
22 25 3 0.111111
23 3 23 0.851852
24 23 22 0.814815
25 22 18 0.666667
26 18 2 0.074074
27 2 19 0.703704
28 19 6 0.222222
IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

The LCG is full-period (27). (14 points)


To find the 1038017th random number generated by the LCG we should consider how
many full periods are in 1038017.
1038017 = (38445)(27)+2
So the second value or 0.296296 is the answer. (1 point)

2. Select one of the two: (15 points)

Option 1: Generate one number from Poisson (4.86) using the following set of uniform
(0,1) numbers.

0.542 0.310 0.488 0.040 0.819 0.207 0.413 0.562 0.724 0.217

Poisson

1. Let , , and 0

a = e -4.86 = 0.00775 b=1 i=0

2. Generate , and replace by

U1 = 0.542 b = (1) (0.542) = 0.542

3. If , set . Otherwise, replace by .

b > a (0.542 > 0.00775) i = 0+1 = 1

4. Repeat Step 2

2. Generate , and replace by

U2 = 0.310 b = (0.310) (0.542) = 0.16802

3. If , set . Otherwise, replace by .

b > a (0.16802 > 0.00775) i = 1+1 = 2

4. Repeat Step 2

2. Generate , and replace by

U3 = 0.310 b = (0.488) (0.16802) = 0.081994


IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

3. If , set . Otherwise, replace by .

b > a (0.081994 > 0.00775) i = 2+1 = 3

4. Repeat Step 2

2. Generate , and replace by

U4 = 0.040 b = (0.040) (0.0.081994) = 0.00328

3. If , set . Otherwise, replace by .

b < a (0.00328 < 0.00775) X = i = 3

Option 2: Generate one number from LogNorm (6.09, 1.44) using the following set of
uniform (0,1) numbers.

0.489 0.267 0.580 0.037 0.830 0.142 0.475 0.802 0.510 0.392

Normal

1. Generate , as .

= 0.489, = 0.267

Let 2 , 2 , and let = V12 + V22

V1= - 0.022 V2 = - 0.466 = 0.21764

2. If go back to Step . Otherwise,

= 0.21764 < 1

Let , Z1 = , and Z2 = .

= 3.743417, Z1 = - 0.08236, Z2 = - 1.74443


IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

Z1 and Z2 are N( , ). To calculate their N (6.09,1.44) values use the


relationship Z = ( X - ) / , or X = + Z

XN1 = 5.991174 XN2 = 3.996681

Lognormal

1. Generate ~N
2. Set

XLN1 = e 5.991174 = 399.8837 XLN2 = e 3.996681 = 54.41726

(Note that only one random number was required)

3. (15 points) Generate one number from Gamma (1.49, 6.46) using the following set
of uniform (0,1) numbers.

0.409 0.762 0.280 0.137 0.530 0.042 0.475 0.802 0.510 0.392

Gamma ( , )
Case Two: > 1

1. Set , , , ,

a=0.710669 b=0.103706 q=2.897125 =4.5 d=2.504077

2. Generate and as

=0.409 =0.762

3. Let , , = U12.U2 , and

= -0.2616 = 1.147033 = 0.127468 = -1.80121


IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

4. If , set T and return. Otherwise, proceed to Step 5

= 0.129262 > 0 set T =1.147033

T ~ gamma( , ). Set T =(6.46)( 1.147033)=7.40983

4. (20 points). YCGWIII Burger is simulating the drive in orders of its special signature
burgers during lunch time hours. From the experience, historical data and
observations they have the following information: 20% of cars do not order the
burger, and the rest will order based on the number of passengers. Probability that
cars have between 1-5 passengers is given as 0.25, 0.37, 0.19, 0.12, and 0.07
respectively. Inter-arrival time is constant and of no consequence. Use the following
set of uniform (0,1) numbers below to simulate the system. How many total burger
orders were placed?

0.52 0.31 0.48 0.04 0.89 0.27 0.43 0.52 0.72 0.21

Problem involves generating random numbers from two separate discrete distributions.
The first one represents whether the car arriving will place burger order or not and the
second one representing if placing order then how many (or how many passengers are
in that car). We use inverse cdf method.

Car 1: Create u1=0.52 that from the first inverse cdf it produces an ordering car.

Number of Passengers in Car 1: Create u2=0.31 that from the second inverse cdf it
produces a two passenger car, so order two burgers.

Car 2: Create u1=0.48 that from the first inverse cdf it produces an ordering car.

Number of Passengers in Car 2: Create u2=0.04 that from the second inverse cdf it
produces a one passenger car, so order one burger.

Car 3: Create u1=0.89 that from the first inverse cdf it produces an ordering car.

Number of Passengers in Car 3: Create u2=0.27 that from the second inverse cdf it
produces a two passenger car, so order two burgers.

Car 4: Create u1=0.43 that from the first inverse cdf it produces an ordering car.

Number of Passengers in Car 3: Create u2=0.52 that from the second inverse cdf it
produces a two passenger car, so order two burgers.
IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

Car 5: Create u1=0.72 that from the first inverse cdf it produces an ordering car.

Number of Passengers in Car 3: Create u2=0.21 that from the second inverse cdf it
produces a one passenger car, so order one burger.

Total number of burgers ordered: 2+1+2+2+1=8


IEGR 410: Discrete Event Simulation
Spring 2014
M. Salimian

5. (15 points). Generate 1 random number from beta (3,2) using acceptance-rejection
method. Select the majorizing function to be triangular. Use the following U(0,1) values
if you need.

0.452 0.231 0.648 0.304 0.189 05.27 0.843 0.152 0.702 0.921

6. (20 points) Perform a hand simulation and plot the number of the people in system
versus time for a 1 server queue based on the following information and LIFO priority
rule is in effect. First customer arrive at time 4. Calculate the average number of people
in the system and average waiting time in the queue. Simulation time is 85 minutes.

Customer No. Inter-arrival Time Processing Time


(for the next customer)
1 3 9
2 5 8
3 4 5
4 6 7
5 5 6
6 7 1
7 4 8
8 3 10
9 8 7
10 9 8
11 2 7
12 6 5
13 10 8
14 15 7

También podría gustarte