1 / 36

The Towers of Hanoi problem with a relaxed placement rule

The Towers of Hanoi problem with a relaxed placement rule. Main paper: Optimality of an Algorithm Solving the Bottleneck Tower of Hanoi Problem – Yefim Dinitz & Shay Solomon Presented by: Rotem Golan & Carmel Bregman Department of Computer Science Ben-Gurion University of the Negev.

neona
Télécharger la présentation

The Towers of Hanoi problem with a relaxed placement rule

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Towers of Hanoi problem with a relaxed placement rule Main paper: Optimality of an Algorithm Solving the Bottleneck Tower of Hanoi Problem – YefimDinitz & Shay Solomon Presented by: Rotem Golan & Carmel Bregman Department of Computer Science Ben-Gurion University of the Negev

  2. Problem definition • The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. • The objective of the puzzle is to move the entire stack to another rod, obeying the following rules: • Only one disk may be moved at a time. • Each move consists of taking the upper disk from one of the rods and sliding it onto another rod, on top of the other disks that may already be present on that rod. • No disk may be placed on top of a smaller disk.

  3. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  4. Some applications • The Tower of Hanoi is used as a backup rotation scheme when performing computer data backup where multiple tapes/media are involved. • For example, FIFO is the simplest backup scheme. It saves new or modified files onto the oldest media in the set. • By using the optimal solution for the Towers of Hanoi problem, every tape is associated with a disk in the puzzle, and every disk movement to a different peg corresponds with a backup to that tape. So the first tape is used every other day , the second tape is used every fourth day , the third tape is used every eighth day .

  5. Some applications (Cont.) • It is a 'smart' way of archiving an effective number of backups as well as the ability to go back over time • The Tower of Hanoi is also used in psychological research on problem solving. • The Tower of Hanoi is popular for teaching recursive algorithms to beginning programming students.

  6. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  7. Recursive solution • If then do nothing • Otherwise • Perform • move disc  from to • Perform

  8. Correctness & optimality • We’ll use a simple induction • Basis: If then we move the disk from peg to peg and it is obviously correct and optimal. • Induction hypothesis: if we move all disks from one peg to another using a minimal number of steps. • We’ll prove that it is also true for disks. • Induction step: Before the first move of disk from source to some peg, all other disks should be moved from source to the spare peg. After the last move of disk from some peg to target, all other disks should be moved from the spare peg to target. According to the induction hypothesis, we move all disks from peg to peg and then from peg to peg using a minimal number of steps. Therefore, the algorithm moves all disks from peg to peg in a minimal number of steps.

  9. Complexity • Lets prove that • We’ll use a simple induction. • If : • Lets assume then according to the above formula and the induction hypothesis:

  10. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  11. Graphical representation • Lets define to be the number of disks • The graph edges correspond to possible moves • For • For

  12. Graphical representation (Cont.) • For

  13. Graphical representation (cont.) • The diagram for  disks is obtained by taking three copies of the -disk diagram—each one representing all the states and moves of the smaller disks for one particular position of the new largest disk—and joining them at the corners with three new edges, representing the only three opportunities to move the largest disk • As more disks are added, the graph representation of the game will resemble the Fractal figure, Sierpinski triangle. • These graphs are exponential in the number of disks () from the TOH problem. To be more precise, it has nodes.

  14. Sierpinski triangle

  15. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  16. Ants solve the TOH (2010) • The graphical representation of the Towers of Hanoi problem can be converted into a maze where living ants can search though. • Their goal will be to find the shortest path between their entrance point and a food source. • This shortest path will later be translated into a sequence of moves which solves the TOH problem optimally. • Prof. Paul K. Stockmeyerhas collected about mathematical papers on the Towers of Hanoi problem. Adding this paper to his collection might be a good idea.

  17. The results • All ant colonies tested succeeded in solving the Towers of Hanoi in the sense that they all constructed a trail between the nest and the food source. • of the colonies with exposure succeeded in finding a shortest path solution by the end of the first hour, whereas of the colonies without pre-exposure achieved this. • When one of the minimal paths was then blocked: to of the colonies with exposure were able to find the remaining minimal solution, whereas to of the colonies without pre-exposure achieved this.

  18. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  19. Relaxed definition • We generalize the problem using the following constraint: • Let a constant be given. • Disk may be placed higher then disk on the same peg only if their size difference is less then . • If the problem is equivalent to the classical version.

  20. Running example of Poole’s algorithm Small(n-1) Disk n

  21. Some definition A move sequence of a disk set is called a packet-move of if it transfers the entire set from an initial legal configuration on one peg to a final legal configuration on another peg. omitting all moves of disks in from = omitting all moves of disks in from

  22. Poole’s algorithm (1992) • Perform • Move disk from source to target • Perform • If , move all disks from source to target one by one • Otherwise • Recursively perform • Move disks in from source to target one by one • Recursively perform

  23. Complexity • Notice that the power of from the classical problem decreases to the power of

  24. Correctness & optimality of Fact: for , if some sequence of moves begins from a configuration, where disk and are gathered on peg , and finishes at a configuration, where disk and are gathered on another peg , then it contains two disjoint packet-moves of : one (from ) before the first move of disk and another (to ) after its last move. Hint: The disks in are not allowed to be placed below disk because the largest one of them is of size and .

  25. Correctness & optimality of Theorem: under the -relaxed placement rule, the length of any packet-move of is at least Proof: By a complete induction on . Basis: The case is trivial. Induction step: For any , we consider an arbitrary packet-move of , assuming the statement holds for all lesser values of . By the fact above, contains two disjoint packet-moves of ; by the induction hypothesis, their total length is at least . Every disk in must move at least once, which sums to at least k moves. Hence,

  26. Optimality of • Poole suggested the following optimality proof for : • Proof: Before the last move of disk from source to target, all disks should be moved to auxiliary. After that move of disk , all disks should be moved to target. As we proved, those transfers of disks using cannot take less than . Therefore, the minimum possible number of moves is , which is exactly the number of moves of .

  27. Optimality of (Cont.) • Poole assumed that before the unique move of disk to the (empty) target peg, all other disks must be gathered on the spare peg. • This is not general, since there may be several moves of disk n during the algorithm. Then,before the last move of disk from some peg to the target peg, any of the disks may be placed below disk on peg . • As a result, Poole had overlooked a whole group of algorithms which contained the above configuration. • In the next hour, Carmel will give you a correct and complete proof of Poole’s algorithm, suggested by YefimDinitz and Shay Solomon.

  28. A different strategy • In order to get a sense of the group of algorithms Poole has overlooked, lets examine the following strategy: • Move from to somehow • Move disks from to one by one • Move from to somehow • Move disks from to one by one • Move from to somehow

  29. A different strategy (Cont.) • Some observations: • Disk moves twice instead of once. • When moving disk for the second and last time, it has a number of other disks below it. • The disks arrive on in decreasing order. So aiming to over perform , it would be enough to find a sufficiently short triplet of consecutive packet-moves of , which results in a configuration of on . • contains four shortest packet-moves of , so this task does not seem hopeless.

  30. Outline Some Applications Classical version Graphical representation Ants solve the problem Relaxed version Further research & References

  31. Further research • Is a unique optimal solution to ? If not, what is the family of all optimal solutions? What is their number? • In the classic Tower of Hanoi problem, there are disks of different sizes, so that the exact size of each disk is not significant. However, in , it plays an important role and influence the behavior of the problem. It is interesting to allow the sizes of the disks be an arbitrary set of distinct integers.

  32. Further research (Cont.) • While the shortest perfect-to-perfect sequence of moves had been found, we do not know what is such a sequence for transforming one given (legal) configuration to another given (legal) one, and what is its length? • In particular, what is the length of the longest one among all shortest sequences of moves, over all pairs of initial and final configuration?

  33. References • Optimality of an Algorithm Solving the Tower of Hanoi Problem – YefimDinitz, Shay Solomon • Optimization in a natural system: Argentine ants solve the Towers of Hanoi – Chris R.Raid, David J. T. Sumpter and Madeleine Beekman • The Tower of Hanoi: A Bibliography - Paul K. Stockmeyer

More Related