Figure 3 - uploaded by Maureen Doyle
Content may be subject to copyright.
Source publication
Abstract Chessboard separation problems are modiflcations to classic chess- board problems, such as the N Queens Problem, in which obstacles are placed on the chessboard. This paper focuses on a variation known as the N + k Queens Problem, in which k Pawns and N + k mutually non-attacking Queens are to be placed on an N-by-N chess- board. Results a...
Context in source publication
Context 1
... Suppose there is a row or column with p pawns such that two of the pawns are adjacent. A queen can not be placed between the two adjacent pawns, therefore the row or column can be divided into at most p parts. Suppose there are p queens in a row with p pawns, two of which are adjacent. There are k − p pawns in the other rows, and at most k − p + N − 1 queens can be placed in those rows. For this arrangement, p + k − p + N − 1 = N + k − 1 queens can be placed. This contradicts the given that the board has N + k queens placed on it. Typical backtracking solutions for the N Queens Problem use N recursive calls, placing a queen in row i for each recursive call i . For the N + k Queens Problem, there are N + 2 k recursive calls. The first k calls place k pawns on the chessboard, dividing the rows and columns of the chessboard into N + k row segments and N + k column segments. The remaining N + k calls recursively place a queen on a segment. Figure 1 illustrates the row segment assignment for a pawn placement when k = 2 , N = 5. The initial backtracking implementation made N + k recursive calls for each row segment. A queen was placed in each valid column for the row segment. The row or row segment selection was the i th row or row segment for the i th recursive call. The new row selection criteria is a modification of Knuth’s “organ pipe ordering” defined in [8]. Instead of placing a queen in the i th row for the i th recursive call, each recursive call selects the most constrained row or column. The most constrained row or column is defined as the row or column with the fewest squares available for placing a queen. Differing from Knuth in the case of a tie, both of our implementations of backtracking and dancing links simply select the first encountered row or column. The general algorithm is given in Figure 2. Dancing links was introduced in 1979 by Hitotumatu and Noshita [7] and popularized by Knuth in 2000 [8]. Knuth provides an excellent explanation of the Dancing Links algorithm, which is a technique to implement Knuth’s Algorithm X to solve exact cover problems. We provide an abbreviated explanation here for completeness. Dancing links is a technique involving a quadruply linked-list data structure and an exhaustive search algorithm. When using dancing links to solve chessboard problems, a header node is connected to 6 N − 2 column header nodes. Each column header node represents a unique row ( N ), column( N ), lower diagonal(2 N − 1) or upper diagonal(2 N − 1) from the chessboard. Each column of the DLX structure contains its column header node and also one node for each chessboard block in that row, column or diagonal. Therefore, there are N nodes in the DLX column for the chessboard row and columns. There are between 1 and N nodes in the columns representing the diagonals. Finally, each chessboard block is represented by four horizontally connected nodes, one for the blocks row, one for its column, one for its upper diagonal and one for its lower diagonal. Figure 3 shows a two-by-two chessboard and its dancing links data structure. Knuth defines the algorithm with three methods solve , cover , and un- cover . The main method, solve , is called recursively, once for each queen when solving the N Queens Problem. solve chooses a DLX structure column for placing a queen and iterates through all queen positions (nodes) available in the column, calling itself recursively for valid queen placements. The recursion halts and returns when a solution is found, or all positions have been tried. Based on the initial success of dancing links in [3], the use of nested dancing links was explored. In [3], N + k Queens was solved by first computing all valid pawn placements, and then solving the resulting data structure. Modifications to the dancing links data structure is minimal when ap- plying it to the N + k Queens Problem. Each valid pawn placement divides up to four columns in the DLX structure: a chessboard row, chessboard column, and up to two diagonal columns. The pawn can not attack, so no covering nor uncovering of additional nodes is required. Once all k pawns are placed, solve is called to place N + k queens. The placing of the pawns requires three new methods nkQueens , pla- cePawn , and removePawn and no changes to existing N Queens code. The main method, nkQueens , is called with nkQueens(0,k,N, 0, 0) and is defined in Figure 4. nkQueens is recursively called k times to place the k pawns. Once the pawns have been placed, this method calls solve to place the queens. For simplification, this algorithm does not include either of the pruning criteria established in Section 2.1. The parallel results were generated using a 16-node, Pentium D 2.8 GHz Beowulf-like cluster with gigabit Ethernet. The head node has 2GB of RAM and the other nodes each have 1GB of RAM. The cluster runs the Fedora Core 5 operating system and utilizes the Open Source Cluster Application Resources (OSCAR) software package [11]. The implementation was in C++ using Message Passing Interface (MPI). Initial results for comparing backtracking and dancing links were done using the head node of the cluster. Two sequential approaches were first examined for solving the N + k Queens Problem. The sequential implementations were run on a single-processor PC. Table 1 contains the timing results for the N + k Queens problem, varying N and k, for the two solvers. Each timing result is the average at least five runs of the algorithm for the specific combination of ( N, k ). For run times larger than one second, the fastest average time is highlighted in bold . Table 1 shows that if both backtracking and DLX use the “organ pipe ordering” then backtracking is sometimes faster for smaller N . However, as N increases, the initial overhead required to create the DLX data structure is not so predominant and the faster algorithm is DLX by an order of magnitude. As shown in the previous section, DLX is more efficient than backtracking. As a result of this, only DLX was modified to solve the N + k Queens Problem in parallel using a Beowulf-like cluster. The parallel version of DLX parcels the problem out to different processors based on the positions of the first pawn. By ordering the chessboard ascending by row then by column, and enforcing the rule that no pawn is permitted to be placed adjacent to another pawn horizontally or vertically, we are able to ensure that we do not duplicate any pawn positions. Each processor is initially assigned one unique starting pawn position. The first pawn is placed and the algorithm proceeds solving the N + k Queens Problem using the sequential algorithm. Once all possible pawn combinations are tried, given the starting pawn position, the processor is assigned another starting pawn position. We examined dividing starting pawn positions by segmenting the chessboard, but observed for small N that the work was not evenly distributed among the processors. To mitigate this, a round-robin approach is used instead. Given P is the total number of processors, p is the processor iden- tifier, where 0 ≤ p < P , and N is the number of queens, then the starting row and column ( r ( i ) , c ( i )) for each pawn, i , is computed ...
Citations
... For example, Zhao determined that three pawns were necessary and sufficient to allow six independent queens on a 5 × 5 board [3]. Chatham et al. further explored the concept of placing pawns on a chessboard as obstacles in order to obtain "separated" chessboard graphs with altered graph parameters [4][5][6][7], with an emphasis on aspects of the "n + k queens problem" of finding arrangements of n + k independent queens and k pawns on an n × n chessboard. Only a few results were found regarding independence-separation on rook's and bishop's graphs. ...
For a chessboard graph and a given graph parameter π, a π separation number is the minimum number of pawns for which some arrangement of those pawns on the board will produce a board where π has some desired value. We extend previous results on independence and domination separation. We also consider separation of other domination-related parameters.
... It was conjectured in [8] and proved in [6] that for each k ≥ 0, there is a number N (k) depending on k such that if N > N (k) then the N +k queens problem has at least one solution. In [7] algorithms that count the number of solutions to the N + k queens problem for various values of N and k were presented and compared. The first-named author of this paper recently considered symmetric solutions to the N + k queens problem in [5] and showed that all solutions to the N + k queens problem (where N > 1) are of one of the following three types: ...
... Results. N + k queens solutions have been obtained using an obviously parallel implementation of Algorithm X as discussed in [7]. We also wrote a standard backtracking algorithm. ...
... Given are both the total number of solutions and the total number of fundamental solutions, the latter referring to solutions that cannot be transformed into one another by rotations and/or reflections. [6,7] found solutions to the general N + k queens problem by enumerating all possible configurations of k pawns on the N × N chessboard, subject to certain constraints, and for each such configuration using an implementation of Knuth's Algorithm X to place the queens. Algorithm X is a backtracking algorithm that uses a data structure that Knuth calls Dancing Links (DLX) [11]. ...
Chessboard separation problems are modifications to classic chessboard problems, such as the N queens problem, in which obstacles are placed on the chessboard. The N + k queens problem requires placements of k pawns and N + k mutually non-attacking queens on an N -by-N chessboard. Here we examine centrosymmetric (half-turn symmetric) and doubly centrosymmetric (quarter-turn symmetric) solutions to the N + k queens problem. We also consider solutions in which the queens have a different type of symmetry than the pawns have.
... For more information about the N queens problem, see [7], [15], and [16]. For more about the N + k queens problem and related problems, see [6], [4], and [5] (Preprints are available online at [3]). For those interested in alternating sign matrices, we suggest [1], [2], and [12]. ...
Given a regular chessboard, can you place eight queens on it, so that no two queens attack each other? More generally, given a square chessboard with N rows and N columns, can you place N queens on it, so that no two queens attack each other? Figure 1. A solution to the eight queens problem. This puzzle, known as the N queens problem, is old, and famous, and has an ex-tensive history. Here we present a recently formulated elaboration, which we call the N + k queens problem. We describe some of what is known about the N + k queens problem, prove a few new results, and propose some open questions.
... For more information about the N queens problem, see [7], [15], and [16]. For more about the N + k queens problem and related problems, see [6], [4], and [5] (Preprints are available online at [3]). For those interested in alternating sign matrices, we suggest [1], [2], and [12]. ...