Home/chiaha-SLX/Bank tellers

Bank tellers: an M/M/3 queue

Three tellers share one line. It is the smallest model where pooling servers matters, and one of the few with an exact answer to check a simulation against.

The problem

Customers arrive on average every 4 minutes and a transaction takes 10 minutes on average, both exponential. Three tellers work one shared line, first come, first served.

Work arrives at 10 ÷ 4 = 2.5 tellers’ worth, so each teller is busy 2.5 ÷ 3, about 83% of the time. That sounds comfortable. Erlang C says otherwise: 70% of customers wait, and the mean wait over all customers is 14 minutes.

TELLERS STORAGE    3
        GENERATE   RVEXPO(1,4)
        QUEUE      LOBBY
        ENTER      TELLERS
        DEPART     LOBBY
        ADVANCE    RVEXPO(2,10)
        LEAVE      TELLERS
        TERMINATE
        GENERATE   480
        TERMINATE  1
The GPSS deck. A STORAGE of 3 is three identical tellers; ENTER and LEAVE take and give back one.

In chiaha-SLX

The storage keeps its name and its capacity: storage Tellers capacity = 3. A customer queues in the lobby, enters the tellers when one is free, and leaves after an exponential service drawn from its own stream.

import <h4>

module tellers_h4
     {
     storage   Tellers capacity = 3;
     queue     Lobby;

     rn_stream Arrivals seed=100000;
     rn_stream Service  seed=200000;

     float     run_length = 480;
     int       served;
     float     waited;
     float     busy;

     object customer
          {
          float arrived, service;
          actions
               {
               arrived = time;
               enqueue   Lobby;
               enter     Tellers;
               depart    Lobby;
               waited += time - arrived;
               service = rv_expo(Service, 10.0);
               advance   service;
               leave     Tellers;
               busy += service;
               served++;
               terminate;
               }
          }

     procedure main
          {
          arrivals: customer iat = rv_expo(Arrivals, 4.0);
          advance run_length;
          report(system);
          }
     }
The workspace example deck/tellers, without its header comment.

One day, twenty times

Each run starts with an empty lobby at opening time, so a single day averages below the long-run figures further down. The day-to-day spread is wide.

MeasureMean of 20 runsLowest to highest run
Customers served113.3 ± 4.797 to 132
Mean wait in line6.93 min ± 1.831.81 min to 14.99 min
Teller utilization75.09% ± 4.1956.95% to 89.70%

± is the 95% confidence interval of the mean over 20 runs.

The long run, beside Erlang C

Set run_length to 50,000 minutes and the averages land on the formula. Every theory value sits inside the simulated interval.

MeasureMean of 20 runsLowest to highest runTheory
Mean wait in line (Wq)13.97 min ± 0.8910.88 min to 19.98 min14.04 min
Mean number waiting (Lq)3.5 ± 0.22.7 to 5.03.5
Teller utilization83.01% ± 0.4881.05% to 84.86%83.33%

Erlang C for M/M/3 with arrival rate 0.25 a minute and service rate 0.1 a minute. Lq is total waiting time divided by run length. The other three classic problems checked this way are on the verification page.

Try changing it

Set the capacity to 4 and run it again to see what a fourth teller buys; it is a one-word change. Giving each teller its own line takes three facilities and three queues; queueing theory says the same staff then gives longer waits, and the model lets you see by how much. The GPSS block names and what they become in chiaha-SLX are listed on the GPSS models page.

GPSS/H is a trademark of its owner. ChiAha is not affiliated with or endorsed by it.