Well, I know I have already described a few details about cake cutting algorithms on my another blog. But now I would like to write down about this interesting problem in detail. Actually, I happen to come across a very interesting book “Cake Cutting Algorithms : Be Fair If You Can”. The book is written in so lucid manner that even a person without any computer science background will be able to understand most of it.
Problem : Given a cake divide the cake between Pinku and Rinku in a fair manner.
The word “fair” is tricky over here. How do we define “fair”? Actually, meaning of this word is subjective. What is fair to one person may be injustice to another. If we give 2/3 cake to Pinku, he might think that division is “fair”. Pinku might describe it as a fair division even if entire cake is given to him and none to Rinku. Of course, but such a division is not “fair” from Rinku’s perspective.
So, by “fair” we mean that both are given at least “half” portion of the cake from their own perspective. Okay, so now we have yet another word appearing in double quotes, that is, “half”. It may be the case that Pinku may like cherry and Rinku may like cream. In that case, even if all the cake to Pinku, he might think he did not get even “half” of the cake, as he thinks of cherry as more valuable as compared to rest of the portion. Similarly, Rinku may not be happy with her portion of the cake if no cream is contained in it.
Let be the function by which Pinku evaluates a given piece of cake, and let be the same for Rinku. Of course, these functions are consistent in a sense that they must obey following conditions :
- , that is, if entire cake is given then they will evaluate as they have got entire cake.
- , that if no cake is given then they will evaluate it as zero.
- if , if a piece is divided into two pieces, evaluation of sum of these two piece will be exactly equal to the evaluation of the original piece.
Given that evaluation functions obey these constraints, our task is to find out an algorithm to divide into and such that if Pinku gets , similarly for Rinku.
Let’s first try various possibilities.
Method 1 : Let Pinku cut the cake and take a piece. The remaining piece will be given to Rinku. This method will fail for obvious reasons.
Method 2 : Let Mom cut the cake into “half” and distribute the pieces to Pinku and Rinku. Well, even if Mom thinks she has cut two “halves”, Pinku and Rinku might disagree as evaluation function of Mom will differ from those of Pinku and Rinku.
Pinku might think Rinku has got 90% of the cake and Rinku might think that Pinku has received 60% of the cake. However, scenario is not bad in this case. We can just switch the pieces and both will happily enjoy their cake. The trouble starts when both of them likes the same piece.
Method 3 : The best stretagy to ensure “fair” division of cake is to let Pinku cut the cake into what he thinks two “halves” and let Rinku choose first. Clearly, Pinku is satisfied with any of the pieces because he evaluates both the pieces as 1/2. Rinku is also satisfied because she gets to choose whichever piece she thinks is bigger. This method is called “Cut and Choose Algorithm”.
Note : One might wonder, why so much fuss about cutting a cake?? Well, cake is symbolic for any resource and Pinku and Rinku are contenders for that resource. Processes contending for processor time slots, Relatives fighting for their share of inheritence, Team members trying to divide team winnings and little kids fighting for “fair” share of their favourite “cake” are all examples where cake-cutting algorithms might help us.
We will look at situations when more than two contenders are involved next time.