Professional Documents
Culture Documents
Constraint Satisfaction
Problems
Chapter 6
Outline
CSP:
Example: Map-Coloring
Example: Map-Coloring
Constraint graph
Varieties of CSPs
Discrete variables
finite domains:
infinite domains:
Continuous variables
Varieties of constraints
e.g., SA green
e.g., SA WA
Real-world CSPs
Assignment problems
Timetabling problems
Transportation scheduling
Factory scheduling
Notice that many real-world problems
involve real-valued variables
SE 420
10
1.
2.
3.
4.
Backtracking search
12
Backtracking example
13
Backtracking example
14
Backtracking example
15
Backtracking example
16
Improving backtracking
efficiency
17
e.g. If some variable X has no legal values left, the MRV heuristic
will select X and failure will be detected immediatelyavoiding
pointless searches through other variables
18
19
Forward checking
Idea:
21
Forward checking
Idea:
22
Forward checking
Idea:
23
Forward checking
Idea:
24
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{1,2,3,4}
X3
{1,2,3,4}
X4
{1,2,3,4}
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{1,2,3,4}
X3
{1,2,3,4}
X4
{1,2,3,4}
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , ,3,4}
X3
{ ,2, ,4}
X4
{ ,2,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , ,3,4}
X3
{ ,2, ,4}
X4
{ ,2,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , ,3,4}
X3
{ , , ,}
X4
{ , ,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , , ,4}
X3
{ ,2, ,4}
X4
{ ,2,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , , ,4}
X3
{ ,2, ,4}
X4
{ ,2,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , , ,4}
X3
{ ,2, , }
X4
{ , ,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , , ,4}
X3
{ ,2, , }
X4
{ , ,3, }
1
2
3
4
Example: 4-Queens
Problem
1
X1
{1,2,3,4}
X2
{ , ,3,4}
X3
{ ,2, , }
X4
{ , , , }
1
2
3
4
Problem
Consider the constraint graph on the right.
Problem
Consider the constraint graph on the right.
Constraint propagation
37
Arc consistency
38
Arc consistency
39
Arc consistency
Arc consistency
[R,B,G]
[R]
[R,B,G]
[R,B,G]
To apply to CSPs:
Example: 4-Queens
Summary
Thanks!
46