Solving the problem of n queens using AI algorithms studying their performance.
On NxN chessboard, queens placed at random cells. The problem is solved after queens move to the desired state of the chessboard (no threatened queen).
For more information, check https://www.geeksforgeeks.org/n-queen-problem-backtracking-3/.
In our approach, we have
- Local search
- Constraint satisfaction
We use Grid.Java
to represent queens in a board ( NxN grid, queen as binary values)
Grid is randomly initialized with queens in any columns.
- Available move is a position in which another queen can't intervene (inside the grid).
- Queens exposed to attacks reflect the conflicts.
For more information, see https://www.javatpoint.com/hill-climbing-algorithm-in-ai
In our view, queen can threat diagonally, vertical and horizontaly (due to mutual collisions between two queens).
- Non-threatened queen by a predecessor (from left-sided queen), stays where she is.
- Otherwise, finds a row in which he is not bothered by the previous ones.
- No such row, then the algorithm will return with the position of the queen who has a problem.
For more info, see https://en.wikipedia.org/wiki/Constraint_satisfaction
- Average resolution time for N number of repetitions per number queens
- Average initialization number of the grid to establish the solution.
- Reliability of the solution.
- Collision minimization
Java Integrated Development Environment (Eclipse IDE)
- This project was created for the requirements of the lesson Artificial Intelligence