1 / 8

Eight queens puzzle

Eight queens puzzle. Eight queens puzzle.

liora
Download Presentation

Eight queens puzzle

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. Eight queens puzzle

  2. Eight queens puzzle • The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard such that none of them are able to capture any other using the standard chess queen's moves. The queens must be placed in such a way that no two queens would be able to attack each other. Thus, a solution requires that no two queens share the same row, column, or diagonal. 1 History

  3. Computationally expensive - brute force • ietry every possibility • The problem can be quite computationally expensive as there are 4,426,165,368 (or 64!/(56!8!)) possible arrangements. It is possible to use shortcuts that reduce computational requirements or rules of thumb that avoids brute force computational techniques.

  4. Permutation and combinations. • For example, just by applying a simple rule that constrains each queen to a single column (or row), though still considered brute force, it is possible to reduce the number of possibilities to just 16,777,216 (8^8) possible combinations, which is computationally manageable for n=8, but would be intractable for problems of n=20. We can do better 8! = 40,320. Backtracking eliminates further with only 15,720.

  5. Heuristics (rules of thumb) • Extremely interesting advancements for this and other toy problems is the development and application of heuristics (rules of thumb) that yield solutions to the n queens puzzle at an astounding fraction of the computational requirements.

  6. Counting solutions • The following table gives the number of solutions for placing n queens on an n × n board, both unique and distinct • n: 1 2 3 4 5 6 7 8 • unique: 1 0 0 1 2 1 6 12 • distinct: 1 0 0 2 10 4 40 92 • Note that the six queens puzzle has fewer solutions than the five queens puzzle. • There is currently no known formula for the exact number of solutions.

  7. guarantee a solution • Note that 'iterative repair', unlike the 'backtracking' search outlined above, does not guarantee a solution: like all non-hillclimbing (i.e., greedy) procedures, it may get stuck on a local optimum (in which case the algorithm may be restarted with a different initial configuration). On the other hand, it can solve problem sizes that are several orders of magnitude beyond the scope of a depth-first search.

More Related