28
M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1. Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2 problems: DAC & DPC (strong DPC) Width-i problems: strong DIC (i.e., i+1) 2. Section 4.5: Adaptive Consistency Bucket Elimination Madeline Hardojo CSCE 990-06 Advanced Constraint Processing

M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

Page 1: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Directional ConsistencyDechter, Chapter 4

1. Section 4.4: Width vs. Local Consistency• Width-1 problems: DAC

• Width-2 problems: DAC & DPC (strong DPC)

• Width-i problems: strong DIC (i.e., i+1)

2. Section 4.5: Adaptive Consistency Bucket Elimination

Madeline Hardojo

CSCE 990-06 Advanced Constraint Processing

Page 2: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

4.4 Width vs. Local Consistency• Goal:

– backtrack-free (BT-free) search

• Approach: – link level of consistency with the shape of the graph sufficient to

guarantee BT-free search

• Known result:– (width+1) consistency level BT-free

• Caveat: – Shape width consistency adds constraints changes

shape increases width higher consistency

• Solution:– Don’t use width, use induced width

Page 3: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

4.4.1 Trees: width=1

• Fig 4.5 width = 1 Directional AC yields BT-free search

• Add constraint between x2 and x4 width =2 Directional AC no longer yields BT-free search

• Tree-structured binary CSP (any) ordering w=1 AC BT-free search • Dechter: AC is an overkill, Directional AC is sufficient• DAC achieved with Revise(node, one parent)• Tree-structured binary CSP (any) ordering w=1 DAC BT-

free search. • Why?

Page 4: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.4.1: width-1 & DAC

• Given – a constraint tree T– d, an ordering with w=1

• If T is directional AC relative to d,

• Then network is BT-free along d

Page 5: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.4.1: width-1 & DAC

Proof:• x1,…, xi was instantiated consistently• Want to instantiate xi+1

• Since w = 1, xi+1 only has at most 1 parent that constrained xi+1, say xj

• Since xj is relatively arc-consistent to xi+1, xi+1 must have a support for xj.

• Provides consistent extension BT-free

Page 6: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Tree Solving (Fig 4.11)

• Input: T = (X, D, C)

• Output: A BT-free network along an ordering d

1. Generate a width-1 ordering, d = x1, …, xn

2. Let xp(i) denote the parent of xi, in the rooted ordered tree

3. For i = n to 1 do

4. Revise((xp(i)), xi);

5. if the domain of xp(i) is empty, exit (no solution)

6. endfor

Page 7: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Interesting note

• Complexity of Tree Solving Algorithm is the same as the complexity of DAC (when induced width =1), i.e. O(nk2)

• Achieving full arc-consistency in O(nk2): – apply DAC relative to a width-1 order d, then – apply DAC relative to the reverse order of d

• Compare with:– AC-3 : O(nk3)– AC-4 : O(nk2), requires special data structures

Page 8: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.4.2: width-2 & DPC

• Given a network R d, an ordering with w=2

• If R is directional AC directional PC relative to ordering d,

• Then network is BT-free along d

Page 9: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

4.4.2 Solving width-2 problems

• Enforce directional PC using DPC algorithm (Fig. 4.8)

• Applying DPC may create an induced graph with a width > original width

• Even though we start with a graph of width-2, if the resulting graph after using DPC has width > 2, DPC no longer guarantees BT-free search

Page 10: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Induced width?

• How to find that a graph has an ordering with induced width = 2?

• Use MIW algorithm (Fig 4.3)– Selects node with smallest degree– Puts it last in ordering– Connects its parents not in MW– Removes it from graph– Repeat…

• Max degree of node removed gives induced width of ordering

Page 11: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.4.3: Complexity of DPC

• Given:– A binary constraint network R – induced width (w*) = 2

• R can be solved by DPC in linear time in the number of variables O(nk3)

Page 12: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.4.4: width-i & DIC(i+1)

• Given – a general network R– d, an ordering (necessarily w = i)

• If R is strong directional i+1-consistent to d,

• Then network is BT-free along d

Page 13: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Consistency as inference

• DAC, DPC, DIC are not complete inference procedures– Network can be inconsistent without us finding

it, in general

• Dechter introduces: Adaptive Consistency– A general and complete procedure for inferring

(network) consistency consistent network solvable problem, guarantees

the existence of a solution

Page 14: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

4.5 Adaptive consistency: Motivation

• Goal: – Want to make any problem BT-free relative to a given

variable ordering.– A complete inference algorithm

• Approach: Adaptive-consistency – ADC1 (Fig. 4.13) and – Adaptive-C (Fig. 4.14)

• ADC1 and Adaptive-C apply strong directional (i+1)-consistency and the resulting graph has is BT-free along the ordering d

Page 15: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Proposition 4.5.1

Given an ordering of induced width i1. Adaptive consistency strong directional

(i+1) consistency

2. Resulting network has width bounded by i

Page 16: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-Consistency (ADC1)

• Given a constraint network R and an ordering d• Find the width i of the current node• Establishes DIC depending on the width of the node

at the time of processing• Enforce i+1 consistency

– May tighten constraints– May impose new constraints– We only need to test the consistency of past and current

variables

• DICi: adaptive directional AC

Page 17: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-Consistency (Adaptive-C)

• Variable-elimination algorithm:

– At each step: Revise(parents of xj, xj)• Solve one variable and all its related constraints

• Inferred constraint on all the rest of the variables in the scope

– Solved = generate all partial solutions over the parents that can extend to xj

– Bucket elimination: an alternative description of adaptive consistency

Page 18: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Bucket Elimination• Use data-structure: buckets• Bucket-elimination:

– One bucket per variable

– Given an ordering, put constraint of the variable that appears latest in its scope to the bucket

– In the same bucket: all constraints that have the same latest variable in their scope

– Process bucket in reverse order and record its solution as a new constraint

Page 19: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Processing a bucket

• Solving a subproblem and recording its solutions as a new constraint– Corresponds to Revise(parents of xj, xj)

• Place the new constraint in the bucket of its latest variable

Page 20: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-C

• Given an ordering d

• Generates buckets and fill them with the constraints

• Process buckets in reverse order of ordering– Generate the join of all the constraints in the

bucket – Project in a way to exclude the variable of the

bucket

Page 21: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-C (Example)

• Figure 4.15

• d1 = (E, B, C, D, A)

• Step 1– n = 5 (x5 = A) – bucketA = RAD, RAB

– n = 4 (x4 = D) – bucketD = RDE

– …

– n = 1 (x1 = E) – bucketE = empty

Page 22: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-Consistency (AC) - Example• Step 2

– n = 5• A = {A,B,D}\{A} = {B,D}

• RBD = {(1,1), (2,2)} bucketD

– n = 4• A = {B,D,E}\{D} = {B,E}

• RBE = {(1,2),(2,1)} bucketB

– n = 3• A = {B,E,C}\{C}= {B,E}

• RBE bucketB

Page 23: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Algorithm: Adaptive-Consistency (AC) - Example

– n = 2• A = {B,E}\{B} = {E}

• RE = {1,2} bucketE

• Induced graph: Fig 4.17

Page 24: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Adaptive-C

• Constraints are generated in reverse order of of d

• A solution is generated, backtrack free, in the direction of the ordering d

Page 25: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Adaptive-C for w*

• Ordering with induced width (w*) = 1 (tree), Adaptive-C generates only unary constraints (i.e., updates domains)

• Ordering with w* = 2, Adaptive-C generates only binary constraints

• The number of constraints in a bucket is bounded by the number of parents of the corresponding variable (owner of the bucket), i.e., induced width

Page 26: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.5.2: Output of Adaptive-C

• Given:– A network R

– An ordering d

• Adaptive-consistency determines the consistency of R

• R is consistent Ed(R) is a backtrack-free network along d

Page 27: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Theorem 4.5.4: Complexity of Adaptive-C

• Time complexity of Adaptive-Consistency:

O(n . (2k)w*+1)• Space complexity of Adaptive-Consistency:

O(n . (k)w*)• n = number of variables• k = domain size• w* = induced-width given an ordering

Page 28: M. HardojoFriday, February 14, 2003 Directional Consistency Dechter, Chapter 4 1.Section 4.4: Width vs. Local Consistency Width-1 problems: DAC Width-2

M. HardojoFriday, February 14, 2003

Lesson of Chapter 4

• A class of tractable problems based on the induced width

• w*-based tractability• Adaptive-consistency transforms a network into

an equivalent one from which every solution can be generated BT-free– Technique to generate a solution– Technique of problem compilation– Governed by induced-width, w*