## Levels and shifts in analysing games

So Nitin Pai and Pranay Kotasthane have a great graphic on how India should react to China’s aggressions on Doka La. While the analysis is excellent, my discomfort is with the choice of “deltas” as the axes of this payoff diagram, rather than levels.

Instead, what might have been preferable would have been to define each countries strategies in terms of levels of aggressions, define their current levels of aggression, and evaluate the two countries’ strategies in terms of moving to each possible alternate level. Here is why.

The problem with using shifts (or “deltas” or “slopes” or whatever you call the movement between levels) is that they are not consistent. Putting it mathematically, the tangent doesn’t measure the rate of change in a curve when you go far away from the point where you’ve calibrated the tangent.

To illustrate, let’s use this diagram itself. The strategy is that India should “hold”. From the diagram, if India holds, China’s best option is to escalate. In the next iteration, India continues to hold, and China continues to escalate. After a few such steps, surely we will be far away enough from the current equilibrium that the payoff for changing stance is very different from what is represented by this diagram?

This graph is perhaps valid for the current situation where (say) India’s aggression level is at 2 on a 1–5 integer scale, while China is at 3. But will the payoffs of going up and down by a notch be the same if India is still at 2 and China has reached the maximum pre-war aggression of 5 (remember that both are nuclear powers)?

On the flip side, the good thing about using payoffs based on changes in level is that it keeps the payoff diagram small, and this is especially useful when the levels cannot be easily discretised or there are too many possible levels. Think of a 5×5 square graph, or even a 10×10, in place of the 3×3, for example?—?soon it can get rather unwieldy. That is possibly what led Nitin and Pranay to choose the delta graph.

Mirrored here.

So the wife has done a kind of sociological analysis of who offers seats to baby-carrying people on the London Metro. Based on the data points she’s collected over the last three months we’ve been in London, she concludes that people who are most willing to give up their seats are those who have been beneficiaries of similar actions in the past – basically a social capital kind of argument.

I don’t have such an overarching thesis on who gives up seats, but one major observation based on my collection of data points. Most of my train rides with Berry have been between Ealing Broadway, the station closest to where we live, and St. Paul’s in Central London, close to Berry’s nursery and Pinky’s office.

The Central Line, which I take for this journey, is typically crowded in both directions, since most of my trips are during peak office commute hours. However, my experience in terms of people offering me a seat (I’ve never asked for it) has been very different in terms of where I’ve boarded.

What I’ve found is that people have been far more willing to give up their seats when I’ve boarded at St. Paul’s (or anywhere else in the city), than at Ealing. In fact, in about 30-40 train rides originating in Ealing when I’ve been carrying Berry, I only recall one occasion when someone has offered me their seat. On the other hand, it’s rare for me to board at St Paul’s and NOT have someone offer me their seat.

I have one major hypothesis on why it happens – on what goes into getting a seat, and a sense of entitlement. Essentially, Ealing Broadway is a terminus for the tube, and thus an originating station for journeys into town. And I’ve seen people work hard in order to get a seat.

So you have people who leave multiple trains in order to find one where they can find a seat. They get to the station well in advance of a train leaving so that they can get a place to sit. And having invested so much effort in occupying the seat, they feel entitled to the seat, and don’t want to give it up so easily.

On the other hand, St. Paul’s is right in the middle of the Central Line, and people who have seats when the train arrives there are typically those who got them somewhere along the way. Now, while there exist strategies to figure out where a seat might fall empty, and grabbing it, finding a seat in a non-empty train after you’ve boarded is more a matter of luck.

So if you think you got your seat by sheer luck, you feel less entitled to it, and are more than happy to give it up for someone who might have need it more!

Feel free to draw your own analogies!

## Coin change problem with change – Dijkstra’s Algorithm

The coin change problem is a well studied problem in Computer Science, and is a popular example given for teaching students Dynamic Programming. The problem is simple – given an amount and a set of coins, what is the minimum number of coins that can be used to pay that amount?

So, for example, if we have coins for 1,2,5,10,20,50,100 (like we do now in India), the easiest way to pay Rs. 11 is by using two coins – 10 and 1. If you have to pay Rs. 16, you can break it up as 10+5+1 and pay it using three coins.

The problem with the traditional formulation of the coin change problem is that it doesn’t involve “change” – the payer is not allowed to take back coins from the payee. So, for example, if you’ve to pay Rs. 99, you need to use 6 coins (50+20+20+5+2+2). On the other hand, if change is allowed, Rs. 99 can be paid using just 2 coins – pay Rs. 100 and get back Re. 1.

So how do you determine the way to pay using fewest coins when change is allowed? In other words, what happens to the coin change problems when negative coins can be used? (Paying 100 and getting back 1 is the same as paying 100 and (-1) ) .

Unfortunately, dynamic programming doesn’t work in this case, since we cannot process in a linear order. For example, the optimal way to pay 9 rupees when negatives are allowed is to break it up as (+10,-1), and calculating from 0 onwards (as we do in the DP) is not efficient.

For this reason, I’ve used an implementation of Dijkstra’s algorithm to determine the minimum number of coins to be used to pay any amount when cash back is allowed. Each amount is a node in the graph, with an edge between two amounts if the difference in amounts can be paid using a single coin. So there is an edge between 1 and 11 because the difference (10) can be paid using a single coin. Since cash back is allowed, the graph need not be directed.

So all we need to do to determine the way to pay each amount most optimally is to run Dijkstra’s algorithm starting from 0. The breadth first search has complexity \$latex O(M^2 n)\$ where $M$ is the maximum amount we want to pay, while $n$ is the number of coins.

I’ve implemented this algorithm using R, and the code can be found here. I’ve also used the algorithm to compute the number of coins to be used to pay all numbers between 1 and 10000 under different scenarios, and the results of that can be found here.

You can feel free to use this algorithm or code or results in any of your work, but make sure you provide appropriate credit!

PS: I’ve used “coin” here in a generic sense, in that it can mean “note” as well.

## Moving towards a cashless economy

In any transaction, the process of payment is a pain. It is a necessary step, of course, in that payment is what completes the transaction, but the process of payment is not something that adds any value to the transaction. If money could be magically be transferred from buyer to seller at the end of a transaction, both transacting parties would be happy.

In this context, any chosen method of payment, be it cash or credit card or cheque or bank transfer, involves some degree of pain for the transacting parties.

In case of cash, there’s the problem of counting out the money, cross checking it, finding exact change, being able to handle currency without the fear of being robbed, and making sure the currency is not counterfeit. Cheques have a credit risk, since they can bounce, not to speak of the time it takes to write one, and the time it takes for the money to get transferred.

Bank transfer requires parties to have bank accounts, and the ability of transacting parties to tell each other their account details. Credit cards have the most explicit pain of transaction – the transaction fees the merchants need to pay the acquiring bank – apart from the time and pain of swiping, entering the PIN, etc.

The reason India has so far been a primarily cash economy is that the pain of transacting through cash has been far lower than the pain through other means. Apart from the pains mentioned above, cash also has the advantage of anonymity, speed of transaction and ability to hide from the tax authorities.

So if we have to turn India closer to a cashless economy, as the current union government plans to do, we need to either increase the pain of transacting in cash, or reduce the pain of transacting through another means. The Unified Payments Interface (UPI), which was launched with much fanfare earlier this year but has spectacularly failed to take off, seeks to reduce pain of cashless transactions. The government’s efforts to get people open bank accounts through the Pradhan Mantri Jan Dhan Yojana (PMJDY) also seeks to reduce pain in non-cash transactions.

The government’s recent effort to withdraw legal tender of Rs. 500 and Rs. 1000 notes, on the other hand, seeks to increase the cost of transacting in cash – 85% of the current stock of cash in India needs to get banked in the next 50 days. This, however, is not a repeatable exercise – it can simply remove confidence in the rupee and drive people to alternate (formal or informal) currencies.

So what can be done to move India to a more cashless economy? The problem with small change has already played its part, with most auto rickshaw and taxi drivers in Mumbai supposedly willing to accept payment in digital wallets such as PayTM. If the stock for the new Rs. 2000 and Rs. 500 notes released is low, and most people have to transact using Rs. 100 notes, that will again increase the pain of transacting in cash, since the cost of handling cash might go up.

Perversely, if crime and robberies increase, that will again make people wary of handling cash. In fact, as this excellent piece in the New Yorker claims, the reason Sweden has moved largely cashless is that people got scared of handling cash after a series of cash robberies a few years ago. The cost of higher crime, however, means this is not a desirable way to go cashless.

It’s been barely three days since the new Rs. 500 and Rs. 2000 notes have been released, and there are already reports of counterfeiting in these notes. Given the framework I’ve proposed in this blogpost, it is not inconceivable that these rumours have been planted – when people become more wary of receiving large currency (thanks to the fear of counterfeiting), they want to reduce the use of such physical currency.

It’s perverse, I know, but nothing can be ruled out! As I’ve repeatedly pointed out, increased use of cash has a fiscal cost (in terms of printing and maintaining currency, apart from people not paying taxes), so the government has an incentive to stamp it out.

## When is a war a war?

War is an inherently political instrument used to achieve a political objective, so a credible political adversary is necessary for war to be war.

As the US Presidential election race hots up (or gets more one-sided, depending upon your interpretation), people continue to refer to former President George W Bush leading the US into two “wars” in Iraq and Afghanistan. Thinking about it, I’m not sure the two can actually be classified as wars.

To use a chess analogy, real wars seldom end in checkmate – they most often end in resignation, or an agreed draw. War is an instrument that is used to achieve a political objective, to get the other party to do what you want them to do.

And so war ends when one side has established such an utter dominance over the other that the counterparty decides that to resign, or “surrender” is superior to continuing fighting the war.

For this to happen, however, the counterparty needs to have a political leadership that is able and willing to take a decision, following which the war actually stops. In the absence of such a political leadership, the war will continue indefinitely until “checkmate”, and assuming that the losing side’s force “decays exponentially”, it can take a really long time for it to actually get over.

So based on this definition that war is a political instrument used to achieve a political objective, I’m not sure what happened in Iraq and Afghanistan can actually be classified as “war”.

The “government” of the day in Afghanistan (Taliban), for example, would have never come to the negotiating table with the US, so short of complete annihilation, there was no other “objective” that the US could achieve there.

Iraq, on the other hand, possessed credible political leadership (Saddam Hussein) when the US invaded, but by actually killing him, the US denied themselves the chance of a “real victory” in terms of a negotiated settlement. A game of chess might end when the king is mated (remember that the king never “dies”, only trapped), but in a situation such as Iraq, the battle will rage until each member of the opposing force is taken out.

And so fighting continues to this day, over a decade since it started, with no hope of it ending in the near future. Real wars never go on indefinitely.

## Water, IPL and the ease of doing business

The latest controversy surrounding the just-about-to-start ninth edition of the IPL (a court case challenging its staging in Maharashtra while farmers are dying in Vidarbha) is a clear illustration of why the ease of doing business in India doesn’t look like it will improve.

At the bottom of it, the IPL is a business, with the IPL and teams having invested heavily in team building and marketing and infrastructure. They have made these investments so far hoping to recover them through the tournament, by way of television rights, gate receipts, etc.

Now if the courts were to suddenly decide that the IPL should not take place in Maharashtra, it will mean that alternate arrangements will have to be found in terms of venues and logistics, teams which have prepared grounds in Nagpur, Pune and Mumbai will have to recalibrate strategies, and most importantly, the people of these cities who have bought tickets (they clearly believe that the value of these tickets is higher than the price) will also end up losing.

Farmers dying for lack of water is a real, and emotive, issue. Yet, to go after a high-profile event such as the IPL while not taking other simpler measures to curb fresh water wastage is a knee-jerk reaction which will at best have optical effects, while curbing the ability of businesspersons to conduct legitimate business.

There has been much talk about how policy measures such as the retrospective taxation on Vodafone or Cairn have been detrimental to investor sentiment and curbed fresh investments in India. This court case against the IPL days before it began is no different, and a strong signal that India’s policy uncertainty is not going away quickly.

Unless the political class manages to fix this, and provide businesses more stable environments to operate in, it is unlikely we’ll see significant increase in investments into India.

## The land above the tracks

Almost exactly a year ago, we were on our way from Vienna to Budapest and ended up reading the Vienna Hauptbahnhof Railway Station some three hours early. It had been snowing that morning in Vienna (it was April 1st, and supposed to be spring), and not wanting to go anywhere in that shit weather, we simply got to the railway station. It didn’t help matters that our train (which was coming from Munich) had been delayed by a further hour.

We were not short of options for entertainment in at the railway station, though. In fact, it hardly looked like a railway station, and looked more like a mall – for there were no tracks to be seen anywhere. We spent the four hour wait shopping at the mall (it was just before Easter, so there were some good deals) and having breakfast and lunch at what could be considered to be the mall food court. And when it was time for our train to arrive, we simply took one of the escalators that went down from the mall, which deposited us at our platform.

Each platform had its own escalator going down from the mall, which had been built on top of the railway tracks. It can be considered that the entire Vienna Hbf station was built on the “first floor”, making use of the land above the railway tracks. Land that would otherwise be wasted was being put to good use by building commercial space, which apart from generating revenues for the Austrian Railways, also made life significantly better for passengers such as us who happened to reach the station insanely early.

This is a possible source of revenues that Indian Railways would do well to consider, especially in large cities. The Railways sit on large swathes of land above and around the rail tracks, especially at stations (where such tracks diverge). Currently, the quality of experience in Indian railway stations is rather poor. If a swanky mall (and maybe other commercial space) were to come up above the tracks, it could completely transform the railway experience.

There will be considerable investment required, of course, but given the quality of real estate on which most Indian railway stations sit, it is quite likely that private developers can be found who will be willing to invest in constructing these “railway station malls” in return for a share of subsequent rent realisation. There is serious possibility for a win-win here.

As the Vienna Hbf website puts it,

The BahnhofCity Wien Hauptbahnhof features 90 shops and restaurants occupying 20,000 m² of floor space. A fresh food market, textile shops, bakeries and cafés are designed to make BahnhofCity a meeting place. During the week, it will be opened until 21:00 and many shops will also open on Sundays. Excellent public transport links and 600 parking spaces complement the offer.

An idea well worth considering for the Indian Railway Ministry.

## Maximum Retail Price is a conspiracy by FMCG companies

A few months back, Anupam Manur, a colleague at the Takshashila Institution, had written an Op-Ed in The Hindu that the Maximum Retail Price (MRP) mechanism is archaic and needs to be shelved.

Introduced in 1990 by the Department of Civil Supplies, this regulation governs that the maximum price at which packed goods can be sold be printed on the packet, and makes any transactions at a price higher than this price illegal. This was intended to be a mechanism to protect consumers from usurious shopkeepers (remember this was introduced just before economic reforms were launched), and Anupam’s piece also treats the intention as such.

Having now briefly lived in a country with no such regulations (Spain), I must say that my entire perspective of how retail works has been turned upside down (and this, having spent a year consulting for a major retail chain in India).

The existence of the MRP in India means you tend to look at everything in retail from that perspective – the manufacturer/packager, for example, can set margins (a percentage of the MRP) that each segment of the supply chain can earn. As a consequence, players in the chain have little leverage on what prices to charge – at best, they can forego a part of their (usually tiny) margins in order to drive sales.

Without the existence of MRP, however, the (power) equation is turned upside down. Two supermarkets close to my home in Barcelona (about 200m from each other), for example, charge €0,79 and €0,96 respectively for identical cartons of milk (of the same brand, etc.). This price difference (17% or 21% the way you look at it) of a retail commodity between two nearby stores would be impossible to see in India.

Given the broad similarity in these two supermarkets, it is unlikely that there’s too much difference in what they would have paid to procure these cartons of milk. In other words, one supermarket makes a far higher margin selling this milk (which is possibly compensated by the other’s higher sales).

In other words, in a market without MRP, the manufacturer/brand loses control over the pricing once he has sold products down the chain – it is up to the respective player in the chain to determine what he will charge for from his buyers, and thus manage his own revenues. While free markets mean that prices of products broadly converge across stores, the manufacturer/brand can do little in order to dictate them beyond a point.

With this kind of pricing power missing from retailers in a market like India (with MRP), the retailer is at a greater mercy of the manufacturer. The manufacturer can allow the retailer some leeway in pricing, for example, by setting an artificially high MRP, but the question is whether the manufacturer wants the retailer to have this leeway.

Under the current system (MRP), the retailer is mostly at the mercy of the manufacturer. The manufacturer has bargaining power over how much stocks to distribute to the retailer and when, and there is little leeway for the retailer to manage his stocks intelligently. In fact, for some products, manufacturers even control discounts and don’t allow retailers to sell below a particular price (threatening to stop supplies in case they do so). Without the MRP, this kind of coercion on behalf of manufacturers will be significantly reduced.

In this context, it is useful to look at the MRP as a tool that shifts the balance of power in the packaged goods supply chain in favour of the manufacturers/brands and away from the retailers. As Anupam has established in his piece, customers don’t necessarily benefit from this regulation. They are merely an excuse for manufacturers of packaged goods to exert bargaining power over the retailers.

In other words, the MRP is a conspiracy by the FMCG companies, who stand to benefit most from such regulations (at the cost of retailers and customers).

With the current union government supposedly enjoying support of the trading community, there is no better opportunity for this MRP regulation to go.

## Investment banks, scientific research and cows

I’ve commented earlier on this blog about how investment banks indirectly fund scientific research – by offering careers to people with PhDs in pure sciences such as maths and physics.

The problem with a large number of disciplines is that the only career opportunity available to someone with a PhD is a career in academia. Given that faculty positions are hard to come by, this can result in a drop in number of people who want to do a PhD in that subject, which has the further effect of diminishing research in that subject.

Investment banks, by hiring people with pure science PhDs, have offered a safety net for people who haven’t been able to get a job in academia, as a consequence of which more people are willing to do PhDs in these subjects. This increases competition and overall improves the quality of research in these topics.

Beef is like investment banks to the dairy industry. I recall an article (can’t recall the source and link to it, though) which talked about V Kurien of Amul going to a meeting called by the Union government on banning cow slaughter. Kurien talked about his mandate from his cooperative being that everything was okay as long as cow slaughter wasn’t banned – for that would kill the dairy industry.

Prima facie (use of latin phrase on this block – check)  this might sound like a far-fetched analogy (research to cows). However, cow slaughter has an important (positive) role to play in encouraging the dairy industry.

When you buy a cow, you aren’t sure how good it is in providing milk, until you’ve put it through a few cycles of childbirth and milking. If after purchase it turns out that the cow is incapable of producing as much milk as you were promised, it turns out to be a dud investment – like getting a PhD in a field with few non-academic opportunities and not being able to get a faculty position.

When cow slaughter is permitted, however, you can at least sell the cow for its meat (when it is still healthy and fat) and hope to recover at least a part of the (rather hefty) investment on it. This provides some kind of a “safety net” for dairy farmers and encourages them to invest in more cows, and that results in increasing milk production and a healthier dairy industry.

This is not all. Legal slaughter means that there is a positive “terminal value” that can be extracted from cows at the end of their milking lives. Money can also be made off the male calves (cruel humans have made the dairy industry one-to-many. Semen from stud bulls is used to impregnate lots of cows, and most bulls never get to fuck) which would otherwise have negative value.

A ban on killing cows implies a removal of these safety nets. Investing in cows becomes a much more risky business. And lesser farmers will invest in that. To the detriment of the dairy industry.

There are already reports that following the ban on cow slaughter in Maharashtra last year, demand for cows is going down as farmers are turning to the more politically pliable buffaloes.

Similarly, with the investment banking industry seeing a downturn and the demand for “quants” going down, it is likely that the quality of input to graduate programs in pure science might go down – though it may be reasonable to expect Silicon Valley to offer a bailout in this case. Cows have no such luck, though.

## Simulating segregation

Back in the 1970s, economist Thomas Schelling proposed a model to explain why cities are segregated. Individual people choosing to live with others like themselves would have the macroscopic impact of segregating the city, he had explained.

Think of the city as being organised in terms of a grid. Each person has 8 neighbours (including the diagonals as well). If a person has fewer than 3 people who are like himself (whether that is race, religion, caste or football fandom doesn’t matter), he decides to relocate, and moves to an arbitrary empty spot where at least 3 new neighbours are like himself. Repeat this a sufficient number of times and the city will be segregated, he said.

Rediscovering this concept while reading this wonderful book on Networks, Crowds and Markets yesterday, I decided to code it up on a whim. It’s nothing that’s not been done before – all you need to do is to search around and you’ll find plenty of code with the simulations. I just decided to code it myself from first principles as a challenge.

You can find the (rather badly written) code here. Here is some sample output:

As you can see, people belong to two types – red and blue. Initially they start out randomly distributed (white spaces show empty areas). Then people start moving based on Schelling’s rule – if there are less than 3 neighbours of the same kind, you move to a new empty place (if one is available) which is more friendly to you. Over time, you see that you get a segregated city, with large-ish patterns of reds and blues.

The interesting thing to note is that there is no “complete segregation” – there is no one large red patch and one large blue patch. Secondly, segregation seems rather slow at first, but soon picks up pace. You might also notice that the white spaces expand over time.

This is for one specific input, where there are 2500 cells (50 by 50  grid), and we start off with 900 red and 900 blue people (meaning 700 cells are empty). If you change these numbers, the pattern of segregation changes. When there are too few empty cells, for example, the city remains mixed – people unhappy with their neighbourhood have no where to go. When there are too many empty cells, you’ll see that the city contracts. And so forth.

Play around with the code (I admit I haven’t written sufficient documentation), and you can figure out some more interesting patterns by yourself!