SlideShare a Scribd company logo
1 of 17
Ajshe Nazmi Klinaku, May 2018
1. WHAT IS SUDOKU
2. OBJECTIVE OF SUDOKU
3. CONSTRAINT PROPAGATION
4. SEARCH ALGORITHM
5. GENETIC ALGORITHM (GA)
6. ANALYSIS
7. COMPARE RESULTS
8. CONCLUSION AND THE FUTURE
9. REFERENCES
 Sudoku requires no calculation or arithmetic skills.
 It can be played by children and adults and the rules are simple to learn.
 It is essentially a game of placing numbers in squares, using very simple
rules of logic and deduction.
8 22 3 5 1
6 9 1 3
7 1 8 9 4
6 8 4 2 1
2 5 8 6
9 2 3 1 4
4 2 7 8
5 8 9
2 7 1
The number of different possible combinations of 9 by 9 Sudoku grids
is N=6670903752021072936960 which is approximately 6.671×1021
2 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 6 2 123456789 123456789
123456789 123456789 1 123456789 123456789 123456789 123456789 7 123456789
123456789 123456789 6 123456789 123456789 8 123456789 123456789 123456789
3 123456789 123456789 123456789 9 123456789 123456789 123456789 7
123456789 123456789 123456789 6 123456789 123456789 4 123456789 123456789
123456789 4 123456789 123456789 123456789 123456789 8 123456789 123456789
123456789 123456789 5 2 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 3
1. OBJECTIVE OF SUDOKU
onstraint
Propagation
• As soon as we know the initial values,
we can eliminate impossible values
from other squares.
• While we assign initial values for each
square, we also eliminate it from the
peers.
• This process is called constraint
propagation.
not 3
not 3
not 3
not 3
not 3
not 3
not 3 not 3 not 3
not 3
3 not 3 not 3 not 3 not 3 not 3 not 3 not 3
not 3 not 3 not 3
A2 has 4 possibilities (1679)
A3 has 5 possibilities (12679)
……
The whole puzzle has 4.62838344192 ×
1038 possibilities.
Still a long way from solving the puzzle--
61 squares remain uncertain
What next?
4 1679 12679 | 139 2369 269 | 8 1239 5
26789 3 1256789 |14589 24569 245689 | 12679 1249 124679
2689 15689 125689 | 7 234569 245689 | 12369 12349 123469
---------------------------- +--------------------------- +-------------------------------
3789 2 15789 | 3459 34579 4579 | 13579 6 13789
3679 15679 15679 | 359 8 25679 | 4 12359 12379
36789 4 56789 | 359 1 25679 | 23579 23589 23789
---------------------------- +--------------------------- +-------------------------------
289 89 289 | 6 459 3 | 1259 7 12489
5 6789 3 | 2 479 1 | 69 489 4689
1 6789 4 | 589 579 5789 | 23569 23589 23689
Constraint Propagation
 First make sure we haven’t already found a solution or a
contradiction, and if not
 Choose one unfilled square and consider all its possible values.
 Choose the square with the minimum number of possible
values.
 One at a time, try assigning the square each value, and
searching from the resulting position.
That’s done.
 GA encode a potential solution to a specific problem on a
 Simple chromosome like data structure and
 Apply recombination operators to these structures
 GA Architecture
 Selection: Survival of each individual depends on its fitness.
 Crossover: Mating and recombining portions of good individuals.
 Mutation: Random modifications.
1 9 2 3 6 5 8 7 4 1 2 5 3 4 6 7 8 9 1 2 5 6 7 8 4 93 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 1 7 4 2 139 6 8 5 4 1 8 2 3 6 5 7 9 1 7 3 9 5 2 6 4 8 9 1 6 2 4 5 7 3 8
1 9 4 3 6 7 8 2 5 8 3 5 4 2 9 7 1 6 2 6 7 1 5 8 4 9 3 5 1 9 6 8 2 7 4 3 3 6 8 5 4 7 2 9 1 7 4 2 319 6 8 5 4 5 8 2 3 6 9 7 1 1 7 3 9 5 4 6 8 2 9 2 6 8 7 1 5 3 4
x9x3 6 x 8 xx xx 5 xxx 7 xx xxxxxx 4 x3 xxxxxx 7 xx xxxxxxx91 7 4 2 xx9 6 8 5 4 x 8 2 3 6 xxx 1 7 3 9 5 x 6 xx 9x 6 xxxx30
0903 6 0 8 00 00 5 000 7 00 000000 4 03 000000 7 00 000000091 7 4 2 009 6 8 5 4 0 8 2 3 6 000 17 3 9 5 0 6 00 90000030
• For Sudoku the size of the GA chromosome is 81 integer numbers, divided into nine sub-blocks
of nine numbers.
The performance of this algorithm is tested by:
I have experimented with 30 random index puzzles.
I use the results as in [2] done with 2 datasets; 50 easy-level and 50 hard-level
Sudoku puzzles, each of them Peter says was solved in less than a fifth of a second.
Peter also test puzzle from Arto Inkala and solve them in 0.01 seconds.
Peter generated a million random puzzles and fill them at least 17 squares with at
least 8 different digits, but still Peter random puzzles are not guaranteed to have
one unique solution.
Puzzles that appear in books and newspapers always have one unique solution. The
average time to solve a random puzzle is 0.01 seconds.
The performance of this algorithm is tested by:
I tested 30 random index puzzles.
The solving of all these 30 Sudoku puzzle took 118.2 seconds in average 3.94
seconds for solving one Sudoku.
Also I use the results as in [3] start by testing five Sudoku puzzles taken from
the newspaper Helsingin Sanomat.
The solving of all these 27 [3] Sudoku puzzles took in average 4.11 seconds for
solving one Sudoku.
Index of Puzzle
Time taken to solve Sudoku problems using different algorithms
GA Constraint Propagation – Search
1 0.7 0.01
2 1.21 0.01
3 2.12 0.01
4 0.9 0.01
5 1.32 0.01
… … …
23 4.5 0.01
24 5.4 0.01
25 7.62 0.02
26 6.3 0.01
27 11.9 0.01
28 11.8 0.01
29 9.5 0.01
30 11.01 0.01
• GA is tested with 30 random index
puzzles, and the average is 3.94 seconds
for solving one Sudoku.
• Constraint Propagation-Search is tested
with 30 random index puzzles and the
average time to solve is 0.01 seconds.
0
2
4
6
8
10
12
14
5 10 15 20 25 30
Time(s)
Puzzle Index
GA Average Time
0
0.005
0.01
0.015
0.02
0.025
0 5 10 15 20 25 30
Time(s)
Puzzle Index
Constraint Propagation - Search Average Time
0
2
4
6
8
10
12
14
5 10 15 20 25 30
GA CP - Search
 Time performance of Constraint Propagation-Search is average 0.01s
 Time performance of GA is average 3.94s
 So the Constraint Propagation-Search is much better than the GA
 In the future there is still work to do:
1. Find the unique solution,
2. Calculate the minimum basic number for a unique solution
3. Find solution for each puzzle using Constraint Propagation-Search
 [1]Russell Stuart and Peter Norvig. Artificial Intelligence: A Modern Approach. New Jersey: Prentice
Hall, 2003.
 [2]http://norvig.com/sudoku.html
 [3] Mantere, T., Koljonen, J.: Solving, Rating and Generating Sudoku Puzzles with GA. 2007 IEEE
Congress on Evolutionary Computation-CEC2007, Singapore, pp. 1382–1389 (2007)
 [4] Mantere, T., Koljonen, J.: Solving and analyzing Sudokus with cultural algorithms. 2008 IEEE
Congress on Evolutionary Computation-CEC2008, Hong Kong, China, (2008)
 [5] Moraglio, A., Togelius, J., Lucas, S.: Product geometric crossover for the sudoku puzzle. In 2006 IEEE
Congress on Evolutionary Computation (CEC2006), Vancouver, BC, Canada, July 16-21 (2006) 470-476.
(GA)
 [6] Bertram Felgenhauer, Frazer Jarvis, Mathematics of sudoku I, Mathematical Spectrum, Vol. 39,
No. 1, Pp. 15–22, 2006
 [7] J.-P. Delahaye, "The Science Behind Sudoku", Scientific American, vol. 294, no. 6, pp. 80-87, Jun 2006.

More Related Content

What's hot

Aprendo las tablas de multiplicar
Aprendo las tablas de multiplicarAprendo las tablas de multiplicar
Aprendo las tablas de multiplicarKúbico Animación
 
Tablas de multiplicar para Niños
Tablas de multiplicar para NiñosTablas de multiplicar para Niños
Tablas de multiplicar para NiñosEditorial MD
 
Data Science process
Data Science processData Science process
Data Science processbigdata trunk
 
สูตรคูณ
สูตรคูณสูตรคูณ
สูตรคูณUconnect Edu
 
Introduction to machine learning algorithms
Introduction to machine learning algorithmsIntroduction to machine learning algorithms
Introduction to machine learning algorithmsbigdata trunk
 
0256 tabuada-multiplicacao-completar-2
0256 tabuada-multiplicacao-completar-20256 tabuada-multiplicacao-completar-2
0256 tabuada-multiplicacao-completar-2Arthur Alves
 
8 tables interactive
8 tables interactive8 tables interactive
8 tables interactiveWorserbay
 
Apostila 01 tabuada da multiplicação
Apostila 01 tabuada da multiplicaçãoApostila 01 tabuada da multiplicação
Apostila 01 tabuada da multiplicaçãoAgamenon21
 
Tabuada de-multiplicacao
Tabuada de-multiplicacaoTabuada de-multiplicacao
Tabuada de-multiplicacaolisitk
 
Learn Your Times Tables
Learn Your Times TablesLearn Your Times Tables
Learn Your Times TablesMark Runge
 
Presentation - Sudoku Assignment
Presentation - Sudoku  AssignmentPresentation - Sudoku  Assignment
Presentation - Sudoku AssignmentCj Uni
 
Mathematical funny equation
Mathematical funny equationMathematical funny equation
Mathematical funny equationShipat Bhuiya
 
Latihan sifir jawapan
Latihan sifir jawapanLatihan sifir jawapan
Latihan sifir jawapanJarmen Kell
 
5th Grade Multiplication Facts II
5th Grade Multiplication Facts II5th Grade Multiplication Facts II
5th Grade Multiplication Facts IIaccaknights
 
Tables 2 to 10
Tables   2 to 10Tables   2 to 10
Tables 2 to 10TimesRide
 

What's hot (20)

Tabuada
TabuadaTabuada
Tabuada
 
Aprendo las tablas de multiplicar
Aprendo las tablas de multiplicarAprendo las tablas de multiplicar
Aprendo las tablas de multiplicar
 
Tablas de multiplicar para Niños
Tablas de multiplicar para NiñosTablas de multiplicar para Niños
Tablas de multiplicar para Niños
 
Times Table
Times TableTimes Table
Times Table
 
Maths T5 W2
Maths T5 W2Maths T5 W2
Maths T5 W2
 
Data Science process
Data Science processData Science process
Data Science process
 
สูตรคูณ
สูตรคูณสูตรคูณ
สูตรคูณ
 
Introduction to machine learning algorithms
Introduction to machine learning algorithmsIntroduction to machine learning algorithms
Introduction to machine learning algorithms
 
0256 tabuada-multiplicacao-completar-2
0256 tabuada-multiplicacao-completar-20256 tabuada-multiplicacao-completar-2
0256 tabuada-multiplicacao-completar-2
 
Tabuada
TabuadaTabuada
Tabuada
 
8 tables interactive
8 tables interactive8 tables interactive
8 tables interactive
 
Apostila 01 tabuada da multiplicação
Apostila 01 tabuada da multiplicaçãoApostila 01 tabuada da multiplicação
Apostila 01 tabuada da multiplicação
 
Tabuada de-multiplicacao
Tabuada de-multiplicacaoTabuada de-multiplicacao
Tabuada de-multiplicacao
 
Learn Your Times Tables
Learn Your Times TablesLearn Your Times Tables
Learn Your Times Tables
 
Presentation - Sudoku Assignment
Presentation - Sudoku  AssignmentPresentation - Sudoku  Assignment
Presentation - Sudoku Assignment
 
recreation mathematics
recreation mathematicsrecreation mathematics
recreation mathematics
 
Mathematical funny equation
Mathematical funny equationMathematical funny equation
Mathematical funny equation
 
Latihan sifir jawapan
Latihan sifir jawapanLatihan sifir jawapan
Latihan sifir jawapan
 
5th Grade Multiplication Facts II
5th Grade Multiplication Facts II5th Grade Multiplication Facts II
5th Grade Multiplication Facts II
 
Tables 2 to 10
Tables   2 to 10Tables   2 to 10
Tables 2 to 10
 

Similar to Solve Sudoku using Constraint Propagation- Search and Genetic Algorithm

Sudoku Solving with Computational Intelligence
Sudoku Solving with Computational IntelligenceSudoku Solving with Computational Intelligence
Sudoku Solving with Computational Intelligenceharaldhiss
 
The sexagesimal foundation of mathematics
The sexagesimal foundation of mathematicsThe sexagesimal foundation of mathematics
The sexagesimal foundation of mathematicsMichielKarskens
 
Calculation techniques in numbers
Calculation techniques in numbersCalculation techniques in numbers
Calculation techniques in numberssealih
 
Overview of sparse and low-rank matrix / tensor techniques
Overview of sparse and low-rank matrix / tensor techniques Overview of sparse and low-rank matrix / tensor techniques
Overview of sparse and low-rank matrix / tensor techniques Alexander Litvinenko
 
Recreational mathematics for MichMATYC 10 10
Recreational mathematics for MichMATYC 10 10Recreational mathematics for MichMATYC 10 10
Recreational mathematics for MichMATYC 10 10nsattler
 
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016Gareth Shaw
 
GCSE Linear Starters Higher
GCSE Linear Starters Higher GCSE Linear Starters Higher
GCSE Linear Starters Higher MethuzelaJones
 
Permutation and Combination Game (Mathematics)
Permutation and Combination Game (Mathematics)Permutation and Combination Game (Mathematics)
Permutation and Combination Game (Mathematics)RicaMaeGolisonda1
 
St Vincent de Paul Y5 Home learning W2 15.1.21 fri
St Vincent de Paul Y5 Home learning W2 15.1.21 friSt Vincent de Paul Y5 Home learning W2 15.1.21 fri
St Vincent de Paul Y5 Home learning W2 15.1.21 friNICOLEWHITE118
 
Everyday Math And Algorithms Ppt July 06
Everyday Math And Algorithms Ppt July 06Everyday Math And Algorithms Ppt July 06
Everyday Math And Algorithms Ppt July 06lcirulli
 
Mathematics in everyday life
Mathematics in everyday lifeMathematics in everyday life
Mathematics in everyday lifejothiganga
 
Mathematics in everyday life
Mathematics in everyday lifeMathematics in everyday life
Mathematics in everyday lifeHasan Ali
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws
 
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfKunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfMutiaraPutri41
 

Similar to Solve Sudoku using Constraint Propagation- Search and Genetic Algorithm (20)

Sudoku Solving with Computational Intelligence
Sudoku Solving with Computational IntelligenceSudoku Solving with Computational Intelligence
Sudoku Solving with Computational Intelligence
 
The sexagesimal foundation of mathematics
The sexagesimal foundation of mathematicsThe sexagesimal foundation of mathematics
The sexagesimal foundation of mathematics
 
Calculation techniques in numbers
Calculation techniques in numbersCalculation techniques in numbers
Calculation techniques in numbers
 
Overview of sparse and low-rank matrix / tensor techniques
Overview of sparse and low-rank matrix / tensor techniques Overview of sparse and low-rank matrix / tensor techniques
Overview of sparse and low-rank matrix / tensor techniques
 
Sudoku solve rmain
Sudoku solve rmainSudoku solve rmain
Sudoku solve rmain
 
Recreational mathematics for MichMATYC 10 10
Recreational mathematics for MichMATYC 10 10Recreational mathematics for MichMATYC 10 10
Recreational mathematics for MichMATYC 10 10
 
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016
Series a-numeracy-ninjas-skill-book-answers-v5-apr-2016
 
GCSE Linear Starters Higher
GCSE Linear Starters Higher GCSE Linear Starters Higher
GCSE Linear Starters Higher
 
Math 'e' Magic
Math 'e' MagicMath 'e' Magic
Math 'e' Magic
 
Lattice multiplication
Lattice multiplicationLattice multiplication
Lattice multiplication
 
Permutation and Combination Game (Mathematics)
Permutation and Combination Game (Mathematics)Permutation and Combination Game (Mathematics)
Permutation and Combination Game (Mathematics)
 
Maths T5 W4
Maths T5 W4Maths T5 W4
Maths T5 W4
 
P2 booklet t1( 2014 2015)
P2 booklet t1( 2014 2015)P2 booklet t1( 2014 2015)
P2 booklet t1( 2014 2015)
 
St Vincent de Paul Y5 Home learning W2 15.1.21 fri
St Vincent de Paul Y5 Home learning W2 15.1.21 friSt Vincent de Paul Y5 Home learning W2 15.1.21 fri
St Vincent de Paul Y5 Home learning W2 15.1.21 fri
 
Everyday Math And Algorithms Ppt July 06
Everyday Math And Algorithms Ppt July 06Everyday Math And Algorithms Ppt July 06
Everyday Math And Algorithms Ppt July 06
 
0. preliminares
0. preliminares0. preliminares
0. preliminares
 
Mathematics in everyday life
Mathematics in everyday lifeMathematics in everyday life
Mathematics in everyday life
 
Mathematics in everyday life
Mathematics in everyday lifeMathematics in everyday life
Mathematics in everyday life
 
Andrew Daws - Final Project Report
Andrew Daws - Final Project ReportAndrew Daws - Final Project Report
Andrew Daws - Final Project Report
 
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdfKunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
Kunci Jawaban kalkulus edisi 9[yunusFairVry.blogspot.com].pdf
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Solve Sudoku using Constraint Propagation- Search and Genetic Algorithm

  • 2. 1. WHAT IS SUDOKU 2. OBJECTIVE OF SUDOKU 3. CONSTRAINT PROPAGATION 4. SEARCH ALGORITHM 5. GENETIC ALGORITHM (GA) 6. ANALYSIS 7. COMPARE RESULTS 8. CONCLUSION AND THE FUTURE 9. REFERENCES
  • 3.  Sudoku requires no calculation or arithmetic skills.  It can be played by children and adults and the rules are simple to learn.  It is essentially a game of placing numbers in squares, using very simple rules of logic and deduction.
  • 4. 8 22 3 5 1 6 9 1 3 7 1 8 9 4 6 8 4 2 1 2 5 8 6 9 2 3 1 4 4 2 7 8 5 8 9 2 7 1
  • 5. The number of different possible combinations of 9 by 9 Sudoku grids is N=6670903752021072936960 which is approximately 6.671×1021 2 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 6 2 123456789 123456789 123456789 123456789 1 123456789 123456789 123456789 123456789 7 123456789 123456789 123456789 6 123456789 123456789 8 123456789 123456789 123456789 3 123456789 123456789 123456789 9 123456789 123456789 123456789 7 123456789 123456789 123456789 6 123456789 123456789 4 123456789 123456789 123456789 4 123456789 123456789 123456789 123456789 8 123456789 123456789 123456789 123456789 5 2 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 3 1. OBJECTIVE OF SUDOKU
  • 6. onstraint Propagation • As soon as we know the initial values, we can eliminate impossible values from other squares. • While we assign initial values for each square, we also eliminate it from the peers. • This process is called constraint propagation. not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3 not 3
  • 7. A2 has 4 possibilities (1679) A3 has 5 possibilities (12679) …… The whole puzzle has 4.62838344192 × 1038 possibilities. Still a long way from solving the puzzle-- 61 squares remain uncertain What next? 4 1679 12679 | 139 2369 269 | 8 1239 5 26789 3 1256789 |14589 24569 245689 | 12679 1249 124679 2689 15689 125689 | 7 234569 245689 | 12369 12349 123469 ---------------------------- +--------------------------- +------------------------------- 3789 2 15789 | 3459 34579 4579 | 13579 6 13789 3679 15679 15679 | 359 8 25679 | 4 12359 12379 36789 4 56789 | 359 1 25679 | 23579 23589 23789 ---------------------------- +--------------------------- +------------------------------- 289 89 289 | 6 459 3 | 1259 7 12489 5 6789 3 | 2 479 1 | 69 489 4689 1 6789 4 | 589 579 5789 | 23569 23589 23689 Constraint Propagation
  • 8.  First make sure we haven’t already found a solution or a contradiction, and if not  Choose one unfilled square and consider all its possible values.  Choose the square with the minimum number of possible values.  One at a time, try assigning the square each value, and searching from the resulting position. That’s done.
  • 9.  GA encode a potential solution to a specific problem on a  Simple chromosome like data structure and  Apply recombination operators to these structures  GA Architecture  Selection: Survival of each individual depends on its fitness.  Crossover: Mating and recombining portions of good individuals.  Mutation: Random modifications.
  • 10. 1 9 2 3 6 5 8 7 4 1 2 5 3 4 6 7 8 9 1 2 5 6 7 8 4 93 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 1 7 4 2 139 6 8 5 4 1 8 2 3 6 5 7 9 1 7 3 9 5 2 6 4 8 9 1 6 2 4 5 7 3 8 1 9 4 3 6 7 8 2 5 8 3 5 4 2 9 7 1 6 2 6 7 1 5 8 4 9 3 5 1 9 6 8 2 7 4 3 3 6 8 5 4 7 2 9 1 7 4 2 319 6 8 5 4 5 8 2 3 6 9 7 1 1 7 3 9 5 4 6 8 2 9 2 6 8 7 1 5 3 4 x9x3 6 x 8 xx xx 5 xxx 7 xx xxxxxx 4 x3 xxxxxx 7 xx xxxxxxx91 7 4 2 xx9 6 8 5 4 x 8 2 3 6 xxx 1 7 3 9 5 x 6 xx 9x 6 xxxx30 0903 6 0 8 00 00 5 000 7 00 000000 4 03 000000 7 00 000000091 7 4 2 009 6 8 5 4 0 8 2 3 6 000 17 3 9 5 0 6 00 90000030 • For Sudoku the size of the GA chromosome is 81 integer numbers, divided into nine sub-blocks of nine numbers.
  • 11. The performance of this algorithm is tested by: I have experimented with 30 random index puzzles. I use the results as in [2] done with 2 datasets; 50 easy-level and 50 hard-level Sudoku puzzles, each of them Peter says was solved in less than a fifth of a second. Peter also test puzzle from Arto Inkala and solve them in 0.01 seconds. Peter generated a million random puzzles and fill them at least 17 squares with at least 8 different digits, but still Peter random puzzles are not guaranteed to have one unique solution. Puzzles that appear in books and newspapers always have one unique solution. The average time to solve a random puzzle is 0.01 seconds.
  • 12. The performance of this algorithm is tested by: I tested 30 random index puzzles. The solving of all these 30 Sudoku puzzle took 118.2 seconds in average 3.94 seconds for solving one Sudoku. Also I use the results as in [3] start by testing five Sudoku puzzles taken from the newspaper Helsingin Sanomat. The solving of all these 27 [3] Sudoku puzzles took in average 4.11 seconds for solving one Sudoku.
  • 13. Index of Puzzle Time taken to solve Sudoku problems using different algorithms GA Constraint Propagation – Search 1 0.7 0.01 2 1.21 0.01 3 2.12 0.01 4 0.9 0.01 5 1.32 0.01 … … … 23 4.5 0.01 24 5.4 0.01 25 7.62 0.02 26 6.3 0.01 27 11.9 0.01 28 11.8 0.01 29 9.5 0.01 30 11.01 0.01 • GA is tested with 30 random index puzzles, and the average is 3.94 seconds for solving one Sudoku. • Constraint Propagation-Search is tested with 30 random index puzzles and the average time to solve is 0.01 seconds.
  • 14. 0 2 4 6 8 10 12 14 5 10 15 20 25 30 Time(s) Puzzle Index GA Average Time 0 0.005 0.01 0.015 0.02 0.025 0 5 10 15 20 25 30 Time(s) Puzzle Index Constraint Propagation - Search Average Time
  • 15. 0 2 4 6 8 10 12 14 5 10 15 20 25 30 GA CP - Search
  • 16.  Time performance of Constraint Propagation-Search is average 0.01s  Time performance of GA is average 3.94s  So the Constraint Propagation-Search is much better than the GA  In the future there is still work to do: 1. Find the unique solution, 2. Calculate the minimum basic number for a unique solution 3. Find solution for each puzzle using Constraint Propagation-Search
  • 17.  [1]Russell Stuart and Peter Norvig. Artificial Intelligence: A Modern Approach. New Jersey: Prentice Hall, 2003.  [2]http://norvig.com/sudoku.html  [3] Mantere, T., Koljonen, J.: Solving, Rating and Generating Sudoku Puzzles with GA. 2007 IEEE Congress on Evolutionary Computation-CEC2007, Singapore, pp. 1382–1389 (2007)  [4] Mantere, T., Koljonen, J.: Solving and analyzing Sudokus with cultural algorithms. 2008 IEEE Congress on Evolutionary Computation-CEC2008, Hong Kong, China, (2008)  [5] Moraglio, A., Togelius, J., Lucas, S.: Product geometric crossover for the sudoku puzzle. In 2006 IEEE Congress on Evolutionary Computation (CEC2006), Vancouver, BC, Canada, July 16-21 (2006) 470-476. (GA)  [6] Bertram Felgenhauer, Frazer Jarvis, Mathematics of sudoku I, Mathematical Spectrum, Vol. 39, No. 1, Pp. 15–22, 2006  [7] J.-P. Delahaye, "The Science Behind Sudoku", Scientific American, vol. 294, no. 6, pp. 80-87, Jun 2006.