Skip to content

AlirezaNoorizadeh/genetic-algorithm-8-queens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

8-Queens Problem using Genetic Algorithm

A Python implementation of the Genetic Algorithm to solve the classic 8-Queens problem.

πŸ’‘ Features

  • Custom fitness function
  • Crossover and mutation
  • Elitism strategy
  • Visualization of solution and fitness over generations

πŸ“Š Algorithm Parameters

  • Population size: 100
  • Mutation rate: 0.1
  • Elitism: top 2 individuals retained
  • Max generations: 1000

πŸ› οΈ Tools & Libraries

  • Python
  • NumPy
  • Matplotlib
  • Seaborn

πŸš€ How to Run

  1. Online option (recommended for quick start):
    Use Google Colab:

    • Open the link
    • Click on β€œUpload” and add main.py
    • Run all cells directly in the browser
    • No setup or installation needed
  2. Local option:

    • Clone the repository or download the files
    • Install dependencies:
      pip install -r requirements.txt  
    • Open the notebook using Jupyter and run all cells

πŸ“ˆ Visualization Samples

  • Fitness curve
  • Board heatmap Sample Data Snapshot

πŸ“š References

About

Solving the 8-Queens puzzle using a basic genetic algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages