GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bergio13/simulated-annealing-sudoku: Solving sudoku using simulated annealing optimization

BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
notebook.ipynb
notebook.ipynb
 
 
output.png
output.png
 
 
simulated_annealing.py
simulated_annealing.py
 
 
solver.py
solver.py
 
 
sudoku_solution.gif
sudoku_solution.gif
 
 
sudoku_solver.py
sudoku_solver.py
 
 

Repository files navigation

Simulated Annealing Applied to Sudoku Puzzles

Sudoku Solution GIF

This project implements a Simulated Annealing (SA) algorithm to solve Sudoku puzzles, inspired by the paper "Metaheuristics can solve Sudoku puzzles" by Lewis (2007). The algorithm demonstrates a reliable approach to consistently find solutions to Sudoku puzzles using a metaheuristic optimization technique.

Project Overview

The SA algorithm works by iteratively exploring the solution space and probabilistically allowing worse solutions to escape local minima. As the process progresses, the "temperature" parameter gradually decreases, refining the search. If a better solution isn't found within a set number of steps, a reheating mechanism is applied to help the search escape potential plateaus.

Sudoku Board Example

File Descriptions

  • notebook.ipynb - A Jupyter Notebook demonstrating and visualizing the SA approach for solving Sudoku puzzles, with step-by-step explanations.
  • simulated_annealing.py - Core implementation of the Simulated Annealing algorithm.
  • sudoku_solver.py - Contains helper functions, the objective funciton, the nieghborhood operator, the delta evaluation function and the necessary Sudoku-specific logic required by the SA algorithm.

Key Functions

  • find_square: Determines the 3x3 grid for a given cell.
  • initial_candidate_sudoku: Generates an initial candidate Sudoku solution.
  • objective_function: Computes the objective function value for a given Sudoku solution.
  • neighborhood_operator: Swaps two random cells in the same 3x3 grid of the Sudoku.
  • delta_evaluation: Evaluates the change in the objective function value after a swap operation.
  • simulated_annealing: Executes the Simulated Annealing algorithm.
  • simulated_annealing_e: Executes an enhanced version of the Simulated Annealing algorithm with delta evaluation.

Visualization and Results

The results and visualizations can be found in the notebook.ipynb file. Open it with Jupyter Notebook to see step-by-step explanations and plots.

Webpage

Webpage where you can specify sudoku problem and parameters:

  • Webpage

Reference

  • Lewis, R. Metaheuristics can solve sudoku puzzles. J Heuristics 13, 387–401 (2007). DOI: https://doi.org/10.1007/s10732-007-9012-8

About

Solving sudoku using simulated annealing optimization

bergione.pythonanywhere.com/

Topics

heuristicsmetaheuristicsoptimizationsimulated-annealingsudoku

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.