09 Constraint Satisfaction Problems
09 Constraint Satisfaction Problems
Artificial Intelligence
Chapter 2: Solving Problems
by Searching (7)
Constraint Satisfaction Problems
Nguyễn Hải Minh, Ph.D
[email protected]
Formalize
Problem
…
…
Each state is
Variable Value + Contraints
factored represented
Xn
Contraint Satisfaction Problem
✓ Assign {WA=red}
✓ Effects on other variables connected by constraints to WA
– NT can no longer be red
– SA can no longer be red
✓ Assign {Q=green}
✓ Effects on other variables connected by constraints to Q
• NT can no longer be green
→ MRV heuristic would automatically
• SA can no longer be green
• NSW can no longer be green select NT or SA next
7/12/2020 Nguyễn Hải Minh @ FIT - HCMUS 36
Forward checking
❑Idea:
FC has detected that partial assignment is inconsistent with
o Keep track of remaining legal values for unassigned variables
the constraints and backtracking can occur.
o Terminate search when any variable has no legal values
✓ Assign {V=blue}
✓ Effects on other variables connected by constraints to V
• NSW can no longer be blue
• SA is empty
7/12/2020 Nguyễn Hải Minh @ FIT - HCMUS 37
Constraint Propagation:
Inference in CSPs
NSW → SA is consistent if
NSW=red and SA=blue
NSW=blue and SA=???
Arc can be made consistent by removing blue from NSW