SlideShare a Scribd company logo
1 of 24
Download to read offline
Instructor: Tamer Elsayed
[Many slides were created by Dan Klein and Pieter Abbeel at UC Berkeley (ai.berkeley.edu)]
Sec 6.2-6.3
2
 Backtracking search is the basic uninformed algorithm for solving CSPs
 Idea 1: One variable at a time
 Variable assignments are commutative, so fix ordering
 i.e., [WA = red then NT = green] same as [NT = green then WA = red]
 Only need to consider assignments to a single variable at each step
 Idea 2: Check constraints as you go
 i.e. consider only values which do not conflict with previous assignments
 Might have to do some computation to check the constraints
 “Incremental goal test”
 Depth-first search with these two improvements
is called backtracking search
 Can solve n-queens for n  25
3
4
 Backtracking = DFS + variable-ordering + fail-on-violation
 What are the choice points?
5
6
 General-purpose ideas give huge gains in speed
 Filtering: Can we detect inevitable failure early?
 Ordering:
 Which variable should be assigned next?
 In what order should its values be tried?
 Structure: Can we exploit the problem structure?
7
8
 Filtering: Keep track of domains for unassigned variables and cross off bad options.
 Forward checking: Cross off values that violate a constraint when added to the existing
assignment.
WA
SA
NT Q
NSW
V
9
 Filtering: Keep track of domains for unassigned variables and cross off bad options.
 Forward checking: Cross off values that violate a constraint when added to the existing
assignment.
WA
SA
NT Q
NSW
V
10
11
 Forward checking propagates information from assigned to
unassigned variables, but doesn't provide early detection for all
failures:
 NT and SA cannot both be blue!
 Why didn’t we detect this yet?
 Constraint propagation: reason from constraint to constraint
WA
SA
NT Q
NSW
V
12
 An arc X  Y is consistent iff for every x in the tail there is some y in the
head which could be assigned without violating a constraint.
 Forward checking: Enforcing consistency of arcs pointing to each new
assignment
Delete from the tail!
WA
SA
NT Q
NSW
V
13
 A simple form of propagation makes sure all arcs are consistent:
 Important: If X loses a value, neighbors of X need to be
rechecked!
 Arc consistency detects failure earlier than forward checking
 Can be run as a preprocessor or after each assignment
 What’s the downside of enforcing arc consistency?
Remember:
Delete from
the tail!
WA SA
NT Q
NSW
V
14
 Detecting all possible future problems is NP-hard – why?
15
16
 After enforcing arc consistency:
 Can have one solution left
 Can have multiple solutions left
 Can have no solutions left (and not
know it)
 Arc consistency still runs inside a
backtracking search! What went
wrong here?
17
18
19
 Runtime: O(n2d3), can be reduced to O(n2d2)
21
 Variable Ordering: Minimum remaining values (MRV):
 Choose the variable with the fewest legal left values in its
domain
22
 Variable Ordering: Minimum remaining values (MRV):
 Choose the variable with the fewest legal left values in its
domain
 Why min rather than max?
 Also called “most constrained variable”
 “Fail-fast” ordering
23
 Value Ordering: Least Constraining Value
 Given a choice of variable, choose the least
constraining value
 i.e., the one that rules out the fewest values in
the remaining variables
 Note that it may take some computation to
determine this! (e.g., rerunning filtering)
 Why least rather than most?
 Combining these ordering ideas makes
1000 queens feasible
24

More Related Content

Similar to 3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf

Heuristic design of experiments w meta gradient search
Heuristic design of experiments w meta gradient searchHeuristic design of experiments w meta gradient search
Heuristic design of experiments w meta gradient searchGreg Makowski
 
Bounded Model Checking
Bounded Model CheckingBounded Model Checking
Bounded Model CheckingIlham Amezzane
 
ConstraintSatisfaction.ppt
ConstraintSatisfaction.pptConstraintSatisfaction.ppt
ConstraintSatisfaction.pptMdFazleRabbi53
 
Bubble Sort algorithm in Assembly Language
Bubble Sort algorithm in Assembly LanguageBubble Sort algorithm in Assembly Language
Bubble Sort algorithm in Assembly LanguageAriel Tonatiuh Espindola
 
TheoryOfComputaionNonDeterministic1.pptx
TheoryOfComputaionNonDeterministic1.pptxTheoryOfComputaionNonDeterministic1.pptx
TheoryOfComputaionNonDeterministic1.pptxxarat89149
 
An incremental algorithm for transition-based CCG parsing
An incremental algorithm for transition-based CCG parsingAn incremental algorithm for transition-based CCG parsing
An incremental algorithm for transition-based CCG parsingAkira Miyazawa
 
CSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.pptCSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.pptssuser6e2b26
 
QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28Aritra Sarkar
 
Myers_SIAMCSE15
Myers_SIAMCSE15Myers_SIAMCSE15
Myers_SIAMCSE15Karen Pao
 
Verification of GIMP with Manufactured Solutions
Verification of GIMP with  Manufactured SolutionsVerification of GIMP with  Manufactured Solutions
Verification of GIMP with Manufactured Solutionswallstedt
 
k-Means Clustering.pptx
k-Means Clustering.pptxk-Means Clustering.pptx
k-Means Clustering.pptxNJYOTSHNA
 
Madaari : Ordering For The Monkeys
Madaari : Ordering For The MonkeysMadaari : Ordering For The Monkeys
Madaari : Ordering For The MonkeysJ On The Beach
 
K-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierK-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierNeha Kulkarni
 

Similar to 3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf (20)

Forward checking
Forward checkingForward checking
Forward checking
 
Heuristic design of experiments w meta gradient search
Heuristic design of experiments w meta gradient searchHeuristic design of experiments w meta gradient search
Heuristic design of experiments w meta gradient search
 
Bounded Model Checking
Bounded Model CheckingBounded Model Checking
Bounded Model Checking
 
csps.ppt
csps.pptcsps.ppt
csps.ppt
 
ConstraintSatisfaction.ppt
ConstraintSatisfaction.pptConstraintSatisfaction.ppt
ConstraintSatisfaction.ppt
 
CH6,7.pptx
CH6,7.pptxCH6,7.pptx
CH6,7.pptx
 
Bubble Sort algorithm in Assembly Language
Bubble Sort algorithm in Assembly LanguageBubble Sort algorithm in Assembly Language
Bubble Sort algorithm in Assembly Language
 
TheoryOfComputaionNonDeterministic1.pptx
TheoryOfComputaionNonDeterministic1.pptxTheoryOfComputaionNonDeterministic1.pptx
TheoryOfComputaionNonDeterministic1.pptx
 
An incremental algorithm for transition-based CCG parsing
An incremental algorithm for transition-based CCG parsingAn incremental algorithm for transition-based CCG parsing
An incremental algorithm for transition-based CCG parsing
 
Knapsack problem using fixed tuple
Knapsack problem using fixed tupleKnapsack problem using fixed tuple
Knapsack problem using fixed tuple
 
CSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.pptCSP UNIT 2 AIML.ppt
CSP UNIT 2 AIML.ppt
 
N Queens problem
N Queens problemN Queens problem
N Queens problem
 
QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28QX Simulator and quantum programming - 2020-04-28
QX Simulator and quantum programming - 2020-04-28
 
Myers_SIAMCSE15
Myers_SIAMCSE15Myers_SIAMCSE15
Myers_SIAMCSE15
 
Ppt chapter12
Ppt chapter12Ppt chapter12
Ppt chapter12
 
Verification of GIMP with Manufactured Solutions
Verification of GIMP with  Manufactured SolutionsVerification of GIMP with  Manufactured Solutions
Verification of GIMP with Manufactured Solutions
 
20130523 05 - Cyclomatic complexity
20130523 05 - Cyclomatic complexity20130523 05 - Cyclomatic complexity
20130523 05 - Cyclomatic complexity
 
k-Means Clustering.pptx
k-Means Clustering.pptxk-Means Clustering.pptx
k-Means Clustering.pptx
 
Madaari : Ordering For The Monkeys
Madaari : Ordering For The MonkeysMadaari : Ordering For The Monkeys
Madaari : Ordering For The Monkeys
 
K-Nearest Neighbor Classifier
K-Nearest Neighbor ClassifierK-Nearest Neighbor Classifier
K-Nearest Neighbor Classifier
 

More from AmirMohamedNabilSale (18)

LecccccccccccccProgrammingLecture-09.pdf
LecccccccccccccProgrammingLecture-09.pdfLecccccccccccccProgrammingLecture-09.pdf
LecccccccccccccProgrammingLecture-09.pdf
 
p1.pdf
p1.pdfp1.pdf
p1.pdf
 
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
 
6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf
 
2.a-CMPS 403-F20-Session 2-Search Problems.pdf
2.a-CMPS 403-F20-Session 2-Search Problems.pdf2.a-CMPS 403-F20-Session 2-Search Problems.pdf
2.a-CMPS 403-F20-Session 2-Search Problems.pdf
 
LectureNote2.pdf
LectureNote2.pdfLectureNote2.pdf
LectureNote2.pdf
 
Lecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdfLecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdf
 
ML_1.pdf
ML_1.pdfML_1.pdf
ML_1.pdf
 
232021-211025052822.pdf
232021-211025052822.pdf232021-211025052822.pdf
232021-211025052822.pdf
 
9a52019-211025074532.pdf
9a52019-211025074532.pdf9a52019-211025074532.pdf
9a52019-211025074532.pdf
 
random-211016153637.pdf
random-211016153637.pdfrandom-211016153637.pdf
random-211016153637.pdf
 
Linux.pdf
Linux.pdfLinux.pdf
Linux.pdf
 
Linux_Commands.pdf
Linux_Commands.pdfLinux_Commands.pdf
Linux_Commands.pdf
 
AI in covid 19 (1).pptx
AI in covid 19 (1).pptxAI in covid 19 (1).pptx
AI in covid 19 (1).pptx
 
COVID-19 PowerPoint.pptx
COVID-19 PowerPoint.pptxCOVID-19 PowerPoint.pptx
COVID-19 PowerPoint.pptx
 
Edu week2022.pptx
Edu week2022.pptxEdu week2022.pptx
Edu week2022.pptx
 
ML_DT.pdf
ML_DT.pdfML_DT.pdf
ML_DT.pdf
 
2.pdf
2.pdf2.pdf
2.pdf
 

Recently uploaded

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 

Recently uploaded (20)

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 

3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf

  • 1. Instructor: Tamer Elsayed [Many slides were created by Dan Klein and Pieter Abbeel at UC Berkeley (ai.berkeley.edu)] Sec 6.2-6.3
  • 2. 2
  • 3.  Backtracking search is the basic uninformed algorithm for solving CSPs  Idea 1: One variable at a time  Variable assignments are commutative, so fix ordering  i.e., [WA = red then NT = green] same as [NT = green then WA = red]  Only need to consider assignments to a single variable at each step  Idea 2: Check constraints as you go  i.e. consider only values which do not conflict with previous assignments  Might have to do some computation to check the constraints  “Incremental goal test”  Depth-first search with these two improvements is called backtracking search  Can solve n-queens for n  25 3
  • 4. 4
  • 5.  Backtracking = DFS + variable-ordering + fail-on-violation  What are the choice points? 5
  • 6. 6
  • 7.  General-purpose ideas give huge gains in speed  Filtering: Can we detect inevitable failure early?  Ordering:  Which variable should be assigned next?  In what order should its values be tried?  Structure: Can we exploit the problem structure? 7
  • 8. 8
  • 9.  Filtering: Keep track of domains for unassigned variables and cross off bad options.  Forward checking: Cross off values that violate a constraint when added to the existing assignment. WA SA NT Q NSW V 9
  • 10.  Filtering: Keep track of domains for unassigned variables and cross off bad options.  Forward checking: Cross off values that violate a constraint when added to the existing assignment. WA SA NT Q NSW V 10
  • 11. 11
  • 12.  Forward checking propagates information from assigned to unassigned variables, but doesn't provide early detection for all failures:  NT and SA cannot both be blue!  Why didn’t we detect this yet?  Constraint propagation: reason from constraint to constraint WA SA NT Q NSW V 12
  • 13.  An arc X  Y is consistent iff for every x in the tail there is some y in the head which could be assigned without violating a constraint.  Forward checking: Enforcing consistency of arcs pointing to each new assignment Delete from the tail! WA SA NT Q NSW V 13
  • 14.  A simple form of propagation makes sure all arcs are consistent:  Important: If X loses a value, neighbors of X need to be rechecked!  Arc consistency detects failure earlier than forward checking  Can be run as a preprocessor or after each assignment  What’s the downside of enforcing arc consistency? Remember: Delete from the tail! WA SA NT Q NSW V 14
  • 15.  Detecting all possible future problems is NP-hard – why? 15
  • 16. 16
  • 17.  After enforcing arc consistency:  Can have one solution left  Can have multiple solutions left  Can have no solutions left (and not know it)  Arc consistency still runs inside a backtracking search! What went wrong here? 17
  • 18. 18
  • 19. 19
  • 20.  Runtime: O(n2d3), can be reduced to O(n2d2)
  • 21. 21
  • 22.  Variable Ordering: Minimum remaining values (MRV):  Choose the variable with the fewest legal left values in its domain 22
  • 23.  Variable Ordering: Minimum remaining values (MRV):  Choose the variable with the fewest legal left values in its domain  Why min rather than max?  Also called “most constrained variable”  “Fail-fast” ordering 23
  • 24.  Value Ordering: Least Constraining Value  Given a choice of variable, choose the least constraining value  i.e., the one that rules out the fewest values in the remaining variables  Note that it may take some computation to determine this! (e.g., rerunning filtering)  Why least rather than most?  Combining these ordering ideas makes 1000 queens feasible 24