You are on page 1of 12

# Juan Pablo Tapia

24/10/2012
SIMULATION
HOMEWORK 2 CHAPTER 1
BASIC CONCEPTS OF SIMULATION

1. Consider the following continuously operating job shop. Interarrival times of jobs are distributed as
follows:
Tiempo entre arribos (horas)
0
1
2
3

0.23
0.37
0.28
0.12

Processing times for jobs are normally distributed, with mean 50 minutes and standard deviation 8
minutes. Construct a simulation table and perform a simulation for 10 new customers. Assume
that, when the simulation begins, there is one job being processed (scheduled to be completed in
25 minutes) and there is one job with a 50-minute processing time in the queue.
(a)
(b)
(c)

What was the average time in the queue for the 10 new jobs?
What was the average processing time of the 10 new jobs?
What was the maximum time in the system for the 10 new jobs?

## Distribution of time between arrivals

time between arrivals (min)
0
60
120
180

## probability cumulative probability

0,23
0,23
0,37
0,6
0,28
0,88
0,12
1

rand digits
1 n 23
24 n 60
61 n 88
89 n 100

Service time
X=Z((miu+sigma)-(miu-sigma)) + (miu
sigma)
X=Z(58-42) + 42
Customer
1
2
3
4
5
6
7
8
9
10

Rand number
0,336038725
0,798004489
0,17248066
0,192844259
0,027122267
0,83064456
0,6069438
0,542070991
0,841312738
0,398161296

Service time
47
56
51
52
50
57
55
54
57
53

Simulation table
arrival

interarrival arrival

customer rand#
time (min) time
A
given
unknown
0
B
given
unknown
0
1
0,50
60
60
2
0,60
60
120
3
0,66
120
240
4
0,11
0
240
5
0,31
60
300
6
0,92
180
480
7
0,84
120
600
8
0,55
60
660
9
0,48
60
720
10
0,23
0
720

service
time
25
50
47
56
51
52
50
57
55
54
57
53

service
start
time
0
25
75
122
240
291
343
480
600
660
720
777

time
spend
in
in queue end time system
0
25
25
25
75
75
15
122
62
2
178
58
0
291
51
51
343
103
43
393
93
0
537
57
0
655
55
0
714
54
0
777
57
57
830
110
time wait service

a) Average time in queue= sum of time in queue for all customers / number of customers =
168/10= 16,8 min

b) Average processing time= sum of service time for all customers / number of customers =
532/10= 53,2 min
c) Max time in the system = 110 min

2. Determine the best policy for ordering newspapers form Example 3 in the class material. Do the
simulation table for purchase of 60, 70, and 80 newspapers. Must you use the same random
numbers for each experiment (60, 70, and 80 newspapers)? Why YES or why NOT?

FIX
AMOU
NT

60

RAND
OM #
DAYS

DAY

1
2
3
4
5
6

51
50
81
47
55
71

27

8
9

13
73

10
11
12

18
0
40

13
14

12
82

15
16
17
18
19
20

13
63
52
59
85
82

TYPE
OF
DAY
S

FAIR
FAIR
POOR
FAIR
FAIR
FAIR
GOO
D
GOO
D
FAIR
GOO
D
POOR
FAIR
GOO
D
POOR
GOO
D
FAIR
FAIR
FAIR
POOR
POOR

TOTAL
FIX
AMOU
NT

74
73
56
45
30
21
37

70

30

2,55

0,00

7,65

91
22

90
50

30
25

3,23
3,91

0,00
0,50

6,97
1,79

61
37
86

80
40
70

30
20
30

11,39
0,00
8,84

0,00
1,00
0,00

-1,19
1,20
1,36

50
2

80
40

30
20

13,60
0,00

0,00
1,00

-3,40
1,20

96
56
95
19
19
14

100
60
90
60
40
40

30
30
30
30
20
20

14,96
0,00
13,09
0,00
0,00
0,00

0,00
0,00
0,00
0,00
1,00
1,00

545

75,48

5,5

-4,76
10,20
-2,89
10,20
1,20
1,20
79,0
2

70

RAND
OM #
DAYS

DAY

RAND
OM #
DEMA
ND

LOST
SALVAG
PROFI
E FROM
REVEN
T
SALE
DAIL
DEMA
UE
FROM
OF
Y
ND
FROM EXCES
RETUR GAIN
SALES
S
NED
DEMA
PAPERS
ND
70
30
1,70
0,00
8,50
70
30
0,00
0,00
10,20
50
25
0,00
0,50
5,70
60
30
1,70
0,00
8,50
60
30
0,00
0,00
10,20
50
25
0,51
0,50
5,19

TYPE
OF
DAY
S

51 FAIR

LOST
SALVAG
PROFI
E FROM
RAND
REVEN
T
SALE
DAIL
OM # DEMA
UE
FROM
OF
Y
DEMA
ND
FROM EXCES
RETUR GAIN
ND
SALES
S
NED
DEMA
PAPERS
ND
74
70
35
0,00
0,00
11,90

50
81
47
55
71

2
3
4
5
6

27

13

8
9

73
18

10
11
12

0
40
12

13
14

82
13

15
16
17
18
19
20

63
52
59
85
82

FAIR
POOR
FAIR
FAIR
FAIR
GOO
D
GOO
D
FAIR
GOO
D
POOR
FAIR
GOO
D
POOR
GOO
D
FAIR
FAIR
FAIR
POOR
POOR

73
56
45
30
21

70
50
60
60
50

37

70

91

90

22

50

61

80

37
86

40
70

50

80

40

96

100

56
95
19
19
14

60
90
60
40
40

TOTAL
FIX
AMOU
NT

1
2
3
4
5
6
7

0,00
0,00
1,70
0,00
0,51

0,00
1,00
0,50
0,50
1,00

11,90
2,90
5,70
7,40
2,39

35

2,55

0,00

9,35

35
25

3,23
3,91

0,00
1,00

8,67
-1,01

35
20
35

11,39
0,00
8,84

0,00
1,50
0,00

0,51
-1,60
3,06

35
20

13,60
0,00

0,00
1,50

-1,70
-1,60

35
30
35
30
20
20

14,96
0,00
13,09
0,00
0,00
0,00

0,00
0,50
0,00
0,50
1,50
1,50

590

73,78

11

-3,06
7,40
-1,19
7,40
-1,60
-1,60
65,2
2

80

RAND
OM #
DAYS

DAY

35
25
30
30
25

51
50
81
47
55
71

TYPE
OF
DAY
S

FAIR
FAIR
POOR
FAIR
FAIR
FAIR
GOO
27
D

RAND
OM #
DEMA
ND
74
73
56
45
30
21
37

LOST
SALVAG
PROFI
E FROM
REVEN
T
SALE
DAIL
DEMA
UE
FROM
OF
Y
ND
FROM EXCES
RETUR GAIN
SALES
S
NED
DEMA
PAPERS
ND
70
35
0,00
0,50
9,10
70
35
0,00
0,50
9,10
50
25
0,00
1,50
0,10
60
30
1,70
1,00
2,90
60
30
0,00
1,00
4,60
50
25
0,51
1,50
-0,41
70

35

2,55

0,50

6,55

8
9
10
11
12
13
14
15
16
17
18
19
20

13
73
18
0
40
12
82
13
63
52
59
85
82

GOO
D
FAIR
GOO
D
POOR
FAIR
GOO
D
POOR
GOO
D
FAIR
FAIR
FAIR
POOR
POOR

91

90

22

50

61

80

37
86

40
70

50

80

40

96

100

56
95
19
19
14

60
90
60
40
40

TOTAL

40
25

3,23
3,91

0,00
1,50

10,37
-3,81

40
20
35

11,39
0,00
8,84

0,00
2,00
0,50

2,21
-4,40
0,26

40
20

13,60
0,00

0,00
2,00

0,00
-4,40

40
30
40
30
20
20

14,96
0,00
13,09
0,00
0,00
0,00

0,00
1,00
0,00
1,00
2,00
2,00

615

73,78

18,5

-1,36
4,60
0,51
4,60
-4,40
-4,40
31,7
2

YES, I must have to use the same random numbers for this comparison to find out what would be the
gain of the month if the newspaper seller buys different amount of newspapers in the same conditions.

3. Smalltown Taxi operates one vehicle during the 9:00 A.M. to 5:00 P.M. period. Currently,
consideration is being given to the addition of a second vehicle to the fleet. The demand
for taxis follows the distribution shown:
Time Between Calls (Minutes)
Probability

15
0.14

20
0.22

25
0.43

Cumulat
Time
ive
Between
Probability
Probabil
Calls
(Hours)
ity
0,25
0,33
0,42
0,50
0,58

0,14
0,22
0,43
0,17
0,04

0,14
0,36
0,79
0,96
1

30
0.17

35
0.04

Rando
m
Digits
1 -- 14
15 -- 36
37 -- 79
80 -- 96
97 -- 00

## The distribution of time to complete a service is as follows:

Service Time (Minutes)
Probability

5
0.12

15
0.35

25
0.43

35
0.06

45
0.04

Service
Time
(Hours)

Cumulat
ive
Probability
Probabil
ity
0,12
0,12
0,35
0,47
0,43
0,90
0,06
0,96
0,04
1,00

Rando
m
Digits

1 -- 12
0,08
13 -- 47
0,25
48 -- 90
0,42
91 -- 96
0,58
97 -- 00
0,75
Simulate 1 individual days of operation of the current system and of the system with an additional
taxicab. Compare the two systems with respect to the waiting times of the customers and any other
measures that might help on the situation.
ONE
SERVER

SERVICE
TIME

INTERARRIVAL
CALLS

CUSTOME
R

RANDO
M#

INTERARRI
VAL TIME

TIME
CUSTO
MER
ARRIVE
S

TIME
SERVI
CE
STAR
TS

RAND
OM #

SERVI
CE
TIME

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

58
30
3
39
64
71
30
8
14
71
6
95
59
62
26
31
47
64
42
18
8
14
43

0,42
0,33
0,25
0,42
0,42
0,42
0,33
0,25
0,25
0,42
0,25
0,5
0,42
0,42
0,33
0,33
0,42
0,42
0,42
0,33
0,25
0,25
0,42

0,42
0,75
1
1,42
1,84
2,26
2,59
2,84
3,09
3,51
3,76
4,26
4,68
5,1
5,43
5,76
6,18
6,6
7,02
7,35
7,6
7,85
8,27

0,42
0,75
1,33
1,8
2,22
2,64
2,89
3,31
3,56
3,81
4,39
4,81
5,56
5,81
5,89
6,14
6,39
6,81
7,06
7,48
7,9
7,98
8,4

28
92
21
61
52
17
75
14
40
90
80
98
29
5
31
26
62
43
53
89
9
82
39

0,25
0,58
0,47
0,42
0,42
0,25
0,42
0,25
0,25
0,58
0,42
0,75
0,25
0,08
0,25
0,25
0,42
0,25
0,42
0,42
0,08
0,42
0,25

TIME
SERVI
CE
ENDS

0,67
1,33
1,8
2,22
2,64
2,89
3,31
3,56
3,81
4,39
4,81
5,56
5,81
5,89
6,14
6,39
6,81
7,06
7,48
7,9
7,98
8,4
8,65
TOT
AL
PRO
M

WAITIN
G TIME
FOR
CUSTO
MER

TIME
INSIDE
OF
SYSTE
M

IDLE
TIME
OF
SERV
ER

0
0
0,33
0,38
0,38
0,38
0,3
0,47
0,47
0,3
0,63
0,55
0,88
0,71
0,46
0,38
0,21
0,21
0,04
0,13
0,3
0,13
0,13

0,25
0,58
0,8
0,8
0,8
0,63
0,72
0,72
0,72
0,88
1,05
1,3
1,13
0,79
0,71
0,63
0,63
0,46
0,46
0,55
0,38
0,55
0,38

0
0,08
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

7,77
0,34

INTERARRIVAL
CALLS

TWO
SERVERS

S1

CUSTOMER

RANDO
M#

INTERARRI
VAL TIME

TIME
CUSTO
MER
ARRIVE
S

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

7
15
52
49
34
72
43
23
80
77
98
38
78
52
2
94
55
98
62
67
31

0,25
0,33
0,42
0,42
0,33
0,42
0,42
0,33
0,5
0,42
0,58
0,42
0,42
0,42
0,25
0,5
0,42
0,58
0,42
0,42
0,33

0,25
0,58
1
1,42
1,75
2,17
2,59
2,92
3,42
3,84
4,42
4,84
5,26
5,68
5,93
6,43
6,85
7,43
7,85
8,27
8,6

RAND
OM #

77
19
21
51
99
33
85
84
56
65
38
37
97
21
73
7
60
89
10
39
82

SERVICE
TIME

TIME
SERVI SERVI
CE
CE
STAR TIME
TS

0,25
0
1
1,42
0
2,17
2,59
0
3,42
0
4,42
4,84
5,26
0
5,93
6,43
6,85
7,43
0
8,27
8,6

0,42
0,25
0,25
0,42
0,75
0,25
0,42
0,42
0,42
0,42
0,25
0,25
0,75
0,25
0,42
0,08
0,42
0,42
0,08
0,25
0,42

TIME
SERVI
CE
ENDS

0,67
0
1,25
1,84
0
2,42
3,01
0
3,84
0
4,67
5,09
6,01
0
6,35
6,51
7,27
7,85
0
8,52
9,02
PRO
M

S2

SERVICE
TIME

TIME
SERVI SERVI
CE
CE
STAR TIME
TS

0,58
0
0
1,75
0
0
2,92
0
3,84
0
0
0
5,68
0
0
0
0
7,85
0
0

0,42
0,25
0,25
0,42
0,75
0,25
0,42
0,42
0,42
0,42
0,25
0,25
0,75
0,25
0,42
0,08
0,42
0,42
0,08
0,25
0,42

TIME
SERVI
CE
ENDS

0,83
0
0
2,5
0
0
3,34
0
4,26
0
0
0
5,93
0
0
0
0
7,93
0
0
TOT
AL
PRO
M

WAITIN
G TIME
FOR
CUSTO
MER

TIME
INSIDE
OF
SYSTE
M

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

0,42
0,25
0,25
0,42
0,75
0,25
0,42
0,42
0,42
0,42
0,25
0,25
0,75
0,25
0,42
0,08
0,42
0,42
0,08
0,25
0,42

0
0,00

With 2 servers any client has to wait to be served but the amount of clients decrease.
4. Given A, B, and C, which are uncorrelated random variables, Variable A is normally distributed
with = 100 and = 400. Variable B is discrete uniformly distributed with a probability distribution
given by p(b)=1/5 with b = 0, 1, 2, 3, and 4. Variable C is distributed in accordance with the
following table:
Value of C
10
20
30
40

Probability
0.10
0.25
0.50
0.15

## Use simulation to estimate the mean of a new variable D, that is defined as

D = ( A 25 B ) / ( 2C )
Use a sample of size 30. Prepare a histogram of the resulting values, using class intervals of
width equal to 3
VARIABLE A= 400Z+100
VARIABLE B
VARIABLE
C
CUMULAT
RANDO
VALU PROBABI
CUMULAT
PROBABI
IVE RANDO
VALUE
M
E
LITY
IVE
LITY
PROBAILI M
DIGITS
PROBAILI
TY DIGITS
TY
1
0,2
0,2
1 -- 2
0,100,4 1 -- 10
102
0,100,2
3 -- 4
0,35
11 -- 35
20
0,25
3
0,2
0,6
5 -- 6
0,85
36 -- 85
30
0,50
4
0,2
0,8
7 -- 8
1,00
86 -- 00
40
0,15
5
0,2
1
9 -- 0
VARIABLE A
A=
N Random
400Z+10
o,
#
D = ( A 25B ) / ( 2C ) 0
0,195290
1
178
21
0,393340
2
257
54
0,228931
3
192
81
0,001615
4
101
58
0,744995
5
398
21
0,279407
6
212
34
0,962972
7
485
25
0,792879
8
417
38
0,634631
9
354
9
0,095627
10
138
37
0,105132
11
142
88
0,047536
12
119
44
0,923736
13
469
21
0,972453
14
489
58
0,203487
15
181
79
16 0,027722
111

VARIABLE B
Random #

VARIABLE C

99

40

0,98

55

30

3,04

96

40

1,77

83

30

0,84

31

20

9,32

62

30

1,86

53

30

6,42

52

30

6,12

41

30

3,81

70

30

1,89

69

30

1,12

77

30

1,15

71

30

6,99

28

20

11,60

30

20

2,03

74

30

0,60

17
18
19
20
21
22
23
24
25
26
27
28
29
30

87
0,736242
55
0,608157
97
0,299687
95
0,790858
32
0,591882
92
0,716117
96
0,167324
52
0,386682
92
0,971481
9
0,616264
06
0,980429
81
0,767384
13
0,319024
19
0,968401
57

394

81

30

4,49

343

97

40

3,04

220

81

30

2,83

416

42

30

5,27

337

43

30

3,95

386

86

40

3,58

167

10

5,85

255

30

20

3,87

489

34

20

9,71

347

49

30

5,36

492

52

30

6,95

407

15

20

8,92

228

10

8,88

487

79

30

6,46

MEAN

4,62

## Hi stogr ama de VAL UE OF D

Normal
9

Media
Desv .Est.
N

4,624
3,021
30

7
Fr ecuencia

6
5
4
3
2
1
0

6
VA LUE OF D

12

5. Estimate, by simulation, the average number of lost sales per week for an inventory system that
functions as follows:
(a) Whenever the inventory level falls to or below 10 units, an order is placed. Only one order can
be outstanding at a time.
(b) The size of each order is equal to 20 I, where I is the inventory level when the order is placed
(c) If a demand occurs during a period when the inventory level is zero, the sale is lost.
(d) Daily demand is normally distributed, with a mean of 5 units and a standard deviation of 1.5
units. (Round off demands to the closest integer during the simulation and, if a negative value
results, give it a demand of zero.)
(e) Lead time is distributed uniformly between zero and 5 daysintegers only.
(g) For simplicity, assume that orders are placed at the close of the business day and received
after the lead time has occurred. Thus, if lead time is one day, the order is available for
distribution on the morning of the second day of business following the placement of the order.
(h) Let the simulation run for 2 weeks.
Daily demand D= 1.5Z+5
0
1
2
3
4
5

0,167
0,167
0,167
0,167
0,167
0,167

Cumulative
Probability
0,167
0,333
0,500
0,667
0,833
1,000

Random
Digits
1 -- 167
168 -- 333
334 -- 500
501 -- 667
668 -- 833
834 -- 000

DAILY DEMAND
DAYS

LUNES
MARTES
MIRCOL
ES
JUEVES
VIERNES
DOMING
O
LUNES
MARTES
MIRCOL
ES
JUEVES
VIERNES
DOMING
O

N
o.

Random STOCK
#Z
AVIABLE

DEMAND
D=
1.5Z+5

LOST
SALES

## STOCK END AMOUNT OF

OF THE DAY
ORDER

Rando
m#

415

1
2

0,074
0,800

18
13

5
6

13
7

0
13

0,441

4
5
6

0,264
0,134
0,933

1
13
20

5
5
6

-4
8
13

0
12
0

34

0,386

13

12

43

8
9
1
0
1
1
1
2
1
3
1
4

0,479
0,213

20
14

6
5

14
9

0
11

880

0,144

0,253

-2

0,422

-6

0,470

13

-6

0,784

19

-6

LOST SALES
W1
LOST SALES
W2
MEA
N:

4
41
22,5

6. A bank has one drive-in teller and room for one additional customer to wait. Customers arriving
when the queue is full park and go inside the bank to transact business. The between arrivals and
the service- time distribution follow:
Time Between
Arrivals (Minutes)
0
1
2
3
4
5

Probability
0.09
0.17
0.27
0.20
0.15
0.12

Service Time
(minutes)
1
2
3
4

Probability
0.20
0.40
0.28
0.12

## Distribution of time between arrivals

time between arrivals
(min)
0
1
2
3
4
5

probability
0,09
0,17
0,27
0,2
0,15
0,12

cumulative probability
0,09
0,26
0,53
0,73
0,88
1

rand digit
01 n 09
10 n 26
27 n 53
54 n 73
74 n 88
89 n 00

probability
0,20
0,40
0,28
0,12

cumulative probability
0,20
0,60
0,88
1,00

rand digit
01 n 20
21 n 60
61 n 88
89 n 00

## Service time distribution

service time (min)
1
2
3
4

Simulate the operation of the drive-in teller for 10 new customers. The first of the 10 new
customers arrives at a time determined at random. Start the simulation with one customer being
served, leaving at time 3, and one in the queue. How many customers went into the bank to

customer#
A
B
1
2
3
4
5
6
7
8
9
10

arrival
rand#
interarrival T arrival T
given
unknown
0
given
unknown
0
0,35447584
2
2
0,55947073
3
5
0,23435345
1
6
0,80293647
4
10
0,80509056
4
14
0,54859424
3
17
0,26322381
1
18
0,54267603
3
21
0,33076314
2
23
0,56949721
3
26

## 4 customers went into the bank.

service
rand#
given
0,0780073
0,64573221
0,47331375
0,68419285
0,2390902
0,30661315
0,06938647
0,25654383
0,24273833
0,06040163
0,73561412

in
in
queue queue
before after service service Go in
service T arriv
arriv starts
ends bank?
3
0
0
0
3
no
0
1
0
1
3
6
no
0
3
1
1
-99
-99
yes 1
2
1
1
-99
-99
yes 1
3
0
1
7
9
no
0
2
0
1
11
14
no
0
2
1
1
-99
-99
yes 1
1
0
1
15
18
no
0
2
0
1
18
19
no
0
2
0
1
20
21
no
0
1
0
1
25
27
no
0
3
0
1
30
34
no
0