Please visit my new campsite listing site ukcampingmap.co.uk


Posts Tagged ‘pizza’

More pizza squabbles

Saturday, May 2nd, 2009

The other day I ruminated on whether going for the smallest slice of pizza initially will result in your getting more in the long run than going for the biggest first, and concluded that I should try and write a computer model of it, which I have now done (bear in mind the page is a bit slow to load), to a degree.

The graphs below, plotting number of pizza slices vertically (increasing as you go down) and number of people horizontally (increasing to the right), and average over 100 trials per slices/people combination, show that there is a small area, when the number of people is roughly equal to half the number of pizza slices, and the number of people is not too big, where taking the smallest available slice on the first go pays off. But an even better strategy under these circumstances is to take the smallest of the N largest slices, where N is the number of people.

Graphs of pizza slice taking strategies

Graphs of pizza slice taking strategies

There are lots of alterations I’d like to make to the model, as it’s not quite a true reflection of reality.

  1. Add the ability to have people eating at different rates.
  2. At present the sizes of the slices are chosen randomly (and then normalised to make sure the total size is equal to the number of slices). However, the distribution in real life pizza slice sizes is far from random; they will probably have roughly a normal distribution, with very few extra big slices and very few extra small ones. Because the size of one slice is not independent of the sizes of other slices, they are likely to follow a more complex distribution, but it’s probably beyond me to work out what it is.
  3. The colours are nowhere near contrasting enough. I’ve done a bit of a fiddle on the greens to bring them out a bit more, but it’s a bit of a cheat that probably won’t always work. There are regions in the graph where one strategy is consistently slightly better than the other, but it doesn’t show. A high contrast version (below) does show this info (and in fact also showing that most of the time you’re better off wtha smaller slice first strategy if more than two slices per person), but I think it’s important to show the subtleties too.
    pizza-slices-high-contrast
  4. The slow loading is an issue.

For the record, now that I know how OOP works in PHP I used my new skills to write the model, and it was most useful. Much easier to keep track of what values you’ve written to where.

How to get the biggest slice of pizza

Sunday, April 26th, 2009

It’s always a battle trying to eat enough pizza when it’s being shared between friends. It’s believed, in fact, to be the cause of the Crimean war.

But is there an optimal strategy to make sure you get the most pizza you can?

To date I have always followed a “take the biggest piece that’s left” strategy, but ruminating on this has led me to the following conclusion: taking the biggest piece still on the plate isn’t necessarily the best way to maximize the amount of pizza you eat.

Suppose a pizza, P, is sliced into n Slices, s1, …,  sn, ordered such that their areas a1, …, an form a decreasing sequence.  Also assume that the time taken to eat a slice is proportional to its area, i.e. tn = can. Further assume that everyone eats at the same speed and that there is a set polite interval – T – between one person taking a slice and the next person taking theirs.

We will concentrate on the smallest remaining slice and the largest.

Assume you take slice k (the largest remaining). Then the person who took a slice before you (presumably the largest available slice, if they play the traditional pizza game) has time tk + T = cak + T to finish his slice in order to guarantee he finishes before you, and therefore get to pick a bigger slice than you next time. The time it takes them to eat their slice is tk-1 = cak-1. So for him to get a bigger next slice than you:

cak-1 <cak + T
ak-1 -ak < T/c

However, if you take the smallest slice available instead of the largest this changes to

ak-1 -an < T/c

which, if the difference in size between slices is great,  is considerably less likely. Therefore you would be considerably more likely to get to choose before your predecessor next time, and thus securing a bigger slice should you show wish. Now you would have eaten slice an and picked another slice before he’s finished his first.

This strategy won’t always pay off though, and it’s difficult to judge when it would be effective. For instance, say there are very few slices available; If all slices are taken before you finish slice an then you lose out but, on the other hand, if you are the only person quick enough to finish their first slice in time to grab the one remaining slice after the first round, then you win.

It may be worth trying to write a computer model of.