Complete problem 5 from Chapter 8 in Kelton.
#create reproducability
set.seed(123)
Speedee Car Rentals is open 24 hours and has two classes of customers 25% are premium customers who are promised a waiting time of less than 5 minutes from when they enter or they will recieve a $15 discount on their rental. The others are regular customers who will wait as long as they have to wait. Customers arrive about 2 minutes apart (exponential) and move about 4 meters at 1 mile per hour to either the premium counter (1 agent) or the regular counter (2 agents). All customers have a uniformly distributed service time of from 2 to 7 minutes. Each agent costs $55 per hour (including overhead) and each customer completed contributes $8 to income (minus any discount they might have received). Model this system without using any links. Run for 10 days per replication. For each scenario, report the utilization of each type of agent and the waiting time of each type of customer. Both on-screen and in the output, report the number of premium customers who received a discount, the total discounts paid, and the net profit (after discounts and costs) of the system.
Assume that each agent only handles customers of his designated type.
Our set-up without links looks as follows, with the only path specifying the distance of 4 meters between entrance and desk.
Intial Set-Up
The standard counter has 2 agents, while the premium counter has 1. The input data for customers shows that we want 25% as premium, and 75% as standard. then move from the entrance, to the respective desk, then to the exit. The time is set to zero, to indicate there is not time distance, while the two desks (Servers) are set-up with Random.Uniform(2, 7).
Customers Table
Sequence Table
Costs were more difficult to figure out. Agents cost $55 per hour, and Simio doesn’t have this rate card so I input $55 while idle and $55 while in use.
Server Rates
Interpreting the results was also a challenge, especially where costs are concerned because the task has a discount for wait. I really tried but couldn’t figure out how to associate a cost for additional time in queue. I think one was is to have each entity track time in queue, then multiply the entities with >15 mintues queue time by the discount of $15. I couldn’t figure out a filter for this either. Profits I also couldn’t figure out, so multiplying the number exited by $8 seems appropriate.
Results Table
Premiuim Customer Results Table
Taking Total Costs of $3,960 (3 agents for 24 hours at $55 per hour), adding discounts of $0 (maxium holding time was 0.1167 hours, which is 7 minutes), and the revenues of $5,192 (649 customers passed through the system at $8 per customer), we have a net profit of $1,232 per day.
Relax the above assumption. Consider the alternative work rules (who services which customer under which conditions) for this same staff. Evaluate each proposed scenario to see the impact on the metrics.
If the Standard Counter has capacity 3, and the Premium Counter has capacity of 1 (there is no premium customer), or if the Standard Counter is full (there are 2 customers at the counter) with 2 people in the queue, then the Standard Customer may move to the Premium Counter. (method to change standard customer priority to premium?)
I’d estimate that the second optional scenario was superior to the original since priority was for Premium customers, and wait times would always be under 15 minutes (uniform of 2-7 mintues would satisfy that criteria). After re-evaluating the original model, it doesn’t seem to work correctly.
Model other possible solutions to improve the system. You may use links if that helps.
With links the model runs easier but does not fix my cost problem. Really struggled to figure it out.
Use the Metropolis-Hastings sampler to generate random variables from a standard Cauchy distribution. Discard the first 1000 of the chain, and compare the deciles of the generated observations with the deciles of the standard Cauchy distribution (see qcuchy or qt with df=1). Recall that a Cauchy(\(\theta\), \(\eta\)) distribution has density function
\(f(x) = \frac{1}{\theta\pi(1+[(x - \eta)/\theta]^2)}\), \(-\infty\) < x < \(\infty\), \(\theta\) > 0
The standard Cauchy has the Cauchy(\(\theta\) = 1, \(\eta\) = 0) density. (Note that the standard Cauchy density is equal to the Student t density with one degree of freedom.)
Metropolis-Hastings Sampler generates the Markov chain {X(0), X(1)…} as follows: 1. Choose a proposal distribution g(.|X(t)) (subject to regularity conditions). 2. Generate X(0) from a distribution g. 3. Repeat (until the chain has converged to a stationary distribution according to some criterion): a. Generate Y from g(.|X(t)) b. Generate U from Uniform(0,1) c. if U <= d. Increment t.
#sample size
n <- 10000
x <- numeric(n)
u <- runif(n)
for (i in 2:n){
j <- x[i-1]
y <- rnorm(1)
if (u[i] <= dcauchy(y) * dnorm(j, mean = y)/dcauchy(j) * dnorm(y, mean = j)) {
x[i] <- y
}
else {
x[i] <- j
}
}
#remove first thousand results
x1 <- x[1001:length(n)]
observations <- quantile(x, seq(0, 1, 0.1))
expectations <- qcauchy(seq(0, 1, 0.1))
decile <- data.frame(observations, expectations)
decile
## observations expectations
## 0% -2.020557058 -Inf
## 10% -0.647321270 -3.0776835
## 20% -0.422131687 -1.3763819
## 30% -0.268546251 -0.7265425
## 40% -0.118943640 -0.3249197
## 50% -0.004460459 0.0000000
## 60% 0.111538963 0.3249197
## 70% 0.239866735 0.7265425
## 80% 0.419217723 1.3763819
## 90% 0.703869507 3.0776835
## 100% 1.661924638 Inf
Implement a random walk Metropolis sampler for generating the standard Laplace distribution. For the increment, simulate from a normal distribution. Compare the chains generated when different variances are used for the proposal distribution. Also, compute the acceptance rates of each chain.