I cycle to work in an office with a single shower. When the shower is occupied I set my stopwatch for 10 minutes. When the stopwatch expires I trek back to the shower and try again. Sometimes it is occupied again.

What is the optimum time to set my stopwatch to minimise the number of return trips?

I chose 10 minutes because I guessed that that's probably how long a reasonably quick shower takes. But thinking about it perhaps a shorter delay might avoid me being beaten once the shower becomes free, whilst a longer delay would increase the likelihood that the initial occupier has left.

I realize there are loads of variables here that you might need to know so here's some details to get started with:

  • All shower users use the same system when they arrive at work
  • Shower users arrive at work at different times, but let's say between 9-10
  • All shower users want to be out of their Lycra by the end of the morning (12) and to avoid interference with the lunchtime shower users. Their co-workers want them out of their Lycra ASAP. I'm not sure how to balance this requirement with the requirement to minimize the number of trips to the shower. Suggestions?
  • Shower users take between 8 and 16 minutes to shower
  • There are between 4 and 10 shower users on a given day.
  • I realize there are better ways to organize the shower queue!
  • All shower user use the same retry delay
  • 2
    $\begingroup$ Just curious, is this an exercise or a real-life problem you're trying to model? $\endgroup$ – Math1000 Feb 27 '15 at 14:14
  • $\begingroup$ What is the distribution of the shower times, the interarrival times, and the number of arrivals? $\endgroup$ – Math1000 Feb 27 '15 at 14:16

I tried a numerical modelization of your problem (Scilab code below) and used a Monte-Carlo method to compute the minimum.

At first, I found a decreasing function of the retry, which is compatible with the intuition that, the more you wait for the least you risk interacting

Objective without penalisation Average total number of attempts to go to the shower as a function of the retry delay.

But then how can we respect the constraint: everyone is clean for lunch? Again we may graph the probability that the last one's shower is after 12: enter image description here Probability of having someone shower after 12, as a function of the retry delay.

We see that waiting for more than 16 min is a bad idea and that your 10 min delay isn't that bad... but we can test if it's a good idea to have a fixed idea of when you go to the shower. Let's randomize it too: enter image description here Average total number of attempts to go to the shower as a function of the retry delay.

Not so different from the first one is it? So you could have felt free to go shower whenever you wanted ;-)

function N=showerRetry(T)
Showerduration=grand(1,Nbshower,"unf",8,16);//independant of the time you had to wait.
while max(Ttotry)>0 do
    if tfree<Ttotry(nbclean+1) do //youpi je me lave
    else//oh non j'attends
//Nbtry=0//to get only the penalty
if tfree>60*3 then// si la dernière douche se termine après midi
    Nbtry=Nbtry+100 //forte pénalité
N=Nbtry//+exp(tfree-150)// smother penalization

function M=Montecarlo(N,P)
    n=size(P,'*')//le nombre de périodes à tester
    for i=1:n
        for j=1:N

T= Montecarlo(10000,P)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.