Sunday, February 16, 2014

Finding the efficient way to move 4 cheeses.

For some time now I, along with my teammates, have been trying to find a way to move the all the cheese from one stool to another. We have been given a way that actually works and it goes like this:

  • For a cheese stack of 1 cheese round, simply move the cheese to the destination.
  • If the stack has n cheese rounds (n > 1), we need to think of a number i which should be between n-1 and 1. Then we have a three step process for moving the stack:
  1. Move n - i rounds to an intermediate stool.
  2. Move i cheese rounds to the destination, using the only three available stools.
  3. Move the n - i rounds of cheese from the intermediate stool to the destination stool
Okay, so we have a nice way of doing things which can easily be applied recursively into a computer program, so far so good. But there is one huge problem keeping us from doing that. That problem is the number i itself. How can we find the most efficient i on each step of the recursion? 

This is the hard part of this assignment. The way I coped with this problem was quite painful, but it worked. It took a handful of unsuccessful attempts and a few hours spent trying various different ways to solve this problem until I found a good way to solve this.

What I did was, I tried to move the cheese manually(okay not real cheese, just crappy illustrations on paper) and record the i for every n which gave the most efficient number of moves. After a certain point I tried to find a formula to get the i. I got a few different formulas which gave close enough i's, but after a few of those attempts I figured out a formula that worked. I don't actually know if it worked for enormous numbers but it worked at least up until 25 rounds of cheese so, I just went ahead and used it.

The deadline is already passed but I don't know if I am allowed to give the formula out. Anyways, have a nice week!

No comments:

Post a Comment