Sei sulla pagina 1di 10

Objectives

Introduce several local consistency notions:


node consistency,
arc consistency,
hyper-arc consistency,
Principles of Constraint directional arc consistency,
Programming path consistency,
Krzysztof R. Apt directional path consistency,
k-consistency,
Chapter 5 strong k-consistency,
Local Consistency Notions
relational consistency.
Use the proof theoretic framework to char-
acterize these local consistency notions.

Node Consistency Arc Consistency

CSP is node consistent if for every vari- A constraint C on the variables x, y with
able x every unary constraint on x coincides the domains X and Y (so C X Y ) is
with the domain of x. arc consistent if
Examples a Xb Y (a, b) C,
Assume C contains no unary constraints. b Y a X (a, b) C.
N natural numbers, A CSP is arc consistent if all its binary
Z integers. constraints are.
!C, x1 0, . . ., xn 0 ; x1 N , . . ., xn N $ Examples
is node consistent. &x < y ; x [2..6], y [3..7]'
!C, x1 0, . . ., xn 0 ; is arc consistent.
x1 N , . . ., xn1 N , xn Z$ &x < y ; x [2..7], y [3..7]'
is not node consistent. is not arc consistent.

2 3
Status of Arc Consistency Proof Rules for Arc Consistency

Arc consistency does not imply consistency. ARC CONSISTENCY 1


&C ; x Dx, y Dy '
Example Take &C ; x Dx% , y Dy '
&x = y, x (= y ; x {a, b}, y {a, b}'. where Dx% := {a Dx | b Dy (a, b) C}
Consistency does not imply arc consistency.
ARC CONSISTENCY 2
Example Take
&C ; x Dx, y Dy '
&x = y ; x {a, b}, y {a}'. &C ; x Dx, y Dy% '
For some CSPs arc consistency does imply where Dy% := {b Dy | a Dx (a, b) C}.
consistency.
(A general result later.) Intuition
Dx!

Dy! Dy
C

Dx

4 5

Derivation: Example
Characterization of Arc Consistency 1 2 3
H O S E S
A T
Note A CSP is arc consistent iff it is closed 4
H I
5
K E
6 7

under the applications of the ARC CONSIS- 8


A L E E

L A S E R
TENCY rules 1 and 2. E L

a : C1,2, b : C1,3, c : C4,2, d : C4,5, e : C4,2,


f : C7,2, g : C7,5, h : C8,2, i : C8,6, j : C8,3.

HOSES HOSES a : 2
LASER b : 1 a LASER a : 2
1 SAILS a : 1 SAILS 2
SHEET a : 1 SHEET e : 2
STEER a : 1 STEER e : 2
b

c, e
HEEL c:1 HOSES b : 2
HIKE LASER b : 2
4 KEEL c:1 SAILS j : 2 3
KNOT c:1 d SHEET j : 2
LINE d:1 STEER
f

AFT f :1 HEEL d:2


ALE f :1 g HIKE d:2
7 EEL f :1 KEEL 5
LEE KNOT g:2
TIE f :1 j LINE d:2
h

HOSES i:1 i AFT i:2


LASER ALE
8 SAILS h:1 EEL i:2 6
SHEET h:1 LEE i:2
STEER h:1 TIE i:2

6 7
Hyper-arc Consistency Characterization of
Hyper-arc Consistency
A constraint C on the variables x1, . . ., xn
with the domains D1, . . ., Dn is hyper-arc HYPER-ARC CONSISTENCY
consistent if &C ; x1 D1, . . ., xn Dn'
i [1..n]a Di d C a = d[xi]. &C ; . . ., xi Di% , . . .'
CSP is hyper-arc consistent if all its C a constraint on the variables x1, . . ., xn,
constraints are. i [1..n],
Examples Di% := {a Di | d C a = d[xi]}.
!x y = z ; x = 1, y {0, 1}, z {0, 1}$
is hyper-arc consistent. Note A CSP is hyper-arc consistent iff it is
!x y = z ; x {0, 1}, y {0, 1}, z = 1$ closed under the applications of the HYPER-
is not hyper-arc consistent. ARC CONSISTENCY rule.

8 9

Directional Arc Consistency Characterization of


Directional Arc Consistency
Assume a linear ordering on the variables.
A constraint C on x, y with the domains Dx Define P:
and Dy is directionally arc consistent P with the variables reordered w.r.t. .
w.r.t. if
Example
a Dxb Dy (a, b) C
Take P :=
provided x y,
b Dy a Dx (a, b) C &x < y, y (= z ; x [2..10], y [3..7], z [3..6]'
provided y x. and
A CSP is directionally arc consistent y x z.
w.r.t. if all its binary constraints are.
Then P :=
Example &y > x, y (= z ; y [3..7], x [2..10], z [3..6]'.
&x < y ; x [2..7], y [3..7]'
is Note A CSP P is directionally arc consis-
not arc consistent, tent w.r.t. iff the CSP P is closed un-
directionally arc consistent w.r.t. y x. der the applications of the ARC CONSIS-
not directionally arc consistent w.r.t. TENCY rule 1.
x y.
10 11
Limitations of Arc Consistency Normalized CSPs

Note A CSP P is normalized if for each pair x, y


!x < y, y < z, z < x ; x, y, z {1..100000}$. of its variables at most one constraint on x, y
exists.
is inconsistent.
Denote by Cx,y the unique constraint on x, y
Proof using arc consistency rules. if it exists and otherwise the universal rela-
Applying ARC CONSISTENCY rule 1 we tion on x, y.
get
R and S: two binary relations.
!x < y, y < z, z < x ; x {1..99999}, y, z {1..100000}$,
transposition of R:
etc.
RT := {(b, a) | (a, b) R},
Disadvantages:
composition of R and S by
Large number of steps.
RS := {(a, b) | c ((a, c) R, (c, b) S)}.
Length depends on the size of the domains.

Direct proof: use transitivity of <.


Path consistency: a generalizes this form
of reasoning to arbitrary binary relations.

12 13

Path Consistency Path Consistency: Example 1

A normalized CSP is path consistent if for &x < y, y < z, x < z;


each subset {x, y, z} of its variables x [0..4], y [1..5], z [6..10]'
Cx,z Cx,y Cy,z . z [6..10]

< >

<
Note A normalized CSP is path consistent iff x [0..4] y [1..5]
for each subsequence x, y, z of its variables
T , is path consistent. Indeed
Cx,y Cx,z Cy,z
Cx,y = {(a, b) | a < b, a [0..4], b [1..5]},
Cx,z Cx,y Cy,z ,
Cx,z = {(a, c) | a < c, a [0..4], c [6..10]},
T C .
Cy,z Cx,y x,z
Cy,z = {(b, c) | b < c, b [1..5], c [6..10]},
and all 3 conditions are satisfied.
Intuition
y

Cx,y Cy,z

x Cx,z z

14 15
Path Consistency: Example 2
Characterization of Path Consistency
&x < y, y < z, x < z;
x [0..4], y [1..5], z [5..10]'
PATH CONSISTENCY 1
z [5..10]
Cx,y , Cx,z , Cy,z
< < % ,C ,C
Cx,y x,z y,z
<
% := C T
x [0..4] y [1..5] where Cx,y x,y Cx,z Cy,z ,

is not path consistent. Indeed, now PATH CONSISTENCY 2


Cx,z = {(a, c) | a < c, a [0..4], c [5..10]} Cx,y , Cx,z , Cy,z
% ,C
Cx,y , Cx,z
and for 4 [0..4] and 5 [5..10] no b [1..5] y,z
exists such that 4 < b and b < 5. % := C
where Cx,z x,z Cx,y Cy,z ,

PATH CONSISTENCY 3
Cx,y , Cx,z , Cy,z
%
Cx,y , Cx,z , Cy,z
% := C T
where Cy,z y,z Cx,y Cx,z .
Note A normalized CSP is path consistent iff
it is closed under the applications of the PATH
CONSISTENCY rules 1, 2 and 3.
16 17

m-Path Consistency Directional Path Consistency

A normalized CSP is m-path consistent Assume a linear ordering on the variables. A


(m 2) if for each subset {x1, . . ., xm+1} of normalized CSP is directionally path con-
its variables sistent w.r.t. if for each subset {x, y, z}
Cx1,xm+1 Cx1,x2 Cx2,x3 ... Cxm,xm+1 . of its variables
Cx,z Cx,y Cy,z provided x, z y.
Note A normalized CSP is m-path consistent
if for each subset {x1, . . ., xm+1} of its vari- Note A normalized CSP is directionally path
ables consistent w.r.t. iff for each subsequence
if (a1, am+1) Cx1,xm+1 , then for some x, y, z of its variables
a2, . . ., am for all i [1..m] T provided x, y z,
Cx,y Cx,z Cy,z
(ai, ai+1) Cxi,xi+1 .
Cx,z Cx,y Cy,z provided x, z y,
a2, . . ., am: path connecting a1 and am+1.
Theorem Every normalized path consistent T C
Cy,z Cx,y x,z provided y, z x.
CSP is m-path consistent for each m 2.
Proof. Induction on m.

18 19
Examples Characterization of
Directional Path Consistency
Reconsider
&x < y, y < z, x < z;
Note A normalized CSP P is directionally
x [0..4], y [1..5], z [5..10]'
path consistent w.r.t. iff P is closed un-
Then der the applications of the PATH CONSIS-
Cx,y = {(a, b) | a < b, a [0..4], b [1..5]}, TENCY rule 1.

Cx,z = {(a, c) | a < c, a [0..4], c [5..10]},

Cy,z = {(b, c) | b < c, b [1..5], c [5..10]}.

It is directionally path consistent w.r.t. the


ordering in which x, y z.
Indeed, for every pair (a, b) Cx,y there
exists c [5..10] such that a < c and b < c.
It is directionally path consistent w.r.t. the
ordering in which y, z x.
Indeed, for every pair (b, c) Cy,z there
exists a [0..4] such that a < b and a < c.
20 21

Instantiations Example

Fix a CSP P. Consider


Instantiation: function on a subset of the !x < y, y < z, x < z ; x [0..4], y [1..5], z [5..10]$.
variables of P. It assigns to each variable a Let I := {(x, 0), (y, 5), (z, 6)}.
value from its domain. z [5..10]

Notation: < <

{(x1, d1), . . ., (xk , dk )}. <

x [0..4] y [1..5]
C: a constraint on x1, . . ., xk .
Instantiation {(x1, d1), . . ., (xk , dk )} I | {x, y} = {(x, 0), (y, 5)}.
satisfies C if (d1, . . ., dk ) C. It satisfies x < y.
I: instantiation with a domain X, Y X. I | {x, z} = {(x, 0), (z, 6)}.
I | Y : restriction of I to Y . It satisfies x < z.
Instantiation I with domain X is consis- I | {y, z} = {(y, 5), (z, 6)}.
tent if for every constraint C of P on some It satisfies y < z.
Y with Y X I | Y satisfies C. So I is a 3-consistent instantiation. It is a
Consistent instantiation is k-consistent if solution to this CSP.
its domain consists of k variables.
An instantiation is a solution to P if it is
consistent and defined on all variables of P.
22 23
k-Consistency k-Consistency, ctd

CSP is 1-consistent if for every variable x Fix k > 1.


with a domain D each unary constraint on (i) There exists a CSP that is (k1)-consistent
x equals D. but not k-consistent.
CSP is k-consistent, k > 1, if every (k (ii) There exists a CSP that is not (k 1)-
1)-consistent instantiation can be extended consistent but is k-consistent.
to a k-consistent instantiation no matter
which new variable is chosen. Proof of (i) for k = 3:
x3 [0..1]

k-consistency aka node consistency != !=

!=
Note
x1 [0..1] x2 [0..1]

A node consistent CSP is arc consistent iff


Proof of (ii):
it is 2-consistent.
x1 {a, b}

A node consistent normalized binary CSP


!=
is path consistent iff it is 3-consistent.
!=
x2 {a}

x3 {a}

...

xk {a}

24 25

Strong k-Consistency Graphs and CSPs

CSP strongly k-consistent, k 1, if it is Graph is associated with a CSP P.


i-consistent for every i [1..k].
Nodes: variables of P.
Theorem Take a CSP with k variables, Arcs: connect two variables if they appear
k 1, such that jointly in some constraint.
at least one domain is non-empty,
it is strongly k-consistent.
Then it is consistent.
Proof. Construct a solution by induction.
Prove that
(i) there exists a 1-consistent instantiation,
(ii) for every i [2..k] each (i1)-consistent in-
stantiation can be extended to an i-consistent
instantiation.

Disadvantage Required level of strong con-


sistency = # of variables.

26 27
Examples Width of a Graph

SEND + MORE = MONEY puzzle. G: a finite graph G.


The graph has 8 nodes, S, E, N, D, M, O, R, Y , : linear ordering on the nodes of G.
and is complete. -width of a node of G: number of arcs
in G that connect it to -smaller nodes.
&x + y = z, x + u = v ; DE'
-width of G: maximum of the -widths
x
y of its nodes.
u
z
The width of G: minimum of -widths for
v all linear orderings .

&x < z, x < y, y < u, y < v ; DE' Examples

x y
SEND + MORE = MONEY puzzle.
Complete graph with 8 nodes, so its width
z
u
= 7.
v
x y

z
u
v

It is a tree, so its width = 1.

28 29

Examples, ctd
Consistency via Strong k-Consistency
x
y

u
Theorem Given: a CSP such that
z

v all domains are non-empty,


it is strongly k-consistent,
the graph associated with it has width k1.
x y z v u
-width: 0 1 2 1 2
Then this CSP is consistent.

u v z y x
Proof. (Sketch)
-width: 0 1 0 1 4
Assume n variables.
Two examples of the -widths of the nodes
Reorder the variables so that the resulting
Here width = 2. -width is k 1.
Prove by induction that
there exists consistent instantiation with
domain {x1},
for every j [1..n 1] each consistent in-
stantiation with domain {x1, . . ., xj } can
be extended to a consistent instantiation
with domain {x1, . . ., xj+1}.

30 31
Useful Corollaries Relational Consistency
Corollary 1
Ultimate notion of local consistency
Given: P and a linear ordering such that
all domains are non-empty, Given: P and a subsequence C of its con-
P is straints.
node consistent, P | C:
directionally arc consistent w.r.t. , remove from P all constraints not in C,
the -width of the graph associated with P delete all domain expressions involving vari-
is 1. ables not present in any constraint in C.
Then P is consistent. P is relationally (i, m)-consistent if for
Corollary 2 every sequence C of m constraints and X Var (C)
of size i:
Given: P and a linear ordering such that
every consistent instantiation with the do-
all domains are non-empty, main X can be extended to a solution to
P is P | C.
directionally arc consistent w.r.t. ,
directionally path consistent w.r.t. ,
the -width of the graph associated with it
is 2.
Then P is consistent.
32 33

Relational Consistency, ctd Some Notation

Intuition: Given: constraint C on variables X, sub-


For every sequence of m constraints and for sequence Y of X.
every set X of i variables, each present in one
Y (C) := {d[Y ] | d C}.
of these m constraints:
each consistent instantiation with the do- X: sequence of variables,
main X can be extended to a solution to X1, . . ., Xn: subsequences of X.
all these m constraints. union of X1, . . ., Xn: shortest subsequence
of X containing each Xi as a subsequence.
Some properties Example: Take x1, x2, x4, x5.
A node consistent binary CSP is arc consis- Union of (x2, x4), (x4, x5), (x2, x5) is x2, x4, x5.
tent iff it is relationally (1, 1)-consistent. Given: a sequence of constraints C1, . . ., Cm
A node consistent CSP is hyper-arc consis- on variables X1, . . ., Xm.
tent iff it is relationally (1, 1)-consistent.
C1 ! . . . ! Cm := {d | d[Xi] Ci for i [1..m]}.
Every node consistent normalized relation-
ally (2, 3)-consistent CSP is path consistent. C1 ! . . . ! Cm is a constraint on the
Every strictly binary relationally (k 1, k)- union of X1, . . ., Xm.
consistent CSP is k-consistent. X: a sequence of variables
A CSP with m constraints is consistent iff CX :=! {CY | Y is a subsequence of X}.
it is relationally (0, m)-consistent.
34 35
Characterization of k-Consistency
Characterization of Relational Consistency
Note d is a solution to &C1, . . ., Cm ; DE' iff
d C1 ! . . . ! C m . RELATIONAL (i, m)-CONSISTENCY
A CSP P regular if for each sequence X of CX
its variables a unique constraint on X exists.
CX X (C1 ! . . . ! Cm)
Denote it by CX .

k-CONSISTENCY Note If a regular CSP is closed under the ap-


plications of
CX
RELATIONAL (i, m)-CONSISTENCY
CX X (CX,y ) rule for each subsequence of constraints C1, . . ., Cm
Note If a regular CSP is closed under the ap- and each subsequence X of Var (C1, . . ., Cm)
plications of the k-CONSISTENCY rule for of length i, then it is relationally (i, m)-consistent.
all subsequences X of k 1 variables and all
variables y not in X, then it is k-consistent.

36 37

Objectives

Introduce several local consistency notions:


node consistency,
arc consistency,
hyper-arc consistency,
directional arc consistency,
path consistency,
directional path consistency,
k-consistency,
strong k-consistency,
relational consistency.
Use the proof theoretic framework to char-
acterize these local consistency notions.

38

Potrebbero piacerti anche