Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 987 Bytes

README.md

File metadata and controls

17 lines (15 loc) · 987 Bytes

Sudoku-Solver

forthebadge
Sudoku solver using Genetic Algorithm AI

Approach

  1. Created a helper matrix which is a list of list containing all possible values a cell can contain.
  2. Initialized population of size 200 randomly using the helper.
  3. Calculated the fitness of each candidate and sorted them.
  4. Took first 120 (having greater fitness) as elites. Elites would definately be part of the next generation.
  5. For the remaining 80, randomly selected two candidates from the population and performed crossover among them. Mutation is done on each candidate.
  6. We continue doing this until we get a fitness value of 1. This indicates we have successfully found a solution to the sudoku problem.

Output

image