Professional Documents
Culture Documents
Anish Raj
Motivation
▪ Domains:
▪ Constraints:
Implicit:
Explicit:
Example: Cryptarithmetic problems
▪ Find numeric substitutions that make an equation hold:
T W O Non-pairwise CSP:
+ T W O O O+O = R + 10*C1
= F O U R
R C1 C1 = {0,1}
For example:
O = 4 all-different W W+W+C1 = U + 10*C2
R = 8
W = 3 7 3 4 U C2 C2 = {0,1}
U = 6 + 7 3 4
T = 7 = 1 4 6 8 T T+T+C2 = O + 10*C3
F = 1 C3 C3 = {0,1}
F
Note: not unique – how many solutions? C3 = F
Example: Cryptarithmetic
▪ Variables:
▪ Domains:
▪ Constraints:
Example: Sudoku
▪ Variables:
▪ Each (open) square
▪ Domains:
▪ {1,2,…,9}
▪ Constraints:
9-way alldiff for each column
9-way alldiff for each row
9-way alldiff for each region
(or can have a bunch of
pairwise inequality
constraints)
CSP Examples
CSP Examples
Example: Map Coloring
▪ Variables:
▪ Domains:
Explicit:
▪ Continuous variables
▪ E.g., start/end times for Hubble Telescope observations
▪ Linear constraints solvable in polynomial time by LP methods
(see cs170 for a bit of this theory)
Varieties of Constraints
▪ Varieties of Constraints
▪ Unary constraints involve a single variable (equivalent to
reducing domains), e.g.:
▪ Ordering:
▪ Which variable should be assigned next?
▪ In what order should its values be tried?
NT Q
WA
SA
NSW
V
NT Q
WA
SA
NSW
V
NT Q
WA SA
NSW
V