Professional Documents
Culture Documents
2
Constraint satisfaction problems (CSPs)
• CSP:
– state is defined by variables Xi with values from domain Di
– goal test is a set of constraints specifying allowable combinations
of values for subsets of variables
3
Example: Map-Coloring
• Domains Di = {red,green,blue}
6
Varieties of CSPs
• Discrete variables
– finite domains:
• n variables, domain size d O(d n) complete assignments
• e.g., 3-SAT - A collection of clauses C where each clause
contains exactly 3 literals, over a set of Boolean variables V.
(NP-complete)
– infinite domains:
• integers, strings, etc.
• e.g., job scheduling, variables are start/end days for each job
• need a constraint language, e.g., StartJob1 + 5 ≤ StartJob3
7
Varieties of CSPs
• Continuous variables
– e.g., start/end times for Hubble Space Telescope observations
– linear constraints solvable in polynomial time by linear
programming
8
Varieties of constraints
• Unary constraints involve a single variable,
– e.g., SA ≠ green
9
Real-world CSPs
• Assignment problems
– e.g., who teaches what class
• Timetabling problems
– e.g., which class is offered when and where?
• Transportation scheduling
• Factory scheduling
S E N D D+E = Y+10*C1
M O R E C1+N+R = E+10*C2
+ C3 C2 C1 C2+E+O = N+10*C3
---------------------- C3+S+M = O+10*M
M O N E Y
Queens puzzle
• Place eight queens on a chessboard so that no two attack
each other
Q
Q
Search formulation of the queens puzzle
• Successors: all valid ways of placing additional queen on the board;
goal: eight queens placed
Q
Q Q Q Q Q
Q Q Q Q Q
Q Q Q Q Q
Q Q
Q Q Q Q Q
Q Q
Q Q Q Q Q
Summary
• CSPs are a special kind of problem:
– states defined by values of a fixed set of variables
– goal test defined by constraints on variable values