Path Consistency Global Consistency Properties Problem Solving with
Path Consistency & Global Consistency Properties Problem Solving with Constraints CSCE 421/821, Fall 2016 www. cse. unl. edu/~choueiry/F 16 -421 -821 All questions: Piazza Berthe Y. Choueiry (Shu-we-ri) Avery Hall, Room 360 Tel: +1(402)472 -5444 Foundations of Constraint Processing Basic Consistency Methods 1
Lecture Sources Required reading 1. Algorithms for Constraint Satisfaction Problems, Mackworth and Freuder AIJ'85 2. Sections 3. 1, 3. 2, 3. 3. Chapter 3. Constraint Processing. Dechter Recommended 1. Sections 3. 4— 3. 10. Chapter 3. Constraint Processing. Dechter 2. Networks of Constraints: Fundamental Properties and Application to Picture Processing, Montanari, Information Sciences 74 3. Bartak: Consistency Techniques (link) 4. Path Consistency on Triangulated Constraint Graphs, Bliek & Sam. Haroud IJCAI'99 Foundations of Constraint Processing Basic Consistency Methods 2
Outline 1. Motivation 2. Path consistency and its complexity 3. Global consistency properties – Minimality – Decomposability 4. When PC guarantees global consistency Foundations of Constraint Processing Basic Consistency Methods 3
AC is not enough V 1 a b a = = V 2 Example borrowed from Dechter b = a b V 3 V 2 a b b a V 3 Arc-consistent? Satisfiable? seek higher levels of consistency Foundations of Constraint Processing Basic Consistency Methods 4
Outline 1. Motivation 2. Path consistency and its complexity 3. Global consistency properties – Minimality – Decomposability 4. When PC guarantees global consistency Foundations of Constraint Processing Basic Consistency Methods 5
Consistency of a path A path (V 0, V 1, V 2, …, Vm) of length m is consistent iff • • for any value x DV 0 and for any value y DVm that are consistent (i. e. , PV 0 Vm(x, y)) a sequence of values z 1, z 2, … , zm-1 in the domains of variables V 1, V 2, …, Vm-1, such that all constraints between them (along the path, not across it) are satisfied (i. e. , PV 0 V 1(x, z 1) PV 1 V 2(z 1, z 2) … PVm-1 Vm(zm-1, zm) ) V 2 V 1 V 0 for all x DV 0 Vm-1 for all y DVm Vm Foundations of Constraint Processing Basic Consistency Methods 6
Note The same variable can appear more than once in the path Every time, it may have a different value Constraints considered: PV 0, Vm and those along the path Universal constraints can be included in path All other constraints are neglected V 2 V 1 V 0 for all x DV 0 Vm-1 for all y DVm Vm Foundations of Constraint Processing Basic Consistency Methods 7
Example: consistency of a path Check path length = 2, 3, 4, 5, 6, . . All mutex constraints V 2 V 1 {a, b, c} V 3 {a, b, c} V 7 {a, b, c} V 4 V 5 V 6 Foundations of Constraint Processing Basic Consistency Methods 8
Path consistency: definition A path of length m is path consistent A CSP is path consistent Property of a CSP Definition: A CSP is path consistent (PC) iff every path is consistent (i. e. , any length of path) Question: should we enumerate every path of any length? Answer: No, only length 2, thanks to [Mackworth AIJ'77] Foundations of Constraint Processing Basic Consistency Methods 9
Tools for PC-1 Two operators 1. Constraint composition: ( • ) R 13 = R 12 • R 23 2. Constraint intersection: ( ) R 13, old R 13, induced Foundations of Constraint Processing Basic Consistency Methods 10
Path consistency (PC-1) Achieved by composition and intersection (of binary relations expressed as matrices) over all paths of length two. Procedure PC-1: 1 Begin 2 Yn R 3 repeat 4 begin 5 Y 0 Yn 6 For k 1 until n do 7 For i 1 until n do 8 For j 1 until n do 9 Ylij Yl-1 ik • Yl-1 kj 10 end 11 until Yn = Y 0 12 Y Yn 10 end Foundations of Constraint Processing Basic Consistency Methods 11
Properties of PC-1 Discrete CSPs [Montanari'74] 1. PC-1 terminates 2. PC-1 results in a path consistent CSP • PC-1 terminates. It is complete, sound (for finding PC network) • PC-2: Improves PC-1 similar to how AC 3 improves AC-1 Complexity of PC-1. . Foundations of Constraint Processing Basic Consistency Methods 12
Complexity of PC-1 Procedure PC-1: 1 2 3 4 5 6 7 8 9 10 11 12 10 Begin Yn R repeat begin Y 0 Yn For k 1 until n do For i 1 until n do For j 1 until n do Ylij Yl-1 ik • Yl-1 kj end until Yn = Y 0 Y Yn end Line 9: a 3 Lines 6– 10: n 3. a 3 Line 3: at most n 2 relations x a 2 elements PC-1 is O(a 5 n 5) PC-2 is O(a 5 n 3) and (a 3 n 3) PC-1, PC-2 are specified using constraint composition Foundations of Constraint Processing Basic Consistency Methods 13
Enforcing Path Consistency (PC) General case: Complete graph Theorem: In a complete graph, if every path of length 2 is consistent, the network is path consistent [Mackworth AIJ'77] PC-1: two operations, composition and intersection Proof by induction. Foundations of Constraint Processing Basic Consistency Methods 14
Some improvements • Mohr & Henderson (AIJ 86) – PC-2 O(a 5 n 3) PC-3 O(a 3 n 3) – Open question: PC-3 optimal? • Han & Lee (AIJ 88) – PC-3 is incorrect – PC-4 O(a 3 n 3) space and time • Singh (ICTAI 95) – PC-5 uses ideas of AC-6 (support bookkeeping) • Also: – PC 8: iterates over domains, not constraints – PC 2001: an improvement over PC 8, not tested [Chmeiss & Jégou 1998] Project! [Bessière et al. 2005] Note: PC is seldom used in practical applications unless in presence of special type of constraints (e. g. , bounded difference) Foundations of Constraint Processing Basic Consistency Methods 15
Path consistency as inference of binary constraints B B A<B A A B<C C A<C C Path consistency corresponds to inferring a new constraint (alternatively, tightening an existing constraint) between every two variables given the constraints that link them to a third variable Considers all subgraphs of 3 variables 3 -consistency Foundations of Constraint Processing Basic Consistency Methods 16
Path consistency as inference of binary constraints Another example: V 1 a b V 2 V 3 a b V 2 a b V 3 aa bb = a b = a b V 4 Foundations of Constraint Processing Basic Consistency Methods 17
Question Adapted from Dechter Given three variables Vi, Vk, and Vj and the constraints CVi, Vk, CVi, Vj, and CVk, Vj, write the effect of PC as a sequence of operations in relational algebra. B B B A<B A<B A A A B<C B<C A+3>C C C A+3> C Solution: CVi, Vj ij(CVi, Vk C -3 < A –C < 0 CVk, Vj) Foundations of Constraint Processing Basic Consistency Methods 18
Partial Path Consistency • Formal definition: Same as PC except that – Universal constraints cannot be included – Defined over cycles • Algorithm: Same as PC-i except that – We triangulate the graph – We run the closure loops over the triangles only O(n 3) – (Correction: Careful for articulation points in graph) Theorem: In a triangulated graph, if every path of length 2 is consistent, the network is partial path consistent [Bliek & Sam-Haroud ‘ 99] PPC (partially path consistent) Foundations of Constraint Processing Basic Consistency Methods 19
PPC versus PC Arbitrary binary constraints Algorithm Graph Filtering PC-2 Complete Tight, not necessarily minimal PPC Triangulated Weaker filtering than PC-2 PC property is strictly stronger than PPC property • Open question: Can PC detect insatisfiability when PPC does not? Yes! Example found by Chris Reeson [TBP] Foundations of Constraint Processing Basic Consistency Methods 20
Constraint propagation After Arc-consistency: 1 1 2 2 3 3 courtesy of Dechter 1 2 2 3 After Path-consistency: ( 0, 1 ) • ( 0, 1 ) Are these CSPs the same? – Which one is more explicit? – Are they equivalent? • The more propagation, – the more explicit the constraints – the more search is directed towards a solution Foundations of Constraint Processing Basic Consistency Methods 21
PC can detect unsatisfiability V 1 a b V 2 V 3 a b aa bb Arc-consistent? a b V 4 Path-consistent? Foundations of Constraint Processing Basic Consistency Methods 22
Warning: Does 3 -consistency guarantee 2 -consistency? B {red, blue} A C { red } • Question: – Is this CSP 3 -consistent? – is it 2 -consistent? • Lesson: – 3 -consistency does not guarantee 2 -consistency Foundations of Constraint Processing Basic Consistency Methods 23
PC is not enough All mutex constraints V 2 {a, b, c} V 7 {a, b, c} V 1 V 3 {a, b, c} V 4 {a, b, c} Arc-consistent? {a, b, c} Path-consistent? V 6 Satisfiable? we should seek (even) higher levels of consistency k-consistency, k = 1, 2, 3, …. V 5 …following lecture Foundations of Constraint Processing Basic Consistency Methods 24
Outline 1. Motivation 2. Path consistency and its complexity 3. Global consistency properties – Minimality – Decomposability 4. When PC guarantees global consistency Foundations of Constraint Processing Basic Consistency Methods 25
Minimality PC tightens the binary constraints The tightest possible binary constraints yield the minimal network Minimal network a. k. a. central problem Given two values for two variables, if they are consistent, then they appear in at least one solution. Note: • Minimal path consistent • The definition of minimal CSP is concerned with binary CSPs, but it need not be Foundations of Constraint Processing Basic Consistency Methods 26
Minimal CSP Minimal network a. k. a. central problem Given two values for two variables, if they are consistent, then they appear in at least one solution. Informally • In a minimal CSP the remainder of the CSP does not add any further constraint to the direct constraint CVi, Vj between the two variables Vi and Vj [Mackworth AIJ'77] • A minimal CSP is perfectly explicit: as far as the pair Vi and Vj is concerned, the rest of the network does not add any further constraints to the direct constraint CVi, Vj [Montanari'74] • The binary constraints are explicit as possible. [Montanari'74] Foundations of Constraint Processing Basic Consistency Methods 27
Decomposability • Any combination of values for k variables that satisfy the constraints between them can be extended to a solution. • Decomposability generalizes minimality Minimality: any consistent combination of values for any 2 variables is extendable to a solution Decomposability: any consistent combination of values for any k variables is extendable to a solution Decomposable Minimal Path Consistent Strong n-consistent Solvable Foundations of Constraint Processing Basic Consistency Methods 28
Terminology • Minimal Globally consistent • Decomposable strongly n-consistent Foundations of Constraint Processing Basic Consistency Methods 29
Outline 1. Motivation 2. Path consistency and its complexity 3. Global consistency properties – Minimality – Decomposability 4. When PC guarantees global consistency Foundations of Constraint Processing Basic Consistency Methods 31
PC approximates. . In general: • Decomposability minimality path consistent • PC is used to approximate minimality (which is the central problem) When is the approximation the real thing? Special cases: • When composition distributes over intersection, [Montanari'74] PC-1 on the completed graph guarantees minimality and decomposability • When constraints are convex [Bliek & Sam-Haroud 99] PPC on the triangulated graph guarantees minimality and decomposability (and the existing edges are as tight as possible) Foundations of Constraint Processing Basic Consistency Methods 32
Composition Arbitrary distributes over Constraints intersection PPC versus PC Algorithm Graph Filtering/property PC-2 Complete Tight, not necessarily minimal PPC Triangulated Weaker filtering than PC-2 Complete Minimal & Decomposable PPC Triangulated Foundations of Constraint Processing Basic Consistency Methods 33
PC: Special Case • Distributivity property – Outer loop in PC-1 (PC-3) can be ignored • Exploiting special conditions in temporal reasoning – Temporal constraints in the Simple Temporal Problem (STP): composition & intersection – Composition distributes over intersection • PC-1 is a generalization of the Floyd-Warshall algorithm (all pairs shortest path) – Convex constraints • PPC Foundations of Constraint Processing Basic Consistency Methods 34
Distributivity property Intersection, In PC-1, two operations: Composition, • B RAB A RBC R’BC C RAB • (RBC R'BC) = (RAB • RBC) (RAB • R’BC) When ( • ) distributes over ( ), then [Montanari'74] • PC-1 guarantees that CSP is minimal and decomposable • The outer loop of PC-1 can be removed Foundations of Constraint Processing Basic Consistency Methods 35
Condition does not always hold Constraint composition does not always distribute over constraint intersection • R 12= 10 10 R 23= 01 00 R’ 23= 10 00 • 11 00 ⋅( 01 00 ∩ 10 00 ) = • ( 11 00 ⋅ 01 00 ) ∩ ( 11 00 ⋅ ⋅ 10 00 00 00 )= = 10 00 00 00 ∩ 10 00 = 10 00 Foundations of Constraint Processing Basic Consistency Methods 36
Temporal Reasoning constraints of bounded difference Variables: X, Y, Z, etc. Constraints: a Y-X b, i. e. Y-X = [a, b] = I Composition: I 1 • I 2 = [a 1, b 1] • [a 2, b 2] = [a 1+ a 2, b 1+b 2] Interpretation: – intervals indicate distances – composition is triangle inequality. Intersection: I 1 I 2 = [max(a 1, a 2), min(b 1, b 2)] Distributivity: I 1 • (I 2 I 3) = (I 1 • I 2) (I 1 • I 3) Proof: left as an exercise Foundations of Constraint Processing Basic Consistency Methods 37
Example: Temporal Reasoning Composition of intervals + : V 2 R’ 13 = R 12 + R 23 = [4, 12] R 01 + R 13 = [2, 5] + [3, 5] = [5, 10] V R 01 + R'13 = [2, 5] + [4, 12] = [6, 17] 0 R 12=[3, 4] R 01=[2, 5] V 1 R 23=[1, 8] R’ 13 V 3 R 13 =[3, 5] Intersection of intervals: R 13 R'13 = [4, 12] [3, 5] = [4, 5] R 01 + (R 13 R'13) = (R 01 + R 13) (R 01 + R'13) R 01 + (R 13 R'13) = [2, 5] + [4, 5] = [6, 10] (R 01 + R 13) (R 01 + R'13) = [5, 10] [6, 17] = [6, 10] Here, path consistency guarantees minimality and decomposability Foundations of Constraint Processing Basic Consistency Methods 38
Composition Distributes over • PC-1 generalizes Floyd-Warshall algorithm (allpairs shortest path), where – composition is ‘scalar addition’ and – intersection is ‘scalar minimal’ • PC-1 generalizes Warshall algorithm (transitive closure) – Composition is logical OR – Intersection is logical AND Foundations of Constraint Processing Basic Consistency Methods 39
Convex constraints: temporal reasoning (again!) Thanks to Xu Lin (2002) • Constraints of bounded difference are convex • We triangulate the graph (good heuristics exist) • Apply PPC: restrict propagations in PC to triangles of the graph (and not in the complete graph) • According to [Bliek & Sam-Haroud 99] PPC becomes equivalent to PC, thus it guarantees minimality and decomposability Foundations of Constraint Processing Basic Consistency Methods 40
Summary 1. Alert: Do not confuse a consistency property with the algorithms for reinforcing it 2. Local consistency methods – – – Remove inconsistent values (node, arc consistency) Remove Inconsistent tuples (path consistency) Get us closer to the solution Reduce the ‘size’ of the problem & thrashing during search Are ‘cheap’ (i. e. , polynomial time) 3. Global consistency properties are the goal we aim at 4. Sometimes (special constraints, graphs, etc) local consistency guarantees global consistency – E. g. , Distributivity property in PC, row-convex constraints, special networks 5. Sometimes enforcing local consistency can be made cheaper than in the general case – E. g. , functional constraints for AC, triangulated graphs for PC Foundations of Constraint Processing Basic Consistency Methods 41
- Slides: 40