## Monday, August 03, 2015

### How much should you plan for?

**by Hari Balasubramanian**

*Decisions under demand uncertainty – the so called newsvendor problem. *

In October 2007, my father and I took a day train from Bangalore to Chennai. About halfway into the 7-hour journey is a station called Jolarpet, where the train stops for ten minutes. As at other stations, there were dozens of vendors – each with a simple wheeled stall or a wooden basket or a steel container – engaged in a frenzy of small scale entrepreneurship. All sorts of items were being sold: snacks, tea, coffee, water, bananas, flowers, cheap Chinese goods – toys, combs, and, in what became a curiosity and a topic of detailed conversation among our fellow travelers, pens that doubled as flashlights.

But my father was most interested in those who sold *vadas*, a South Indian specialty, a round, deep-fried snack with a hole in middle – like a donut but not sweet at all – made from a batter of lentils (I've described just one variety). My father felt the *vadas* sold by vendors at the Jolarpet station were better than those made in the train's pantry. They were hot, had just the right texture, and the timing – late afternoon – was just right to have them with coffee. Three fairly busy trains – including the Bangalore-Chennai Brindavan Express on which we were traveling that day – arrive at Jolarpet station at roughly the same time. "How many *vadas* get sold?" my father wondered. "Maybe a thousand of them, maybe even more."

That comment got me thinking. If you are a vendor, the critical question is how many *vadas* should I make? The *vadas* have to be fried right before the train arrives so that they are hot and ready to sell during the ten minutes that the train stops. If I fry too many and not enough passengers buy them then what I am left with is wasted, since a *vada* that is not freshly made is unappetizing. On the other hand, if I fry too few, then I lose the opportunity to sell to passengers who need them. So what is the right number to make given this uncertainty in demand?

The technical name for this dilemma is the newsvendor problem. Replace *vadas* with newspapers and you have an identical situation. If a newsvendor on the street doesn't sell enough newspapers, what's left is wasted since today's newspaper won't sell tomorrow. If the vendor has too few newspapers and runs out of them, then potential customers are lost.

The newsvendor comes up in one form or another in myriad contexts. It belongs to a class of problems where a decision has to be made *right now* with no guarantees of what will happen in the future. Restaurants, no matter where they are in the world, face demand uncertainty on a daily basis – they have to decide on the amount of fresh meat, seafood or vegetables, but the number of diners might vary from one day to the next. Even in a mundane situation like a family picnic, one has to decide how much food to carry given uncertain appetites.

And it's not just food. If a mechanic plans to work for 8 hours but gets only 5 hours worth of work because fewer customers arrive than expected, then 3 of those unused hours are "wasted" (though I personally wouldn't mind such a day!). Like food or news, unused time perishes and cannot be transferred to the next day. A doctor plans for a 30-minute appointment with a patient but if the appointment finishes early, the doctor has time on her hands; and if the appointment takes longer than 30 minutes, the next patient will have to wait. Even the problem of how much to save for retirement, given the uncertainty of how long we'll live, is a kind of newsvendor problem, though with very different details and context.

**The Math of the Newsvendor**

Let's take a look at the stylized version of the problem. Suppose a vendor is selling a perishable item – *vadas*, falafels, flowers, newspapers, something that doesn't last very long. Suppose also that the vendor knows the probability distribution of the demand. The demand distribution is not that easy to estimate but let's go along with this illusion for the moment. The time period in which the demand is measured depends on the context. It could be a ten minute period, an hour, a morning. In this example, let's assume it is one day. The x-axis is the demand: the number of items requested by customers in a day. The y-axis (i.e. the height of the curve) tells us the probability that a particular demand value will be realized.

For this stylized case, we conveniently have a symmetric bell curve, with a mean demand of 100 per day. Notice that the greatest probability density is also around the mean. If the vendor plans to put out 100 items and demand on a particular day ends up being less than 100, the vendor will have leftover items; if the demand ends up being greater than 100, customers may come asking, but there's nothing left to sell.

The optimal quantity, however, depends on the cost of making and selling the item. Suppose it costs the vendor $3.5 to make each item and each item sells at $7; and there is no salvage value for leftovers. Then the optimal quantity for the symmetric demand distribution above is exactly 100 items. Why? Because if a unit of my product is leftover, I lose the $3.5 it took to produce; if I miss a sale, I lose the opportunity to make a profit of $3.5. Because the loss in both outcomes is the same, it makes sense to position oneself right in the middle of a symmetric demand curve. But if the cost of producing an item is well below $3.5, then it makes sense to plan for *well over* 100 items. This ensures that even on the busiest, high-demand days, there is always something to sell and make a good profit and rarely does one run short. On the other hand, if it is too expensive to make the product (the cost of making the item is close to $7), then it makes sense to plan for *well* *under* 100 items, so that the chance of unsalvageable leftovers is low.

In the mathematical treatment of the problem, the demand distribution, whatever its shape may be (it doesn't have to be symmetric or a bell curve) is known and so are the selling price and production cost. The optimal quantity is simply that point on the x-axis where the probability of leftover items and associated costs balances the probability of missing sales and lost opportunity cost, and the vendor's expected profit is at its maximum. For certain continuous distributions it's possible to have what is called a closed-form solution, a formula essentially, that tells you the optimal quantity. There are literally hundreds of publications out there that deal with the mathematics of the newsvendor problem and its countless variations. Most of them assume there is such a thing as an "optimal quantity" which one can solve for.

**But in Practice…**

Well in practice, things are complicated -- and far more interesting. To begin with, the demand does not reveal itself so easily. Once you've sold out, those that still need to purchase may not come to you. So you can't always accurately count the demand after you've sold out; what you observe is a *censored* demand distribution. Then there are specifics such as high seasons and low seasons, the weekend effect and the effect of specific weekdays or holidays, which are not easy to estimate. You can't always gauge the quality of your product, the quality put out by your competition, the price you have set, and the effect of these factors, individually or in combination, on your demand. Some years are wildly successful, and then suddenly it all fades away – there may be no clear explanations. So there is no such thing as a static demand distribution that works all the time.

As for losses and profit margins it's true that there can there can be precise numbers – rupees or dollars – to approximate them. But it is not so much the numbers as how the vendor *feels* about them that matter – and feelings are subjective, constantly changing and not easily quantified. Today, I might feel a warm glow about giving away my unsold items to a local temple or church or homeless shelter; tomorrow I'll be worried that I am giving too much for free rather than making profits and saving up for my kids' education; another day, I'll feel that I shouldn't be too greedy; yet another day, I'll be environmentally conscious and cautious about generating too much waste; and so on and so forth – it's endless the goals the mind and the world around you can create!

Even bigger firms that use fancy forecasting models, market research and so called predictive analytics must struggle with these problems because the goalposts are constantly shifting – perhaps that is one reason the CEOs keep shifting too! Probability theory is the closest you come to saying something about the future, but it still a prediction based on data of the past, and therefore always one step behind what actually unfolds.

In simulated research experiments, subjects – typically MBA or undergraduate students – that are asked to decide an order quantity for the newsvendor problem almost always deviate from the mathematically calculated optimal quantity. This despite the fact that the subjects are provided clear information about demand, costs and prices, and even have a chance to adjust their order quantities (the experiments involve multiple rounds). If in such stable, laboratory settings individuals don't make optimal decisions, then what can we expect in situations where time pressures, the lack of reliable data and a constantly changing environment make a mockery of the very idea of optimality?

Maybe the best way – and this is easier said than done, in this day and age where we are flooded with data that is hard to ignore – is *not* spending too much time predicting and speculating, not to overanalyze, rather make simple *heuristic* decisions. Such decisions may have partial basis in mathematical intuition, may use data or past experience as a general guide, but they are not overly reliant on exact/optimal answers. Heuristic decisions are not static; they change with circumstances and depend on an individual's preferences/biases at any particular moment. They may even seem wrong or sub-optimal in retrospect, but this is acknowledged as inevitable and part of the learning process.

Indeed, this type of informal decision making may accurately reflect the current practice of the hundreds of thousands of vendors – single person or family businesses – working and competing every day all across the world. Such as those selling *vadas *at Jolarpet station; the two flower vendors, women with capacious, sturdy-looking wooden baskets, whom I saw in a crowded early morning Chennai city bus back in 2009; and the Bangladeshi man I met in Ecuador last year (right image), selling samosas, 3 for $1, in the old town of Quito, who had cleverly labeled his product *Empanadas de India *and in doing so had made a South Asian snack familiar and appealing to Ecuadorians. * *

_

*You can check out my other 3QD essays here. *

Posted by Hari Balasubramanian at 12:05 AM | Permalink