A Sudoku solver implemented using Genetic Algorithms, with Streamlit web app for interactive puzzle input, GA configuration, and results visualization.
- 🧩 Interactive Sudoku input — enter or edit givens in the browser
- 🧬 Genetic Algorithm solver with configurable evolution parameters
- 📈 Fitness visualization showing GA progress over generations
- 🧠 Supports elitism, tournament selection, adaptive mutation, and stagnation handling
- 🖼️ Streamlit UI for end-to-end solving and display
- 📊 Matplotlib charts for fitness history
- 🧪 Prettified console output for CLI use
├── app.py # Streamlit web application
├── genetic_algo.py # GA and configuration logic
├── individual.py # GA Individual class
├── puzzle.py # SudokuPuzzle class
├── run_ga.py # CLI entry point (optional)
└── README.mdClone the repository and navigate to the folder:
git clone https://github.com/ahany42/GA-Sudoku-Solver.git
cd GA-Sudoku-SolverInstall Python dependencies:
Copy code
pip install streamlit matplotlib
Python 3.7+ is recommended.🧠 Usage
Run Streamlit app.pyEnter Sudoku givens (0 = empty)
Configure GA parameters (population, crossover, mutation, etc.)
Click “🚀 Solve with GA”
View best solution & fitness charts
🧩 SudokuPuzzle Immutable puzzle definition using @dataclass(frozen=True)
Computes total conflicts, fitness score, and performs sanity checks
Implements evolutionary loop with:
✔ Tournament selection
✔ Row-wise uniform crossover
✔ Elitism
✔ Adaptive mutation & stagnation
✔ Immigrants injection
