STAT 340/CS 437
Short Solutions to Exercise of Chapter 6
1.
(a)
Note
:
T
0
is the time when service gets started;
T
is the “door-closing” time (no more
arrivals after
T
). For notation and deﬁnitions of variables see Handout 4.
Initialize the System:
– Set
t
= 0;
N
A
= 0;
N
D
1
= 0;
N
D
2
= 0;
SS
= (0
,
0
,
0).
– Generate
I
from exp(
μ
), the ﬁrst arrival time.
– Set
t
A
=
I
;
t
D
1
=
∞
;
t
D
2
=
∞
.
Update the System Based on
t
,
SS
= (
n,i
1
,i
2
),
t
A
,
t
D
1
and
t
D
2
:
– Case 0:
t
A
< T
0
Reset
t
=
t
A
;
N
A
=
N
A
+ 1;
SS
= (
n
+ 1
,i
1
,i
2
) (here we must have
i
1
=
i
2
= 0);
Generate
I
from exp(
μ
) and reset
t
A
=
t
+
I
;
Collect
A
(
N
A
) =
t
.
Set the departure times here for the ﬁrst two customers
if they arrive before
t
=
T
0
:
(1) If
N
A
= 1, generate
Y
1
from exp(
λ
1
), reset
i
1
= 1 and
t
D
1
=
T
0
+
Y
1
.
(2) If
N
A
= 2, generate
Y
2
from exp(
λ
2
), reset
i
2
= 2 and
t
D
2
=
T
0
+
Y
2
.
– Case 1:
t
A
= min(
t
A
,t
D
1
,t
D
2
) and
T
0
≤
t
A
≤
T
Reset
t
=
t
A
;
N
A
=
N
A
+ 1.
Generate
I
from exp(
μ
) and reset
t
A
=
t
+
I
.
Collect output
A
(
N
A
) =
t
.
(1) If
SS
= (0
,
0
,
0): Reset
SS
= (1
,N
A
,
0); Generate
Y
1
from exp(
λ
1
) and reset
t
D
1
=
t
+
Y
1
.
(2) If
SS
= (1
,i
1
,
0): Reset
SS
= (2
,i
1
,N
A
); Generate
Y
2
from exp(
λ
2
) and reset
t
D
2
=
t
+
Y
2
.
(3) If
SS
= (1
,
0
,i
2
): Reset
SS
= (2
,N
A
,i
2
); Generate
Y
1
from exp(
λ
1
) and reset
t
D
1
=
t
+
Y
1
.
(4) If
n >
1: Reset
SS
= (
n
+ 1
,i
1
,i
2
).
– Case 2:
t
D
1
= min(
t
A
,t
D
1
,t
D
2
) and
t
D
1
≤
T
Reset
t
=
t
D
1
;
N
D
1
=
N
D
1
+ 1.
Collect
D
(
i
1
) =
t
.
1