https://github.com/z1skgr/n_queens
Solving algorithms on N queens problem
https://github.com/z1skgr/n_queens
chess-board constraint-satisfaction-problem eclipse hill-climbing java n-queens-problem online-algorithms
Last synced: 7 months ago
JSON representation
Solving algorithms on N queens problem
- Host: GitHub
- URL: https://github.com/z1skgr/n_queens
- Owner: z1skgr
- Created: 2020-11-20T16:55:14.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T11:43:20.000Z (12 months ago)
- Last Synced: 2025-01-23T09:11:29.716Z (9 months ago)
- Topics: chess-board, constraint-satisfaction-problem, eclipse, hill-climbing, java, n-queens-problem, online-algorithms
- Language: Java
- Homepage:
- Size: 486 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI application
> Solving the problem of n queens using AI algorithms studying their performance.## Table of contents
* [General Info](#general-information)
* [Implementation](#implementation)
* [Setup](#setup)
* [Screenshot](#screenshot)
* [Acknowledgements](#acknowledgements)## General Information
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
1. Local search
2. Constraint satisfaction## Implementation
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.### Hill Climbing
* 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
### Constraint Satisfaction
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
### Performance Measures
* 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## Setup
Java Integrated Development Environment (Eclipse IDE)## Screenshot
### Local Search
https://github.com/z1skgr/N_Queens/issues/2#issue-1237707293### Constaint Satisfaction
## Acknowledgements
- This project was created for the requirements of the lesson Artificial Intelligence