Sunday, February 10, 2008

My adventures during a queuing study

Here’s my account of a class project I did back at Arizona State University. The class was about the mathematics of queues, but this light (and hopefully funny) account centers around my adventures while I did my project. There are a few technical terms here and there – Exponential distribution, Poisson arrivals, goodness of fit tests – but they shouldn’t hinder the flow of the piece.


In Spring 2003, I took a class on Queuing Theory as part of my PhD coursework at Arizona State University. One of the assignments towards the end of the term was to apply the queuing models we’d learned to a real situation. Expectedly, students headed to the nearest fast food chains, banks, traffic signals and congested elevators to diligently conduct their studies. A not-so-small number headed to their friends to just as diligently pilfer projects from prior years and repackage them as their own work.

I headed to the nearest Safeway grocery store. Why? Because I’ve been fascinated with American grocery stores from the time I first stepped into one. There is something in the size of these stores, the bright lighting, the glittering array of produce and processed food along aisles – vegetables that have so much sparkle as to seem unreal (strangely they do not taste as good as they look); monstrous bags of potato chips; boxes with muffins, their tops bursting with nuts and chocolate; an entire aisle for ice creams only – there is something in this abundance that leaves me agape. Such a cornucopia would have doubtless entered the dreams of Early Man resting in his cave next to his precious hunting tools; and doubtless, waking up the next day, he might have resolved to change the world around him to achieve that dream.

But to return to the particulars of my queuing project. The Friday before Easter, I sat outside the entrance of the Safeway store, next to the vending machine and bike stand, with a stopwatch, pen and piece of paper. I felt later that I might have been thought of as homeless, but this didn’t cross my mind then. I was too absorbed recording the arrival time of every customer into the store from 5 to 7 pm (A group such as a family or that arrived in the same car, I considered as a single customer.) I wanted to see whether the great claim made by mathematicians and queuing theorists about arrivals was true: the claim that the rate of arrivals, if they are sufficiently random and independent (as they are expected to be at a grocery store), follows a Poisson distribution; or conversely, the distribution of inter-arrival times is Exponential.
The plot of inter-arrival times did indeed look exponential. On average a customer arrived at the store every 15 seconds; the standard deviation was 16.25 seconds, quite high, but not unexpected given the distribution. The data cleared goodness of fit tests with flying colors. I was excited! A fundamental assumption in many queuing models is that inter-arrival times are exponentially distributed, and here I had empirical confirmation of this from data I had painstakingly collected.

But arrival data was only the first part of my project. I planned to explore whether there were enough cashiers in the store to sustain this arrival rate, and if queues were reasonable. Since I now had to collect data in the store, I approached the manager, Scott.

I had seen Scott on my weekly shopping visits. He was a tall man, with blonde hair and an erect and dignified bearing. He was usually dressed formally in a white shirt and striped tie. He looked grim - I'd never seen him smile - but was always attentive to his customers' needs. “Hi,” he often said sagely to them. “Are you finding everything you need? Can I help you with anything?”

I explained my project to Scott, and told him it could be useful to the store. He looked at me skeptically. A frown creased his forehead.

“You can’t ask customers any questions. That’s just not permitted.”

“Oh, no, it’s nothing like that. I won’t be asking anything, just recording data on how many come in to the store, at what time,” – I’d already done that with arrivals but I didn’t mention it – “and doing a queuing study that may yield benefits to the store. Maybe I’ll learn something that Safeway can implement.”

It wasn’t the strongest pitch. Scott was still unconvinced and the frown remained. But he agreed. So I began doing rounds at the store, trying to remain inconspicuous, getting a sense of what people did, the amount of time they spent in queues, and the time checkout cashiers took to service them.

I was intrigued particularly by the rack or shelf that extended in front of each of the checkout counters. They consisted of the latest magazines, chocolates and candy with colorful wrappings, and such odds and ends as batteries. Customers would choose a magazine and toss it into their cart as they waited, their curiosity no doubt piqued by George Clooney's most recent affair or the most recent adoption from Cambodia, Kazakhstan or Malawi by a high profile actress - all this brazenly announced in The National Enquirer or People. Kids, on the other hand, would insist on having candy. Since a significant number purchased something from the rack – it was a reflex for some – I wondered if queues were really so bad after all. Sure, queues shouldn’t be too long for that can be frustrating, but maybe it actually helps the store to lengthen queues just a wee bit and provide an extra magazine or candy rack.

I dealt with this in my project, though with the deadline approaching I could only scratch the surface. The details are too specific and convoluted to mention here, but I proposed a modified single server queuing model where queues are profitable, so long as they are not longer than the length of the rack (usually 4-5 people). I don’t think I did enough for the model to give any insights as far as Safeway was concerned, but I sure was excited with this seemingly perverse idea of increasing queue sizes.

The other analysis I did was standard, garden-variety stuff: Were there too few or too many cashiers? The answer was not simple. The store had a floating set of employees who would do other jobs in the store but when queues started building they would be called using the announcement system to open a new checkout counter. Thus lines never got out of control, and employees could be used flexibly to do other odd jobs at the store during periods of lull. I figured my fancy math models with their set of assumptions weren't really applicable. After all, what could I suggest about staffing from my short visits that Safeway employees and the ever grave Scott hadn’t already figured from years of experience? There do exist other situations where a fresh perspective can help spot obvious flaws or suggest improvements, but this didn’t seem like one. Besides, people working in settings such as Safeway have rudimentary but intuitive ideas they develop themselves, and which they adapt with the passage of time and with experience; they don’t need degrees in mathematics or operations research to develop this intuition.

Finally, to finish this rather long post, here's how my project related visits to Safeway came to an abrupt end. I was trying to collect cashier service times – I’d already collected enough but wanted some more. My modus operandi was to choose a cashier, retreat to the rear of the corresponding aisle and observe from there. I couldn’t retreat too far since I wouldn’t have a clear view and I couldn’t be too close either for fear of attracting attention. Whatever my little tricks, there must have been an inadvertent surreptitiousness to my actions, for my eyes met once with a curly haired cashier’s and lingered for a while. He picked up the phone; I thought it was to address some customer issue. But a minute later, I heard a familiar voice behind me.

“Hi,” the voice said sagely. “How are you doing?”

Scott was dressed as usual: plain white shirt and striped tie. He wasn’t happy. “You’re making people nervous,” he said.

“But I informed you already that I would be collecting data in the store – I was trying to do it covertly so as not to disturb!”

“Yes, but you have to tell me when you intend to come in so I can warn my employees and so they don’t get edgy about some stranger spying on them, stopwatch in hand.”

I saw his point. Scott was just being a good manager. I agreed to inform him in the future, but I never returned – mostly because I had enough data for my project, but also because I was worried about becoming notorious as an undercover data collector. What if harassed employees were to put up an enlarged mug of mine at various locations with the stopwatch cord serving as a noose and a bold red “BEWARE OF THIS MAN!” stamped diagonally across? Even worse, what if I were to be booted out of the store? How then would I buy the enticements along the aisles - bags of Lays, delectable Entenmanns pastries, desserts of Pepperidge Farms, things I had come to depend so much on?

So, you'll understand why I receded wisely, wrote up my project report, got a good grade, and continued to be an anonymous customer - one of the 'Poisson-arriving' masses!


Iris said...

Surprisingly I finished reading this long post of's funny and intriguing.

The image of you holding a stop-watch and peering at the cashiers with dreamy eyes cracks me up, :-)

Hari said...

Thanks, Iris! Yes, dreamy eyes peering at a cashier: I forgot all about my dreamy eyes. I am sure the cashier who reported me was pretty freaked out when he got a glimpse of those eyes!

Pallavi said...

are you sure they havent put your mugshots? i was at safeway here, the other day and they are still looking for you hari..:)

Hari said...

I had no idea I had that kind of impact, Pallavi - even five years on! That's encouraging; now, if I only manage to put it to good use, rather than turning up on mugshots!

Kartikeya said...

He he... safeway at broadway and rural... the lifeline of ASU students.. :)

Im wondering.... what does your finding about lengthening of queues to be a good thing say about 10 items or less counters...

Hari said...

Yes, Kartikeya, that Safeway was indeed the lifeline for those of who had only bicycles!

Regarding your question: I would think no, you can't lengthen queues for express checkouts, because it would defeat the purpose. Also my analysis was pretty shallow and theoretical, not enough considering detailed scenarios - it was a class project after all!

The interesting take-away, though, was that psychology of those waiting can be used. If the wait becomes interesting because you are entertained by a magazine and are willing to buy it, then why not!