8
Solutions Simulation 1 20.1-2) The weather can be considered a stochastic system, because it evolves in a probabilistic manner from one day to the next. Suppose for a certain location that this probabilistic evolution satisfies the following: The probability of rain tomorrow is 0.6 if it is raining today. The probability of its being clear tomorrow is 0.8 if it is clear today. a. Use the following uniform random numbers to simulate the evolution of the weather for 10 days, beginning the day after a clear day. b. Repeat using excel and the rand() function to perform the simulation. D ay U niform 1 0.6996 2 0.9617 3 0.6117 4 0.3948 5 0.7769 6 0.5750 7 0.6271 8 0.2017 9 0.7660 10 0.9918 2 . 0 } | { 8 . 0 } | { 4 . 0 } | { 6 . 0 } | { today clear tomorrow rain P today clear tomorrow clear P today rain tomorrow clear P today rain tomorrow rain P Use CDF above CDF W x Today Rain Clear Rain 0.0 -0.6 0.6 -1.0 Clear 0.0 -0.2 0.2 -1.0 W x Tom orrow D ay U niform LogicalIf 0 Clear 1 0.6996 Rain 2 0.9617 Clear 3 0.6117 Clear 4 0.3948 Clear 5 0.7769 Clear 6 0.5750 Clear 7 0.6271 Clear 8 0.2017 Clear 9 0.7660 Clear 10 0.9918 Rain

Solutions Simulation 1

  • Upload
    tynice

  • View
    21

  • Download
    0

Embed Size (px)

DESCRIPTION

Solutions Simulation 1. 20.1-2) The weather can be considered a stochastic system, because it evolves in a probabilistic manner from one day to the next. Suppose for a certain location that this probabilistic evolution satisfies the following: - PowerPoint PPT Presentation

Citation preview

Page 1: Solutions        Simulation                    1

Solutions Simulation 1

20.1-2) The weather can be considered a stochastic system, because it evolves in a probabilistic manner from one day to the next. Suppose for a certain location that this probabilistic evolution satisfies the following:

The probability of rain tomorrow is 0.6 if it is raining today. The probability of its being clear tomorrow is 0.8 if it is clear today.

a. Use the following uniform random numbers to simulate the evolution of the

weather for 10 days, beginning the day after a clear day.

b. Repeat using excel and the rand() function to perform the simulation. Day Uniform

1 0.69962 0.96173 0.61174 0.39485 0.77696 0.57507 0.62718 0.20179 0.7660

10 0.9918

2.0}|{

8.0}|{

4.0}|{

6.0}|{

todaycleartomorrowrainP

todaycleartomorrowclearP

todayraintomorrowclearP

todayraintomorrowrainP

Use CDF above

CDFWx Today Rain Clear

Rain 0.0 - 0.6 0.6 - 1.0Clear 0.0 - 0.2 0.2 - 1.0

Wx Tomorrow

Day Uniform Logical If 0 Clear 1 0.6996 Rain2 0.9617 Clear3 0.6117 Clear4 0.3948 Clear5 0.7769 Clear6 0.5750 Clear7 0.6271 Clear8 0.2017 Clear9 0.7660 Clear

10 0.9918 Rain

Page 2: Solutions        Simulation                    1

Solutions Simulation 1

20.1-2) Alternate Solution

Assume CDF for Rain, Clear is shown as below.

Day Uniform1 0.69962 0.96173 0.61174 0.39485 0.77696 0.57507 0.62718 0.20179 0.7660

10 0.9918

Weather CDF

0.0

0.2

0.4

0.6

0.8

1.0

Rain Clear

Weather Today

Pro

babi

lity

Tom

orro

w

Rain

Clear

CDFWx Today Rain Clear

Rain 0.0 - 0.6 0.6 - 1.0Clear 0.8 - 1.0 0.0 - .08

Wx Tomorrow

CDF built on condition

Day Uniform Logical If 0 Clear 1 0.6996 Clear2 0.9617 Clear3 0.6117 Clear4 0.3948 Clear5 0.7769 Clear6 0.5750 Clear7 0.6271 Clear8 0.2017 Clear9 0.7660 Clear

10 0.9918 Rain

Page 3: Solutions        Simulation                    1

Solutions Simulation 2

20.1-4) The William Graham Entertainment Co. will be opening a new box office where customers can come to make ticket purchases in advance for the many entertainment events being held in the area. Simulation is being used to analyze whether to have one or two clerks on duty at the box office. While simulating the beginning of a day at the box office, the first customer arrives 5 minutes after it opens and the interarrival times for the next four customers are 3 minutes, 1 minute, and 4 minutes. The service times are 8 minutes, 6 minutes, 2 minutes, 4 minutes, and 7 minutes.

a. Plot the no. of customers at the box office over time.

b. Estimate L, Lq, W, and Wq for this queueing system.

c. Repeat for two clerks.

Page 4: Solutions        Simulation                    1

Solutions Simulation 3

20.1-4) solution

M/M/1 Queue i Ui Ai Ti Ui Si1 -- 5.0 5.0 -- 8.02 -- 3.0 8.0 -- 6.03 -- 9.0 17.0 -- 2.04 -- 1.0 18.0 -- 4.05 -- 4.0 22.0 -- 7.0

Time of Start Depart Time in Time inPart No. Arrival Service Time Queue System

0 -- -- 0 -- --1 5.0 5.0 13.0 0.0 8.02 8.0 13.0 19.0 5.0 11.03 17.0 19.0 21.0 2.0 4.04 18.0 21.0 25.0 3.0 7.05 22.0 25.0 32.0 3.0 10.0

Avg = 2.600 8.000

Event Event BusyTime Part No. Type Q(t) S(t) B(t) Time

0 -- start 0 0 0 05.0 1 arrive 0 1 1 08.0 2 arrive 1 2 1 3.013.0 1 depart 0 1 1 5.017.0 3 arrive 1 2 1 4.018.0 4 arrive 2 3 1 1.019.0 2 depart 1 2 1 1.021.0 3 depart 0 1 1 2.022.0 5 arrive 1 2 1 1.025.0 4 depart 0 1 1 3.032.0 5 depart 0 0 0 7.0

Sum = 27.00.41 1.25 TimeAvg 0.844

a.) L = 1.25, Lq = 0.41,

Page 5: Solutions        Simulation                    1

20.1-4) solution

Number in Queue

0

3

0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0

Time

Q(t

)

Number in System

0

3

0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0

Time

S(t

)

Busy/Idle

0

2

0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0

Time

B(t

)

Page 6: Solutions        Simulation                    1

Solutions Simulation 5

20.3-1) Use the mixed congruential method to generate the following sequence of random numbers.

a. 10 one-digit integer numbers such that Xn+1 = (Xn + 3) modulo 10 and Xo = 2.

b. 8 integers (0-7) such that Xn+1 = (5Xn + 1) modulo 8 and Xo = 1.m = 8a = 5c = 1xo = 1n xn axn + c (axn + c)/m xn+1

0 1 6 0 61 6 31 3 72 7 36 4 43 4 21 2 54 5 26 3 25 2 11 1 36 3 16 2 07 0 1 0 18 1 6 0 69 6 31 3 710 7 36 4 4

m = 10a = 1c = 3xo = 2n xn axn + c (axn + c)/m xn+1

0 2 5 0 51 5 8 0 82 8 11 1 13 1 4 0 44 4 7 0 75 7 10 1 06 0 3 0 37 3 6 0 68 6 9 0 99 9 12 1 210 2 5 0 5

Page 7: Solutions        Simulation                    1

Solutions Simulation 6

20.3-1) Use the mixed congruential method to generate the following sequence of random numbers.

c. 5 two-digit integer numbers such that Xn+1 = (61Xn + 27) modulo 100 and Xo=10.

m = 100a = 61c = 27xo = 10n xn axn + c (axn + c)/m xn+1

0 10 637 6.37 371 37 2284 22.84 842 84 5151 51.51 513 51 3138 31.38 384 38 2345 23.45 455 45 2772 27.72 726 72 4419 44.19 197 19 1186 11.86 868 86 5273 52.73 739 73 4480 44.8 8010 80 4907 49.07 7

Page 8: Solutions        Simulation                    1

Solutions Simulation 7

20.4-11) Consider the following CDF.

1.0

0.8

.06

0.4

0.2

7 9 11 13

U1 = .2655 X1 = 9.2

U2 = .3472 X2 = 9.5

U3 = .0248 X3 = 7.0

U4 = .9205 X4 = 12.2

U5 = .6130 X5 = 10.5