SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
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

Más contenido relacionado

Similar a 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 a 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
 

Más de 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
 

Último

PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schscnajjemba
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制vexqp
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制vexqp
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制vexqp
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...Bertram Ludäscher
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...nirzagarg
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样wsppdmt
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.pptibrahimabdi22
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxVivek487417
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样wsppdmt
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...Health
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubaikojalkojal131
 

Último (20)

PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 

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