Kyriakos-Bekas / n-queens-ai

N-Queens Problem Solution with Genetic Algorithm in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

N-Queens Problem

Introduction

This algorithm was created as a project for the course Artificial Intelligence of the Athens University of Economics and business. The algorithm finds a solution to the N-Queens problem.

Problem Explanation

The N-Queens problem is finding a way to place n queens on an n x n chessboard in such a manner, so that the queens do not attack each other (by being in the same row, column or diagonal).

Algorithm

The problem is solved using the Genetic Algorithm method. Genetic Algorithm is a method inspired by natural selection. For more information about the Genetic Algorithm click here.

Understanding the Code

Each file has carefully written comments that will help you understand the structure and use of the code in it. That way, you can see read about what is happenning where it is happening.

Access the Code

You can access the content of this repository by

  1. Cloning the repository
git clone https://github.com/Kyriakos-Bekas/n-queens-ai.git
  1. Downloading the code by clicking : Code > Download ZIP

Download Code as ZIP Visual Instructions

How to use

Open the command prompt/ integrated terminal and navigate to the path.

In order to execute the program, simply type the following commands:

javac Main.java GeneticAlgorithm.java Chromosome.java
java Main

After that, fill in the prompts with the data that you want to examine and wait for the result.

Credit

This algorithm was created by Alexandros Alexiou, Ioannis Skoufoulas and Kyriakos Bekas.

If you found that this repository was valuable to you, consider giving it a star ⭐

Licencing

Free for use in all personal, public and commercial projects.

About

N-Queens Problem Solution with Genetic Algorithm in Java


Languages

Language:Java 100.0%