Class Tree | |
---|---|
Description |
Problem description ================ The blocked N-queens problem is a variant of the N-queens problem. In the blocked N-queens problem we have an N X N board and N queens. Each square on the board can hold at most one queen. Some squares on the board are blocked and cannot hold any queen. A conflict arises when any two queens are assigned to the same row, column or diagonal. A blocked N-queens is an assignment of the N queens to the non-blocked squares of the board in a conflict-free manner. The input of the blocked N-queens problem specifies the blocked squares on the board, and the number N of queens. Input Format ================ The input of the blocked N-queens problem specifies the blocked squares on the board, and the number N of queens. Input data are stored in a plain text file, The format of the file is as follows: a. The file starts with N lines that define the size of the problem (the number of queens, and all row and column indices) using a predicate "num". num(1). num(2). ... num(N). b. The file then specifies the squares on the board that are blocked, using a predicate "block". Each line has the form "block(i,j).", meaning that the square in row i and column j is blocked. Example input: num(1). num(2). num(3). num(4). block(1,1). block(2,2). block(4,3). Output format ================ The solution must be encoded by a binary predicate "queen" , where "queen(i,j)" stands for "there is a queen in square (i,j)''. For the example input given above, the following is a valid assignment: queen(2,1) queen(4,2) queen(1,3) queen(3,4) The corresponding answer set produced by a solver must contain exactly these ground atoms of the form queen(i,j) . Authors: Gayathri Namasivayam and Miroslaw Truszczynski Affiliation: University of Kentucky Email: {gayathri, mirek}@cs.uky.edu |
Encodings 1 - 4 of 4 |
|