MA231 Operations Research Methods
Grammateia Kotsialou
Class 5 - Week 6
Exercises:
1. (Homework) Consider the model of the single server queueing system that we studied in
lecture. Suppose we also wanted to obtain information about the amount of idle time a server
would experience in a time horizon of length T. Explain how this could be accomplished by
editing the variables, event list, output variables and the pseudocode that we presented in
lecture.
2. Consider a single server queueing model in which customers arrive according to a NPP. Upon
arriving they either enter service if the server is free or else they join the queue. Suppose,
however, that each customer will only wait a random amount of time, having distribution F,
in the queue before leaving the system. Suppose we are interested in estimating the average
number of lost customers by time T, where a customer that departs before entering service is
considered lost. We also want the average time that lost customers spent in the system but
we are not interested in the time in the system of the remaining customers. Define variables
and events so as to analyse this model and give the updating procedures.
3. Exercise on “Two servers in parallel” queueing model
(a) In lecture we looked at the queueing model with two servers in parallel. We wrote the
pseudocode for two updating procedures cases 1 and 2. Write the pseudocode of the
updating procedure for case 3.
(b) Using your answer for case 3 in (a) above and pseudocode for the updating procedures
1 and 2 write the R code for the queueing system with two servers in parallel. In lecture
we did not specify how to end the simulation: run the model for a specified time T after
which no customers are allowed in the system. But allow the servers to finish serving
all customers that are present in the system at time T. Further, for the state variable
store ST = (n, i1, i2, t) every time the state (n, i1, i2) changes; with this information you
should be able to reproduce the entire process. You will run this code with data from
part (c) below, so read part (c) before writing the R script.
(c) Use T = 4, a NPP with rate λ(t) = 3 + 4
t+1
. For λ > 0 such that λ(t) ≤ λ for all
0 ≤ t ≤ T, pick λ = 7. For the servers distribution use exponential with rate µ = 5. Run
the R script from 3(b) with the above data to output Tp, the average time customers
spend in the system, and the number of customers served by S1 and S2. Start with
“set.seed(1)”.
(d) Use the state variable ST to calculate time spent in each state n = 0, 1, ... during
[0, T + Tp], where n is the total number of customers in the system. Use this to find the
average number of customers in the system.
1
学霸联盟