Download presentation

Presentation is loading. Please wait.

Published byStefan Mowatt Modified over 3 years ago

1
1 of 19 Dancing Links and N + k Queens Funded by: Kentucky NSF EPSCoR: UKRF 3046884400-07-419 John Miller (millerj10@nku.edu) 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) 78910111213141516DLX000.01600.0310.1090.5783.6120.578117.407 Backtrack00000.0310.1561.0635.59439.422249.5

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 = 6 0.4830.242440.57941 70.335540.2998781.431793 80.1827672.5803120.5701 91.25939825.70771308.6757 107.87423200.94413415.678 1150.535451885.451 … k = 1 2345 n = 6 0.22680.4880.278910.1096030.310351 70.43930.176280.1363130.847484.237 80.211510.613980.55374.68189432.50463 90.726530.2228661.89289720.63466190.9521 100.3917340.8422836.22865883.95071975.2149 112.319155.34268527.8432288.88363931.816 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 610.4830.22682.12963 710.335540.43930.763806 810.1827670.211510.864106 911.2593980.726531.733443 1017.874230.39173420.10096 11150.5354492.3191521.7905 620.242440.4880.496803 720.2998780.176281.701146 822.580310.613984.202596 9225.7077050.222866115.3505 102200.9441420.842283238.5708 1121885.4511445.342685352.9033 630.579410.278912.077408 731.4317930.13631310.50372 8320.5700990.553737.15026 93308.675711.892897163.0705 1033415.6780176.228658548.3811

17
17 of 19 Parallel Results Approach to implementing with MPI 43657 0527467 1617356 27062 4 5 3705134 4614023 52301 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.

Similar presentations

OK

The Equivalence Number and Transit Graphs for Chessboard Graphs B. Nicholas Wahle Morehead State University.

The Equivalence Number and Transit Graphs for Chessboard Graphs B. Nicholas Wahle Morehead State University.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on use of technology in agriculture Ppt on spiritual leadership training Free download ppt on chemical bonding Ppt on media revolution entertainment Ppt on logic gates class 12 Ppt on earthquake for class 5 Ppt on types of research methods and designs Ppt on earth movements and major landforms in hawaii Ppt on vegetarian and non vegetarian diet Pptm to ppt online converter