CS2201.8b
CS2201.8b
• WA=Red; Q=green
• Forward checking gives us the third row
• At this point, we can see that this is inconsistent, since NT and SA are
forced to be blue, yet they are adjacent. Forward checking doesn’t see
this, and proceeds onward in the search from this state (as we saw
earlier)
Constraint propagation
• Forward checking (FC) is in effect eliminating parts of the search
space
• Constraint propagation goes further than FC by repeatedly enforcing
constraints locally
• Needs to be faster than actually searching to be effective
• Arc-consistency (AC) is a systematic procedure for constraint
propagation
Consistency Algorithms
• An Arc X → Y is consistent if
for every value x of X there is some value y consistent with x
• Consider state of search after WA and Q are assigned:
SA → NSW is consistent: if SA=blue NSW could be =red
Arc consistency
• SA → NT is not consistent
• and cannot be made consistent
• Arc consistency detects failure earlier than FC
• This process was all in one call to the INFERENCE function right after we assigned Q=green. Forward
checking proceeded in the search, assigning a value to V.
Arc consistency checking
• Trade-off
• Requires some overhead to do, but generally more effective than direct search
• In effect it can eliminate large (inconsistent) parts of the state space more effectively than
search can
• For CSPs
• allow states with unsatisfied constraints (unlike backtracking)
• operators reassign variable values
• hill-climbing with n-queens is an example (we saw in earlier notes)
• The runtime of min-conflicts is roughly independent of problem size for the 8-queens (observation in the
1990’s that gave rise to much research).
• Can solve the millions-queen problem in roughly 50 steps.
• Why?
• n-queens is easy for local search because of the relatively high density of solutions in state-space
Summary
• CSPs
• special kind of problem: states defined by values of a fixed set of variables, goal test defined by constraints on variable values
• Heuristics
• Variable ordering and value selection heuristics help significantly
• Constraint propagation does additional work to constrain values and detect inconsistencies
• Works effectively when combined with heuristics
• Algorithm: solve for all solutions of each subproblem. Then, use the tree-
structured algorithm, treating the subproblem solutions as variables for those
subproblems.
• O(ndw+1) where w is the treewidth (= one less than size of largest subproblem)
• Finding a tree decomposition of smallest treewidth is NP-complete, but good
heuristic methods exists