CSPs are a special kind of search problem
- States defined by values of a fixed set of variables from domain
- Goal test defined by constraints on variable values
- acceptable solutions are complete and consistent
- binary CSP: relates two variables; constraint graph: nodes are variables, arc are constraits.
- Discrete variable(n) with finit domain(d): O(d^n) complete assignments
- Discrete variable with infinit domain need a constraint
- Varieties of constraints: involve one varible(unary), two(binary), three(higher-order)
Backtracking
- depth-first search with one variable assigned at each level
- the basic uninformed algorithm for CSP
|
|
improve serach efficiency
- Variable ordering
- Most constrained variable or Minimum remaining values (MRV): choose the variable with the fewest legal values
- Degree heuristic: has the most number of unassigned neighbors
- Value ordering
- Least-constraining-value: the one that rules out the fewest values in the remaining variables
- Constraint propagation(inferences in code)
- Forward checking prevents assignments that lead to later failures
- Constraint propagation (e.g., arc consistency) does additional work to constrain values and detect inconsistencies early. based on X -> Y is consistent iff for every value x in X there is some allowed y in Y.
|
|