180 likes | 296 Views
CS460 Fall 2013 Lecture 4. Constraint Satisfaction Problems. CSP formulation. Simplicity of domain Number of variables Simplicity of constraints. Constraint graph. Unary constraints Binary constraints N- ary constraints. CSP Examples . N queens Map coloring Cryptarithmetic Sudoku
E N D
CS460Fall 2013Lecture 4 Constraint Satisfaction Problems
CSP formulation • Simplicity of domain • Number of variables • Simplicity of constraints
Constraint graph • Unary constraints • Binary constraints • N-ary constraints
CSP Examples • N queens • Map coloring • Cryptarithmetic • Sudoku • Missionaries and Cannibals? • Waltz 3-D shape recognizer • Boolean n-satisfiability problem • Time tabling • Hardware configuration • Layouts
CSP Complexity • NP hard • Exponential
CSP and Search • DFS, uninformed • Why is search approach inefficient? • Backtracking search • Fail early
Backtracking design • Variable order • Failure on violation • Domain value assignment order • Filtering • Exploit graph structure • …
Filtering: forward checking • Filter out choices from domains • Backtrack when choices run out
Constraint propagation • Enforcing arc consistency • “arc” belongs to constraint propagation, not to constraint graph as such • Consistency: For every value in the tail X, there is some Y in the head which can be assigned without violating a constraint • Intuitively, there will be no backtracking generated due to that particular pair of nodes • Use arc consistency to filter out values from domain • “delete from the tail” • Any time a variable domain shrinks, all its neighbors pointing to it have to be re-tested • Visit all the arcs over and over again till every arc is simultaneously consistent • Backtracking, but less intense • Compare to A* search (precomputing heuristic)
Arc consistency: limitations • Does not detect all failures, only a subclass of them • Part of overall backtracking search • Arc consistency has to be enforced after every assignment in a backtracking search
Variable ordering • Pick variable with min remaining values • Fail early (at top of search tree)
Value ordering • Least constraining value
Handling bigger problems • 1000 queens
K-consistency • Generalized arc consistency • Tail is now k-1 consistent subset of nodes. Head is the remaining node. • Strong k-consistency: all lower-orders are also consistent • Lots of pre-computation • Analogy to A* search
Problem structure • Exploit shape of graph • Tree structure • No loops • Cutset conditioning