Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 of 19 Dancing Links and N + k Queens Funded by: Kentucky NSF EPSCoR: UKRF 3046884400-07-419 John Miller Dr. Doug Chatham Dr. Maureen.

Similar presentations


Presentation on theme: "1 of 19 Dancing Links and N + k Queens Funded by: Kentucky NSF EPSCoR: UKRF 3046884400-07-419 John Miller Dr. Doug Chatham Dr. Maureen."— Presentation transcript:

1 1 of 19 Dancing Links and N + k Queens Funded by: Kentucky NSF EPSCoR: UKRF John Miller Dr. Doug Chatham Dr. Maureen Doyle Dr. Jeffrey Ward Amber Rogers Luke Thompson

2 2 of 19 Agenda N Queens Problem Dancing Links N + k Queens Problem Finding Solutions Results Future Work

3 3 of 19 The N Queens Problem First proposed by Max Bezzel in 1848 as the 8 Queens Problem. The problem has been investigated by mathematicians since its inception, including Gauss and Cantor After solutions were found in 1850 by Franz Nauk, it was expanded to the N Queens Problem

4 4 of 19 The N Queens Problem How many ways can n Queens on an n x n chessboard so that no queen can attack another queen Commonly used to introduce recursion

5 5 of 19 What are Dancing Links? Dancing Links is a data structure that can be used to help solve any full cover problem. N + k Queens N + k Queens Sudoku Sudoku Introduced in 1979 by Hitotumatu and Noshita. Popularized by Knuth in 2000

6 6 of 19 The Dancing Links Universe Things get complicated very quickly For an n x n chessboard, the universe will have 6n-2 columns and 4n 2 +6n-1 nodes

7 7 of 19 The Dance Steps solve( int x ) if ( x = n) solution found return choose a row r for placing queen remove row r for every block b in row r place queen on block b remove b’s column remove b’s diagonals solve(x+1) replace b’s diagonals replace b’s column replace row r

8 8 of 19 Results N Queens Standard Backtracking vs. Dancing Links (DLX) DLX Backtrack

9 9 of 19 N + k Queens Problem Consider a chessboard where we have blocked k squares. This is equivalent to placing a pawn on this square. The pawns are unable to attack by default. This problem was first proposed in 1995 by Michael Anshel.

10 10 of 19 N + k Queens Problem We have shown that there exist integers n and k such that we can safely place n+k queens and k pawns on an n x n chessboard For each positive integer k and N > max{87 + k, 25k} For each positive integer k and N > max{87 + k, 25k} Also, no more than n + k queens can safely be placed on an n x n chessboard with k pawns.

11 11 of 19 Approach to Solving N + k Queens How do we take advantage of the universe with the pawns. Look at all pawn positions and split the universe. Look at all pawn positions and split the universe. Can we mimic the process of removing and replacing portions of the universe? Can we mimic the process of removing and replacing portions of the universe?

12 12 of 19 Splitting Pawns Before finding Solutions, we must split the universe based on the positions of the pawns Given a block b to place a pawn Create a new header block Move everything below b into the group Remove b from its group

13 13 of 19 Head X Pawn Y Head X Pawn Y New Head Before SplitAfter Split Notice Pawn has nothing pointing to it, but It is still pointing to its former up and down nodes Splitting Pawns

14 14 of 19 Reducing Search Space We have shown the following In order to place n + k queens and k pawns on an n x n board… In order to place n + k queens and k pawns on an n x n board… No two pawns may share an edge No pawn may be placed on the outer edge of the board No pawn may be positioned on a square adjacent to a corner square.

15 15 of 19 How fast is it on n + k Queens? k = 1 23 n = … k = n = Results obtained on: Dual Core 64-bit Athlon Processor, running red hat v4

16 16 of 19 How Fast is it? (cont.) For some small values of n and k, the cost of creating the universe outweighs the benefit. For large value of and k, the speedup of DLX is invaluable. nk BackTrack (sec) DLX (sec) Ratio

17 17 of 19 Parallel Results Approach to implementing with MPI Current results indicate a 30% speedup on a 16 node cluster We are investigating other approaches to achieve a More appropriate speedup

18 18 of 19 Logic Programming Learning when we reach a dead end… Learning when we reach a dead end… 3D Queens Can the DLX universe be extended to a 3D full cover problem Can the DLX universe be extended to a 3D full cover problem Theoretical Chess Pieces Extending movement beyond straight lines Extending movement beyond straight lines What’s Next?

19 19 of 19 References [1] CHATHAM, R. D., DOYLE, M, FRICKE, G.H., SKAGGS, R.D., AND WOLFF, M. Separating queens on the chessboard [2] KNUTH D.E. Dancing links. Millennial Perspectives in Computer Science.


Download ppt "1 of 19 Dancing Links and N + k Queens Funded by: Kentucky NSF EPSCoR: UKRF 3046884400-07-419 John Miller Dr. Doug Chatham Dr. Maureen."

Similar presentations


Ads by Google