There are three things in every constraint satisfaction problem (CSP):
- Variables
- Domain
- Constraints
In the given scenario, I know how to identify the constraints, but I don't know how to identify the variables and the domain.
The given scenario is:
You are given a $n \times n$ board, where $n \geq 3$. On this board, you have to put $k$ knights where $k < n^2$, such that no knight is attacking the other knight. The knights are expected to be placed on different squares on the board. A knight can move two squares vertically and one square horizontally or two squares horizontally and one square vertically. The knights attack each other if one of them can reach the other in a single move. For example, on a $3 \times 3$ board, we can place $k=5$ knights.
So, the input is $m = 3, n = 3, k = 5$. There are two solutions.
Solution 1
K A K
A K A
K A K
Solution 2
A K A
K K K
A K A