Giter VIP home page Giter VIP logo

ai-nqueens's Introduction

N-Queen problem solver

Description/Descrição:

This is a n-queen problem solver using local search algorithms.

[Pt-Br]: Este é um programa que resolve o problema das n-rainhas utilizando algoritmos de busca local.

Local search algorithms/Algoritmos de busca local:

  • Hill Climbing
  • Hill Climbing with random restart
  • Simulated Annealing

Heuristic/Heurística:

To solve this problem we used as a heuristic the number of pairs of queens attacking each other, either directly or indirectly.

[Pt-Br]: Para resolver este problema utilizou-se como heurística, o número de pares de rainhas se atacando, seja direta ou indiretamente.

Usage/Modo de uso:

python main.py -h
usage: main.py [-h] [-n N] [-i I] [--all {0,1}]

N-queens problem solver by using local search algorithms. Author: Vitor Veras.
Default arguments: -n=8 ; -i=10 ; --all=0

optional arguments:
  -h, --help   show this help message and exit
  -n N         Size of the board
  -i I         Number of iterations
  --all {0,1}  0 = show one solution | 1 = show all solutions

Default output/Saída padrão:

python main.py
python main.py
hill_climbing
 - Hit rate:  2/10	Runtime: 0.038855
. . . . . Q . .
. Q . . . . . .
. . . . . . Q .
Q . . . . . . .
. . Q . . . . .
. . . . Q . . .
. . . . . . . Q
. . . Q . . . .


hc_random_restart
 - Hit rate:  9/10	Runtime: 0.196223
. . . . . . Q .
. Q . . . . . .
. . . Q . . . .
Q . . . . . . .
. . . . . . . Q
. . . . Q . . .
. . Q . . . . .
. . . . . Q . .


simulated_annealing
 - Hit rate: 10/10	Runtime: 0.779093
. . . Q . . . .
. . . . . . Q .
. . Q . . . . .
. . . . . . . Q
. Q . . . . . .
. . . . Q . . .
Q . . . . . . .
. . . . . Q . .

obs: All code comments are in Brazilian Portuguese.

Author

ai-nqueens's People

Contributors

vitorverasm avatar

Stargazers

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

Watchers

 avatar  avatar

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.