The N-Queens Problem is a classic combinatorial problem that involves placing N queens on an N x N chessboard such that no two queens threaten each other. This project specifically solves the 8-Queens Problem, where eight queens are placed on an 8x8 chessboard.
This project utilizes the Gurobi optimization library to find the optimal arrangement of queens and visualize the solution on a chessboard.
The problem can be formulated as follows:
To run this project, you need to install the following libraries:
gurobipy
: The Gurobi optimization library for solving linear programming problems.matplotlib
: A plotting library for creating static, animated, and interactive visualizations in Python.
You can install the required libraries using pip:
pip install -r libraries.txt
To clone the repository, use the following command:
git clone https://github.com/tdattm/N-QueensProblem.git
After cloning the repository and installing the required libraries, navigate to the project directory and run the script using Python:
cd N-QueensProblem\src
python 8-QueensProblem.py
After installing the required libraries, you can run the script to solve the N-Queens problem and visualize the result. Ensure that you have the Gurobi optimizer installed and properly set up in your environment.