How to share beer fairly
Three weary wanderers reach a pub in the middle of nowhere. Bad news for them: no customers were expected, and only one liter of beer remains. The wanderers sit at the counter. Alan is not so thirsty, and picks a small glass. Bill and Carl take a big one each.
The available beer’s not enough to fill all the glasses. The bartender – not the sharpest knife in the drawer – scratches his head for a few moments. Then, he begins distributing beer from the largest glass:
The three customers look at their glasses. The allocation surely looks efficient, in the sense that no beer is wasted. If the happiness (let’s call it utility) of each customer is equivalent to the amount of beer they got, this is also a social optimum, in the sense that the sum of the utilities (or, equivalently, their average) is maximized.
But, well, it really doesn’t look like a fair allocation to Alan. Bill and Carl got so much more beer than him! The bartender shrugs, and pours some beer from Bill into Alan’s glass.
This looks much better for Alan, who’s perfectly happy. This is the type of solution obtained when the focus is on maximizing the minimum (worstcase) allocation, which is one of the simplest ways to model equity or balancing criteria in a resource allocation problem. However, the solution is still unfair for someone: Bill. Carl now has more than he got. That is definitely not fair!
Suddenly, the bartender has an idea. There you go:
This does look fair: noone can really ask for more. Indeed, this is an allocation that satisfies the socalled maxmin fairness criterion, where the minimum resource allocation is maximized, then the secondworst, the thirdworst, and so on. This is closely related to the concept of equality of Rawls [1], whose difference principle posits:
[I]n a basic structure with n relevant representatives, first maximize the welfare of the worst off representative man; second, for equal welfare of the worstoff representative, maximize the welfare of the second worstoff representative man, and so on until the last case which is, for equal welfare of all the preceding n–1 representatives, maximize the welfare of the bestoff representative man. We may think of this as the lexical difference principle.
Another equivalent^{1} definition states that an allocation is maxmin fair if there is no way to increase the utility of any user without decreasing the utility of a user with a smaller or equal utility. To put it as Robin Hood certainly would, an allocation is not fair if you can increase the utility of a peasant by stealing from a rich man.
Getting back to our friends. With the current, maxmin fair allocation, Alan’s happy, and, in a perfect Robin Hood world, Bill and Carl certainly can’t claim any more beer.
Or can they? A grin appears on Carl’s face: aha! We shouldn’t reason in terms of absolute values. In a really fair solution, each customer should get exactly the same fraction of their maximal capacity! Carl redistributes the beer:
Now both Bill and Carl get a slightly larger piece of the cake. The implicit assumption here is that the utility is proportional to the fraction of the the satisfied demand of each customer, and not to the sheer allocated quantity. Alan has something to say about this…
But the bartender’s had enough of all this petty talking. Do they want a fair allocation? Let them have the most egalitarian of them all. He fills Alan’s glass to the top, takes Bill and Carl’s glasses in his hands, and spills their content on the floor, until they have the same quantity that Alan has. ¯\_(ツ)_/¯
Oh well. This is definitely an inefficient solution, but effective in killing the discussion. Observe that all previous allocations were efficient in the sense that 100% of the resource was used. However, in less trivial situations, fair solutions (such as the maxmin fair allocation) can be significantly less efficient than solutions where the total efficiency is maximized. This tradeoff is sometimes called “price of fairness” [7].
Fairness is a concept that comes up very often when limited resources have to be shared among a set of users, each with its own utility function. In many settings, a central decision maker (we could think of a government, a network provider allocating bandwith, or even Santa Claus) has to allocate the resources to the users. Since optimizing for the average case can bring about large inequalities in the allocations, it often makes sense to consider different fairness criteria in different contexts – e.g., proportional fairness [5] is another widely studied criterion that I haven’t mentioned. In practice, compared to this simple example, things can get much more complicated: for example, the utility functions can be nonlinear, the resources can be nondivisible, and the feasible set (the set of “valid” allocations) can be nonconvex, so that determining a fair allocation requires solving hard optimization problems.
The few lines of code used to formulate and solve the allocation problems with the different criteria can be found here. The code also includes mathematical formulations for other fairness criteria. It’s quite easy to verify that, in this example, the maxmin fair solution is as fair as possible also according to proportional fairness, Gini coefficient and Jain’s index (provided we want to use all the beer; otherwise, the “egalitarian” allocation would be preferred by the latter two indices).
There’s a ton of interesting stuff that can be read on the subject: equity and fairness have been studied from different point of views in philosophy, political science and economics (especially in social choice theory), game theory (where the interaction between players is taken into account), optimization, telecommunications, so pretty much everyone can find something to chew on. I’d like to conclude with a few interesting references to read while you sip your favorite trappist beer:
 Rawls J. A Theory of Justice, 1971
 Varian, H. R. Equity, envy, and efficiency. Journal of economic theory, 9(1), 6391, 1974.
 Rabin, M. Incorporating fairness into game theory and economics. The American economic review, 12811302, 1993.
 Brams, S. J., & Taylor, A. D. Fair Division: From cakecutting to dispute resolution. Cambridge University Press, 1996.
 Kelly, F. P., Maulloo, A. K., & Tan, D. K. Rate control for communication networks: shadow prices, proportional fairness and stability. Journal of the Operational Research society, 237252, 1998.
 Radunović, B., & Boudec, J. Y. L. A unified framework for maxmin and minmax fairness with applications. IEEE/ACM Transactions on Networking (TON), 15(5), 10731083, 2007.
 Bertsimas, D., Farias, V. F., & Trichakis, N. The price of fairness. Operations research, 59(1), 1731, 2011

Almost. ↩