Question

In: Computer Science

The problem of placing k queens in an n×n chessboard. In this problem, you will be...

The problem of placing k queens in an n×n chessboard. In this problem, you will be considering the problem of placing k knights in a n × n chessboard such that no two knights can attack each other. k is given and k ≤ n2.

a) Formulate this problem as a Constraint Satisfaction Problem. What are the variables?

b) What is the set of possible values for each variable?

c) How are the set of variables constrained?

Solutions

Expert Solution

Solution:

Here, the problem is about facing k knights on a n*n chess board such that, no two knights are attacking each other.

Given in problem, k and k ≤ n2.

a) From the Constraint Satisfaction Problem(CSP),

First of all a CSP has 3 components namely X (set of variables), D (set of domains), C (set of constraints).

There is a variable which is corresponding to each knight

And, there is a variable which is corresponding to each of the n2 positions on the board.

The variables about Constraint Satisfaction Problem, X^1, X^2,........, X^n are the knights.

b) The possible values are their X-Y coordinates for each variable.

location (X^1), ....................., location (X^k).

Each and every variable has two values here. Namely, Vacant and Occupied.

c) Here, the constraint for any 2 knights doesn't attack each other. Hence, that is the all difference between the variables (X^1, ......., X^k) and attacks (Xi, Xj) for any i and j values.

attacks (Xi, Xj) is true if the square of the distance between the location Xi and Xj is equal to 5.

i.e., if (a1, a2) be the coordinates of the location X1 and (b1, b2) be the coordinates of the location Xj then,


Related Solutions

t is N queens problem please complete it //*************************************************************** // D.S. Malik // // This class...
t is N queens problem please complete it //*************************************************************** // D.S. Malik // // This class specifies the functions to solve the n-queens // puzzle. //*************************************************************** class nQueensPuzzle { public: nQueensPuzzle(int queens = 8); //constructor //Postcondition: noOfSolutions = 0; noOfQueens = queens; // queensInRow is a pointer to the array // that store the n-tuple. // If no value is specified for the parameter queens, // the default value, which is 8, is assigned to it. bool canPlaceQueen(int k, int...
I t is N queens problem please complete it //*************************************************************** // D.S. Malik // // This...
I t is N queens problem please complete it //*************************************************************** // D.S. Malik // // This class specifies the functions to solve the n-queens // puzzle. //*************************************************************** class nQueensPuzzle { public: nQueensPuzzle(int queens = 8); //constructor //Postcondition: noOfSolutions = 0; noOfQueens = queens; // queensInRow is a pointer to the array // that store the n-tuple. // If no value is specified for the parameter queens, // the default value, which is 8, is assigned to it. bool canPlaceQueen(int k,...
The N-QUEENS PROBLEM Given a chess board having N x N cells, we need to place...
The N-QUEENS PROBLEM Given a chess board having N x N cells, we need to place N queens in such a way that no queen is attacked by any other queen. A queen can only attack horizontally, vertically and diagonally. Let’s go at this one step at a time. let’s place the first Queen at some cell, (I, j) and now the number of unattackable cells are reduced. And now, the number of the Queens to be placed are N...
A special chessboard is 2 squares wide and n squares long. Using n dominoes that are...
A special chessboard is 2 squares wide and n squares long. Using n dominoes that are 1 square by 2 squares, there are many ways to completely cover this chessboard with no overlap. How many are there? Prove your answer.
Let S_k(n) = 1^k + 2^k + ··· + n^k for n, k ≥ 1. Then,...
Let S_k(n) = 1^k + 2^k + ··· + n^k for n, k ≥ 1. Then, S_4(n) is given by S_4(n)= n(n+1)(2n+1)(3n^2 +3n−1)/ 30 Prove by mathematical induction.
Logic/ Game theoryLet f(n) count the different perfect covers of a 2-by-n chessboard by dominoes. Evaluate...
Logic/ Game theoryLet f(n) count the different perfect covers of a 2-by-n chessboard by dominoes. Evaluate f(1),f(2),f(3),f(4), and f(5). Try and find (and verify) a simple relation that the counting function f satisfies. Compute f(12) using the relation. Here is a solution it is titled exercise 4a.) in the packet on page 3: http://jade-cheng.com/uh/coursework/math-475/homework-01.pdf   Not sure on how to follow the logic.
The Eight Queens Problem is a fairly old problem that has been well discussed and researched....
The Eight Queens Problem is a fairly old problem that has been well discussed and researched. The first published reference to this problem was in a German Chess magazine in 1848 by Max Bezzel. In 1850, Franz Nauck published all 92 solutions of the problem for an 8x8 board. S. Gunther in 1874 suggested a method for finding solutions by using determinants and J.W.L. Glaisher extended this method. E. Dijkstra published a detailed description of the solution of the problem...
The production function is f(K,N) = N/2 + √ K, where N is the amount of...
The production function is f(K,N) = N/2 + √ K, where N is the amount of labor used and K the amount of capital used. (a) What is returns to scale of this production function? What is the marginal product of labor? (b) In the short run, K¯ = 4. Labor is variable. On the graph, draw output as a function of labor input in the short run in blue. Draw the marginal product of labor as a function of...
Problem 5 Given a table of n integers and an integer k, make a program in...
Problem 5 Given a table of n integers and an integer k, make a program in C++ that: a) Read n b) Read the table of numbers. c) Determine the number of elements in the table less than k d) Determine the number of elements in the table equal to k e) Determine the number of elements in the table greater than k f) That displays the values found
1. prove s(n, k) = s(n − 1, k − 1) − (n − 1)s(n −...
1. prove s(n, k) = s(n − 1, k − 1) − (n − 1)s(n − 1, k). 2. What is ∑n k=0 s(n, k)?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT