GithubHelp home page GithubHelp logo

selimfirat / ai-n-queens Goto Github PK

View Code? Open in Web Editor NEW
37.0 5.0 10.0 727 KB

Solving and GUI demonstration of traditional N-Queens Problem using Hill Climbing, Simulated Annealing, Local Beam Search, and Genetic Algorithm.

Java 100.00%
artificial-intelligence ai discrete-optimization optimization-algorithms n-queens hill-climbing simulated-annealing genetic-algorithm beam-search

ai-n-queens's Introduction

N-Queens Problem

N-Queens is a combinatorial problem based on chess. Regarding queens can attack vertically, horizontally, and diagonally in chess, N-Queens problem asks:

How can N queens placed on an NxN chessboard so that no two of them attacks each other?

This project demonstrates the n-queens problem solution and solves them via Hill Climbing, Simulated Annealing, Local Beam Search, and Genetic Algorithm.

Demonstration

N Queens Problem

Parameters

General

  • Number of queens: Number of queens in chessboard. Namely, N.

Note: Starts with a random state(chessboard configuration).

Hill Climbing

The hill climbing algorithm gets its name from the metaphor of climbing a hill.

  • Max number of iterations: The maximum number of iterations. Each iteration is at one step higher than another.

Note: If gets stuck at local maxima, randomizes the state.

Simulated Annealing

The annealing algorithm attempts to tease out the correct solution by making risky moves at first and slowly making more conservative moves.

  • Max number of iterations: The number of times that annealing move occures.
  • Temperature: The starting temperature that affects the annealing move(randomizing). If temperature is high, the state acts more randomly(anneals). And vice versa.
  • Cooling factor: The cooling parameter that reduces the temperature parameter.

Local beam search

  • Max number of iterations: The maximum number of iterations for search. Namely, the depth of search.
  • Number of states: Number of states in beam

Note: If gets stuck at local maxima, randomizes the state.

Genetic Algorithm

Evolution-like algorithm that suggests the survival of the best ones from many combinated&unified population in each generation.

  • Initial population size: Initial population size.
  • Mutation probability: Probability of occurance of mutation in each generation.
  • Number of generations: The number of iterations to get solution.

References

ai-n-queens's People

Contributors

mrsfy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ai-n-queens's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.