SlideShare a Scribd company logo
1 of 22
Path consistency
Arc consistence can help reduce the domains of variables.
However, sometimes it tasks no effect.
Path consistency:
A two-variable set {Xi, Xj} is path-consistent wrt variable Xm if, for every
assignment {Xi = a, Xj = b} consistent with the constraints on {Xi, Xj}, there is an
assignment to Xm that satisfies the constraints on {Xi, Xm} and {Xm, Xj}.
Example
In the map coloring problem: if we use only
2 colors {red, blue}
Constraint: X ≠ Y
Arc-consistent?
Yes, since with each color of X,
Path-consistent?
Consider {HaNoi = red, BacNinh = blue},
PC-2 algorithm can enforce path consistency.
It is very similar to AC-3 algorithm.
K-consistency
A general form of local consistency.
A CSP is k-consistent if, for any set of k − 1 variables and for any consistent assignment
to those variables, a consistent value can always be assigned to any kth variable.
Some special cases:
 1-consistency:
 2-consistency:
 3-consistency:
Global constraints
A global constraint is one involving an arbitrary number of variables
For example, the Alldiff constraint
Global constraints
Example 2: Atmost constraint: in the car assembly scheduling problem,
 We can enforce consistency by deleting the maximum value of any domain if i
Sodoku problem
No digit appears twice in any row, column, or 3 ×
3 box.
Image:
(Russell,
2016)
Sudoku puzzle as a CSP
Variables:
Domains:
Constraints:
Image:
(Russell,
2016)
Alldiff constraints of a sudoku problem:
Source: (Russell, 2016)
Solving a Sudoku puzzle
Approach 1: AC-3 algorithm
Directly reducing domains of variables using the
constraints.
Image:
(Russell,
2016)
Solving a Sudoku puzzle
Approach 2: Triplets
1. In an unit, find 3 squares
2. Remove these 3 numbers from domains of
Image:
(Russell,
2016)
Notes
The mentioned approaches can apply to any CSPs, not just Sodoku.
Solve CSPs using
Backtracking Search
Motivation
Sudoku problems can be solved by inference over constraints (constraints propagation).
But many other CSPs cannot be solved by inference alone;
We could apply depth-first search:


However,
NOTE: CSPs have a property
 Backtracking search
Ideas of Backtracking search
A depth first search that chooses values for one variable at a time and backtracks when
a variable has no legal values left to assign.
Main steps:
Backtracking search uses CSP components.

Backtracking search algorithm
Source:
(Russell,
2016)
Demo
Comments on backtracking search algorithm
Source:
(Russell,
2016)
1. Select next variable and value
For the selection of next variable:
 Random selection:
For example,
 Minimum remaining-values heuristic:

For example,
 Degree heuristic:

For example,
1. Select next variable and value
For the selection of next value:
 Random selection:
 Least-constraining-value heuristic:
For example:
2. Inference
Propagation constraint to reduce domains of other
variables when having a new assignment (var = value).
 Forward checking:
For example,
Forward checking doesn’t detect all inconsistencies, for example
 Maintaining arc consistency:
PhuTho VinhPhuc BacNinh BacGiang
HaNoi = blue
HaiDuong =
3. Backtracking strategies
 Chronological backtracking:

 Backjumping: store a conflict set – set of assignments conflicted with the value of
current variable.
For example,

More Related Content

Similar to AIw10_Backtracking.pptx

Bag of Pursuits and Neural Gas for Improved Sparse Codin
Bag of Pursuits and Neural Gas for Improved Sparse CodinBag of Pursuits and Neural Gas for Improved Sparse Codin
Bag of Pursuits and Neural Gas for Improved Sparse CodinKarlos Svoboda
 
A Condensation-Projection Method For The Generalized Eigenvalue Problem
A Condensation-Projection Method For The Generalized Eigenvalue ProblemA Condensation-Projection Method For The Generalized Eigenvalue Problem
A Condensation-Projection Method For The Generalized Eigenvalue ProblemScott Donald
 
Solving the Poisson Equation
Solving the Poisson EquationSolving the Poisson Equation
Solving the Poisson EquationShahzaib Malik
 
clustering tendency
clustering tendencyclustering tendency
clustering tendencyAmir Shokri
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
lost_valley_search.pdf
lost_valley_search.pdflost_valley_search.pdf
lost_valley_search.pdfmanuelabarca9
 
Pattern Recognition and Machine Learning : Graphical Models
Pattern Recognition and Machine Learning : Graphical ModelsPattern Recognition and Machine Learning : Graphical Models
Pattern Recognition and Machine Learning : Graphical Modelsbutest
 
2012 mdsp pr12 k means mixture of gaussian
2012 mdsp pr12 k means mixture of gaussian2012 mdsp pr12 k means mixture of gaussian
2012 mdsp pr12 k means mixture of gaussiannozomuhamada
 
Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Austin Benson
 
Clustering-dendogram.pptx
Clustering-dendogram.pptxClustering-dendogram.pptx
Clustering-dendogram.pptxANKIT915111
 
Joint3DShapeMatching - a fast approach to 3D model matching using MatchALS 3...
Joint3DShapeMatching  - a fast approach to 3D model matching using MatchALS 3...Joint3DShapeMatching  - a fast approach to 3D model matching using MatchALS 3...
Joint3DShapeMatching - a fast approach to 3D model matching using MatchALS 3...Mamoon Ismail Khalid
 
Bt9301, computer graphics
Bt9301, computer graphicsBt9301, computer graphics
Bt9301, computer graphicssmumbahelp
 
Blind Source Separation using Dictionary Learning
Blind Source Separation using Dictionary LearningBlind Source Separation using Dictionary Learning
Blind Source Separation using Dictionary LearningDavide Nardone
 
Swarm Intelligence Heuristics for Graph Coloring Problem
Swarm Intelligence Heuristics for Graph Coloring ProblemSwarm Intelligence Heuristics for Graph Coloring Problem
Swarm Intelligence Heuristics for Graph Coloring ProblemMario Pavone
 
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...cseiitgn
 

Similar to AIw10_Backtracking.pptx (20)

Bag of Pursuits and Neural Gas for Improved Sparse Codin
Bag of Pursuits and Neural Gas for Improved Sparse CodinBag of Pursuits and Neural Gas for Improved Sparse Codin
Bag of Pursuits and Neural Gas for Improved Sparse Codin
 
A Condensation-Projection Method For The Generalized Eigenvalue Problem
A Condensation-Projection Method For The Generalized Eigenvalue ProblemA Condensation-Projection Method For The Generalized Eigenvalue Problem
A Condensation-Projection Method For The Generalized Eigenvalue Problem
 
Solving the Poisson Equation
Solving the Poisson EquationSolving the Poisson Equation
Solving the Poisson Equation
 
Clustering.pptx
Clustering.pptxClustering.pptx
Clustering.pptx
 
clustering tendency
clustering tendencyclustering tendency
clustering tendency
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Germany2003 gamg
Germany2003 gamgGermany2003 gamg
Germany2003 gamg
 
lost_valley_search.pdf
lost_valley_search.pdflost_valley_search.pdf
lost_valley_search.pdf
 
Pattern Recognition and Machine Learning : Graphical Models
Pattern Recognition and Machine Learning : Graphical ModelsPattern Recognition and Machine Learning : Graphical Models
Pattern Recognition and Machine Learning : Graphical Models
 
2012 mdsp pr12 k means mixture of gaussian
2012 mdsp pr12 k means mixture of gaussian2012 mdsp pr12 k means mixture of gaussian
2012 mdsp pr12 k means mixture of gaussian
 
Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)
 
Clustering-dendogram.pptx
Clustering-dendogram.pptxClustering-dendogram.pptx
Clustering-dendogram.pptx
 
Joint3DShapeMatching - a fast approach to 3D model matching using MatchALS 3...
Joint3DShapeMatching  - a fast approach to 3D model matching using MatchALS 3...Joint3DShapeMatching  - a fast approach to 3D model matching using MatchALS 3...
Joint3DShapeMatching - a fast approach to 3D model matching using MatchALS 3...
 
Joint3DShapeMatching
Joint3DShapeMatchingJoint3DShapeMatching
Joint3DShapeMatching
 
Cis435 week03
Cis435 week03Cis435 week03
Cis435 week03
 
Bt9301, computer graphics
Bt9301, computer graphicsBt9301, computer graphics
Bt9301, computer graphics
 
Blind Source Separation using Dictionary Learning
Blind Source Separation using Dictionary LearningBlind Source Separation using Dictionary Learning
Blind Source Separation using Dictionary Learning
 
Swarm Intelligence Heuristics for Graph Coloring Problem
Swarm Intelligence Heuristics for Graph Coloring ProblemSwarm Intelligence Heuristics for Graph Coloring Problem
Swarm Intelligence Heuristics for Graph Coloring Problem
 
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...
A Quest for Subexponential Time Parameterized Algorithms for Planar-k-Path: F...
 
Neural nw k means
Neural nw k meansNeural nw k means
Neural nw k means
 

More from Nguyễn Tiến (20)

AIw13_Exercises.pptx
AIw13_Exercises.pptxAIw13_Exercises.pptx
AIw13_Exercises.pptx
 
AIw13_slide.pptx
AIw13_slide.pptxAIw13_slide.pptx
AIw13_slide.pptx
 
AIw12_Cross entropy.pptx
AIw12_Cross entropy.pptxAIw12_Cross entropy.pptx
AIw12_Cross entropy.pptx
 
AIw11_Exercises.pptx
AIw11_Exercises.pptxAIw11_Exercises.pptx
AIw11_Exercises.pptx
 
AIw11_slide.pptx
AIw11_slide.pptxAIw11_slide.pptx
AIw11_slide.pptx
 
AIw10_Exercises.pptx
AIw10_Exercises.pptxAIw10_Exercises.pptx
AIw10_Exercises.pptx
 
AIw09_Exercises.pptx
AIw09_Exercises.pptxAIw09_Exercises.pptx
AIw09_Exercises.pptx
 
AIw09.pptx
AIw09.pptxAIw09.pptx
AIw09.pptx
 
AIw08_Exercises.pptx
AIw08_Exercises.pptxAIw08_Exercises.pptx
AIw08_Exercises.pptx
 
AIw08.pptx
AIw08.pptxAIw08.pptx
AIw08.pptx
 
AIw07 Exercises.pptx
AIw07 Exercises.pptxAIw07 Exercises.pptx
AIw07 Exercises.pptx
 
AIw07.pptx
AIw07.pptxAIw07.pptx
AIw07.pptx
 
AIw06_Exercises.pptx
AIw06_Exercises.pptxAIw06_Exercises.pptx
AIw06_Exercises.pptx
 
AIw06.pptx
AIw06.pptxAIw06.pptx
AIw06.pptx
 
AIw05_Exercises.pptx
AIw05_Exercises.pptxAIw05_Exercises.pptx
AIw05_Exercises.pptx
 
AIw05.pptx
AIw05.pptxAIw05.pptx
AIw05.pptx
 
AIw04_Exercises.pptx
AIw04_Exercises.pptxAIw04_Exercises.pptx
AIw04_Exercises.pptx
 
AIw04_slide.pptx
AIw04_slide.pptxAIw04_slide.pptx
AIw04_slide.pptx
 
AIw03.pptx
AIw03.pptxAIw03.pptx
AIw03.pptx
 
AI02_exercises.pptx
AI02_exercises.pptxAI02_exercises.pptx
AI02_exercises.pptx
 

Recently uploaded

Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 

Recently uploaded (20)

Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 

AIw10_Backtracking.pptx

  • 1. Path consistency Arc consistence can help reduce the domains of variables. However, sometimes it tasks no effect. Path consistency: A two-variable set {Xi, Xj} is path-consistent wrt variable Xm if, for every assignment {Xi = a, Xj = b} consistent with the constraints on {Xi, Xj}, there is an assignment to Xm that satisfies the constraints on {Xi, Xm} and {Xm, Xj}.
  • 2. Example In the map coloring problem: if we use only 2 colors {red, blue} Constraint: X ≠ Y Arc-consistent? Yes, since with each color of X, Path-consistent? Consider {HaNoi = red, BacNinh = blue},
  • 3. PC-2 algorithm can enforce path consistency. It is very similar to AC-3 algorithm.
  • 4. K-consistency A general form of local consistency. A CSP is k-consistent if, for any set of k − 1 variables and for any consistent assignment to those variables, a consistent value can always be assigned to any kth variable. Some special cases:  1-consistency:  2-consistency:  3-consistency:
  • 5. Global constraints A global constraint is one involving an arbitrary number of variables For example, the Alldiff constraint
  • 6. Global constraints Example 2: Atmost constraint: in the car assembly scheduling problem,  We can enforce consistency by deleting the maximum value of any domain if i
  • 7. Sodoku problem No digit appears twice in any row, column, or 3 × 3 box. Image: (Russell, 2016)
  • 8. Sudoku puzzle as a CSP Variables: Domains: Constraints: Image: (Russell, 2016)
  • 9. Alldiff constraints of a sudoku problem: Source: (Russell, 2016)
  • 10. Solving a Sudoku puzzle Approach 1: AC-3 algorithm Directly reducing domains of variables using the constraints. Image: (Russell, 2016)
  • 11. Solving a Sudoku puzzle Approach 2: Triplets 1. In an unit, find 3 squares 2. Remove these 3 numbers from domains of Image: (Russell, 2016)
  • 12. Notes The mentioned approaches can apply to any CSPs, not just Sodoku.
  • 14. Motivation Sudoku problems can be solved by inference over constraints (constraints propagation). But many other CSPs cannot be solved by inference alone; We could apply depth-first search:   However, NOTE: CSPs have a property  Backtracking search
  • 15. Ideas of Backtracking search A depth first search that chooses values for one variable at a time and backtracks when a variable has no legal values left to assign. Main steps: Backtracking search uses CSP components. 
  • 17. Demo
  • 18. Comments on backtracking search algorithm Source: (Russell, 2016)
  • 19. 1. Select next variable and value For the selection of next variable:  Random selection: For example,  Minimum remaining-values heuristic:  For example,  Degree heuristic:  For example,
  • 20. 1. Select next variable and value For the selection of next value:  Random selection:  Least-constraining-value heuristic: For example:
  • 21. 2. Inference Propagation constraint to reduce domains of other variables when having a new assignment (var = value).  Forward checking: For example, Forward checking doesn’t detect all inconsistencies, for example  Maintaining arc consistency: PhuTho VinhPhuc BacNinh BacGiang HaNoi = blue HaiDuong =
  • 22. 3. Backtracking strategies  Chronological backtracking:   Backjumping: store a conflict set – set of assignments conflicted with the value of current variable. For example,