Example: Map-Coloring contd.
Western
Australia
Northern
Territory
South
Australia
Queensland
New South Wales
Victoria
Tasmania
Solutions
are assignments satisfying all constraints, e.g.,
{
WA
=
red,NT
=
green,Q
=
red,NSW
=
green,V
=
red,SA
=
blue,T
=
green
}
Chapter 6
5
Constraint graph
Binary CSP
: each constraint relates at most two variables
Constraint graph
: nodes are variables, arcs show constraints
Victoria
WA
NT
SA
Q
NSW
V
T
General-purpose CSP algorithms use the graph structure
to speed up search. E.g., Tasmania is an independent subproblem!
Chapter 6
6
Varieties of CSPs
Discrete variables
finite domains; size
d
⇒
O
(
d
n
)
complete assignments
♦
e.g., Boolean CSPs, incl. Boolean satisfiability (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.,
StartJob
1
+ 5
≤
StartJob
3
♦
linear
constraints solvable,
nonlinear
undecidable
Continuous variables
♦
e.g., start/end times for Hubble Telescope observations
♦
linear constraints solvable in poly time by LP methods
Chapter 6
7
Varieties of constraints
Unary
constraints involve a single variable,
e.g.,
SA
negationslash
=
green
Binary
constraints involve pairs of variables,
e.g.,
SA
negationslash
=
WA
Higher-order
constraints involve 3 or more variables,
e.g., cryptarithmetic column constraints
Preferences
(soft constraints), e.g.,
red
is better than
green
often representable by a cost for each variable assignment
→
constrained optimization problems
Chapter 6
8