Constraint Satisfaction
Problems

Search when states are factored
•
Until now, we assumed states are black-
boxes.
•
We will now assume that states are made
up of “state-variables” and their “values”
•
Two interesting problem classes
–
CSP & SAT (Constraint Satisfaction
Problems)
–
Planning

December 2, 1998
Sqalli, Tutorial on Constraint
Satisfaction Problems
4
Constraint Satisfaction Problems (a brief animated
overview)
Values
Constraints
Problem
Statement
Variables
CSP
Algorithm
Solution
X
Z
Y
Coloring
Problem
CSP Representation
•
Search
backtracking,
variable/value
heuristics
•
Inference
Consistency
enforcement,
forward
checking
X: red
Y: blue
Z: green
Red
green
blue
Red
green
blue
Red
green
blue
Z
X
Y
Constraint Graph

Red
green
blue
Red
green
blue
Red
green
blue
Z
X
Y
Constraint Graph
As a piece of code
that takes a partial
assignment and
returns Legal or not

Example: N-queen problem
N=4
Variables: Queen per column
Values:
N rows that queen
can be in
Constraints: no pair in same
row, column or diagonal

Constraint Graphs
will be hyper-graphs
for non-binary CSPs

“Real world” CSP problems..
•
Most assignment problems including
–
Time-tabling
•
Variables: Courses; Values: Rooms, times
–
Jobshop Scheduling
•
Variables: jobs; values: machines
•
Sudoku;
KenKen
•
Cross-word puzzle
•
Boolean satisfiability
•
Many other AI problems can be compiled to CSP
problems
–
We will see how to compile planning into a CSP problem

Complexity of CSP..
•
Boolean Satisfiability is a special case of
discrete variable CSP problem
–
So, CSP is NP-hard
•
Specific types of CSP may be tractable.
–
E.g. if all the variables are boolean and all the
constraints are binary, you have 2-SAT which is
tractable.
–
The topology of the “constraint graph” also affects the
complexity of the CSP problem
•
E.g. If the constraint graph is a chain graph or a multi-tree,
we can solve it polynomially
–
Do you remember the similar result for Bayes Nets?

CSP vs. SAT
•
CSP allows multi-valued variables; while SAT focuses on
boolean variables
–
Can convert CSP into SAT
•
Make a variable V with values 1, 2, 3 into
propositions V-1, V-2, V-3
–
Also need to add a constraint saying that no
more than one of them can be true
»
Usually, as a set of binary mutex constraints
(
not V-i or not V-j
)
•
CSP algorithms are written assuming constraints as
procedures; SAT algorithms are written assuming
clauses as declaratively represented

CSP/SAT vs. IP/LP
•
Linear programming
–
Maximize a linear objective function
•
3x+4y+5z over
real valued variables
–
Subject to a set of linear constraints
•
x+y <= 2; y+3z <=4 etc
–
Can be understood in two phases
•
Feasibility of the polytope
•
Finding the optimal corner of the polytope
•
Integer programming
–
Linear programming, but (some of) the
variables have to take integer values

General Search vs. CSP
•
Blackbox State
•
External Child-generator
•
State-space can be infinite
•
External goal test
•
Goals can occur at
any
depth
•

#### You've reached the end of your free preview.

Want to read all 74 pages?

- Spring '06
- Staff
- Economics, Constraint satisfaction, Constraint satisfaction problem, constraint graph