hw1 Key
hw1 Key
1. For the single-server queueing system in Section 1.4, define L(t) to be the total number of customers
in the system at time t (including the queue and the customer in service at time t, if any).
(a) (4 pts) Is it true that L(t) = Q(t) + 1? Why or why not? If not, correct the right side of the
equation. You may use the functions defined in Section 1.4.
(b) (5 pts) For the same realization considered for the hand simulation in Section 1.4.2, make a plot
of L(t) vs. t (similar to Figs. 1.5 and 1.6) between times 0 and T(6).
(c) (4 pts) From your plot in part (b), compute 𝑙̂(6) = the time-average number of customers in the
system during the time interval [0, T(t)]. Show the expressions for computation, mimicking
Equations 1.2 and 1.3.
(d) (2 pts) What is 𝑙̂(6) estimating?
Answer:
(a) L(t) = Q(t) + 1 is not true. When the server is idle and the queue is empty, L(t) = 0 < Q(t) + 1 = 1.
The right side should be L(t) = Q(t) + B(t), where B(t) is defined on Page 16 in the textbook.
(b)
(c) 𝑙̂(6) = ((0.4 – 0) × 0 + (1.6 – 0.4) × 1 + (2.1 – 1.6) × 2 + (2.4 – 2.1) × 3 + (3.1 – 2.4) × 2 + (3.3 – 3.1)
× 1 + (3.8 – 3.1) × 0 + (4.0 – 3.8) × 1 + (4.9 – 4.0) × 2 + (5.6 – 4.9) × 1 + (5.8 – 5.6) × 2 + (7.2 – 5.8)
× 3 + (8.6 – 7.2) × 4) / 8.6 = 17.6 / 8.6 2.05
2. (20 pts, 4 pts for each event) Suppose the list of interarrival and service times in Section 1.4.2 is
augmented by the following items: A10 = 0.6, A11 = 1.1, A12 = 1.5, A13 = 0.8, S7 = 2.0, S8 = 2.5. Assume
the simulation stops when the 7th customer leaves the system. Show the system state, simulation
clock, event list and statistical counters as in Figure 1.7 after processing each even since simulation
time of 8.6.
Answer:
Event 1: (Clock = 9.1)
Arrival time = 9.1: Event list:
System: 5.6 (in server), 5.8, 7.2, 9.1 (in A = 9.7 (= 9.1 + A10 = 9.1 + 0.6), D = 9.2
queue) Statistical counters:
System state: Number delayed = 6
Server status = 1 Total delay = 5.7
Number in Queue = 3 Area under Q(t) = 10.9 (= 9.9 + (9.1 – 8.6) × 2)
Time of arrival = 5.8, 7.2, 9.1 Area under B(t) = 8.2 (= 7.7 + (9.1 – 8.6) × 1)
Time of last event = 9.1
3. (4 pts) Suppose the simulation in section 1.4 stops at simulation time of 8.1. Show the system state,
simulation clock, event list and statistical counters at the end of the simulation.
Answer:
System state: Event list:
Server status = 1 A = 9.1, D = 8.6
Number in Queue = 3 Statistical counters:
Time of arrival = 5.6, 5.8, 7.2 Number delayed = 5
Time of last event = 7.2 Total delay = 2.7
Clock = 8.1 Area under Q(t) = 5.7
Area under B(t) = 6.3
4. For the single-server queueing system in Section 1.4, suppose a customer leaves the system without
being served after staying in the queue for 0.2 or more units of time.
(a) (4 pts) What new events must be introduced?
(b) (60 pts, 4 pts for each event) Show the system state, simulation clock and event list after each
event until the end of the simulation. The simulation finishes at simulation time of 9.0.
Answer:
(a) A new event of "Pre-mature departure" (meaning departure without being serviced) must be
introduced.
(b)
Event 1: (Clock = 0.4)
Arrival time = 0.4: Event list: (P: Premature departure)
System: 0.4 (in server) A = 1.6, D = 2.4, P = ∞
System state: Statistical counters:
Server status = 1 Number delayed = 1
Number in Queue = 0 Total delay = 0
Time of arrival = (None) Area under Q(t) = 0
Time of last event = 0.4 Area under B(t) = 0
Event 2: (Clock = 1.6)
Arrival time = 1.6: Event list:
System: 0.4 (in server), 1.6 (in queue) A = 2.1, D = 2.4, P = 1.8
System state: Statistical counters:
Server status = 1 Number delayed = 1
Number in Queue = 1 Total delay = 0
Time of arrival = 1.6 Area under Q(t) = 0
Time of last event = 0.4 Area under B(t) = 1.2 (= (1.6 – 0.4) × 1)