Consistency algorithms Chapter 3 Fall 2010 1 Consistency methods - - PowerPoint PPT Presentation

consistency algorithms
SMART_READER_LITE
LIVE PREVIEW

Consistency algorithms Chapter 3 Fall 2010 1 Consistency methods - - PowerPoint PPT Presentation

Consistency algorithms Chapter 3 Fall 2010 1 Consistency methods Approximation of inference: Arc, path and i-consistecy Methods that transform the original network into tighter and tighter representations Fall 2010 2 Arc-consistency X


  • Consistency algorithms Chapter 3 Fall 2010 1

  • Consistency methods Approximation of inference: Arc, path and i-consistecy Methods that transform the original network into tighter and tighter representations Fall 2010 2

  • Arc-consistency X Y  1, 2, 3 1, 2, 3   1 X, Y, Z, T 3  X Y  = Y = Z T Z   X T 1, 2, 3 1, 2, 3  T Z Fall 2010 3

  • Arc-consistency X Y  1 3   1 X, Y, Z, T 3  X Y  = Y = Z T Z   X T 2 3  T Z Fall 2010 4

  • Arc-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 5

  • Revise for arc-consistency ← ∩ π ⊗ D D ( R D ) i i i ij j Fall 2010 6

  • A matching diagram describing a network of constraints that is not arc-consistent (b) An arc- consistent equivalent network. Fall 2010 7

  • AC-1 Complexity ( Mackworth and Freuder, 1986 ): 3 O ( enk ) e = number of arcs, n variables, k values ( ek^2 , each loop, nk number of loops), best-case = ek , Ω 2 ( ek ) Arc-consistency is: Fall 2010 8

  • AC-3 3 Complexity: since each arc may be processed in O(2k) O ( ek ) Best case O(ek), Fall 2010 9

  • Example: A 3 variables network with 2 constraints: z divides x and z divides y (a) before and (b) after AC-3 is applied. Fall 2010 10

  • AC-4 Complexity: 2 O ( ek ) (Counter is the number of supports to ai in xi from xj. S_(xi,ai) is the set of pairs that (xi,ai) supports) Fall 2010 11

  • Example applying AC-4 Fall 2010 12

  • Distributed arc-consistency (Constraint propagation) ← ∩ π ⊗ D D ( R D ) Implement AC-1 distributedly. i i i ij j ← π ⊗ j h ( R D ) Node x_j sends the message to node x_i i i ij j Node x_i updates its domain: ← ∩ π ⊗ = D D ( R D ) i i i ij j ← ∩ j Messages can be sent asynchronously or scheduled D D h in a topological order i i i Fall 2010 13

  • Exercise: make the following network arc-consistent Draw the network’s primal and dual constraint graph Network = Domains {1,2,3,4} Constraints: y < x, z < y, t < z, f<t, x<=t+1, Y<f+2 Fall 2010 14

  • Arc-consistency Algorithms 3 O ( nek ) AC-1 : brute-force, distributed 3 O ( ek ) AC-3 , queue-based 2 O ( ek ) AC-4 , context-based, optimal AC-5,6,7 ,…. Good in special cases Important: applied at every node of search ( n number of variables, e =#constraints, k =domain size) Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)… Fall 2010 15

  • Using constraint tightness in analysis t = number of tuples bounding a constraint O ( nekt ) 3 O ( nek ) AC-1 : brute-force, O ( ekt ) 3 O ( ek ) AC-3 , queue-based O ( et ) AC-4 , context-based, optimal AC-5,6,7 ,…. Good in special cases Important: applied at every node of search (n number of variables, e=#constraints, k=domain size) Mackworth and Freuder (1977,1983), Mohr and Anderson, (1985)… Fall 2010 16

  • Constraint checking Arc-consistency → B 1- B: [ 5 .. 14 ] 13 A < B 14 A C: [ 6 .. 15 ] [ 5.... 18] 2- A: [ 2 .. 10 ] 2 B < C [ 1.... 10 ] C: [ 6 .. 14 ] 2 < C - A < 5 3- B: [ 5 .. 13 ] 14 6 [ 4.... 15] C Fall 2010 17

  • Is arc-consistency enough? Example: a triangle graph-coloring with 2 values. Is it arc-consistent? Is it consistent? It is not path, or 3-consistent. Fall 2010 18

  • Path-consistency Fall 2010 19

  • Path-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 20

  • Revise-3 ← ∩ π ⊗ ⊗ R R ( R D R ) ij ij ij ik k kj Complexity: O(k^3) Best-case: O(t) Worst-case O(tk) Fall 2010 21

  • PC-1 5 k 5 O ( n ) Complexity: O(n^3) triplets, each take O(k^3) steps O(n^3 k^3)  Max number of loops: O(n^2 k^2) . Fall 2010 22

  • PC-2 Complexity: 3 k 5 O ( n ) Optimal PC-4: 3 k 3 O ( n )  (each pair deleted may add: 2n-1 triplets, number of pairs: O(n^2 k^2) size of Q is O(n^3 k^2), processing is O(k^3)) Fall 2010 23

  • Example: before and after path- consistency PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly? Fall 2010 24

  • Example: before and after path- consistency PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly? Fall 2010 25

  • Path-consistency Algorithms Apply Revise-3 (O(k^3)) until no change ← ∩ π ⊗ ⊗ R R ( R D R ) ij ij ij ik k kj Path-consistency (3-consistency) adds binary constraints. 5 k 5 O ( n ) PC-1: 3 k 5 O ( n ) PC-2: 3 k 3 O ( n ) PC-4 optimal: Fall 2010 26

  • I-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 27

  • Higher levels of consistency, global-consistency Click to edit Master text styles Definition: Second level ● Third level ● Fourth level ● Fifth level Fall 2010 28

  • Revise-i i Complexity: for binary constraints O ( k ) i O (( 2 k ) ) For arbitrary constraints: Fall 2010 29

  • 4-queen example Fall 2010 30

  • I-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 31

  • I-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 32

  • Arc-consistency for non-binary constraints: Generalized arc-consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level ← ∩ π ⊗ D D ( R D ) − x x x S S { x } Complexity: O(t k), t bounds number of tuples. Relational arc-consistency: ← π ⊗ R ( R D ) − − S { x } S { x } S x Fall 2010 33

  • Examples of generalized arc- consistency x+y+z <= 15 and z >= 13 implies x<=2, y<=2 Example of relational arc-consistency ∧ → ¬ ⇒ ¬ ∨ ¬ A B G , G , A B Fall 2010 34

  • More arc-based consistency Global constraints: e.g., all-different constraints Special semantic constraints that appears often in practice and a specialized constraint propagation. Used in constraint programming. Bounds-consistency: pruning the boundaries of domains Fall 2010 35

  • Sudoku – Constraint Satisfaction • Variables: empty slots • Constraint • Domains = • Propagation {1,2,3,4,5,6,7,8,9} • Constraints: • Inference 27 all- • different 2 3 2 4 6 Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints Fall 2010 36

  • Example for alldiff A = {3,4,5,6} B = {3,4} C= {2,3,4,5} D= {2,3,4} E = {3,4} F= {1,2,3,4,5,6} Alldiff (A,B,C,D,E} Arc-consistency does nothing Apply GAC to sol(A,B,C,D,E,F)?  A = {6}, F = {1}…. Alg: bipartite matching kn^1.5 (Lopez-Ortiz, et. Al, IJCAI-03 pp 245 (A fast and simple algorithm for bounds consistency of alldifferent constraint) Fall 2010 37

  • Global constraints Alldifferent Sum constraint (variable equal the sum of others) Global cardinality constraint (a value can be assigned a bounded number of times to a set of variables) The cummulative constraint (related to scheduling tasks) Fall 2010 38

  • Bounds consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 39

  • Bounds consistency Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Fall 2010 40

  • Boolean constraint propagation (A V ~B) and (B) B is arc-consistent relative to A but not vice-versa Arc-consistency by resolution: res((A V ~B),B) = A Given also (B V C), path-consistency: res((A V ~B),(B V C) = (A V C) Relational arc-consistency rule = unit-resolution ∧ → ¬ ⇒ ¬ ∨ ¬ A B G , G , A B Fall 2010 41

  • Constraint propagation for Boolean constraints: Unit propagation Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level Click to edit Master text styles Second level ● Third level Fall 2010 42 ● Fourth level

  • Example (if there is time) –– M: The unicorn is mythical – I: The unicorn is immortal – L: The unicorn is mammal – H: The unicorn is horned – G: The unicorn is magical ¬ M → ( ¬ I L)) ((I L) → H) (H → G) (M → I ) ( ∧ ∧ ∧ ∨ ∧ A Logic Puzzle IV • Is the unicorn mythical? Is it magical? Is it horned? (M → I ) ( ∧ ¬ M → ( ¬ I L)) ((I L) → H) (H → G) ∧ ∧ ∨ ∧ ⊢ ( ¬ M I ) (M ( ∨ ∧ ∨ ¬ I L)) ((I L) → H) (H → G) ∧ ∧ ∨ ∧ ⊢ ( ¬ M I ) (M ∨ ∧ ∨ ¬ I ) (M L) ((I L) → H) (H → G) ∧ ∨ ∧ ∨ ∧ ⊢ (I L) ((I L) → H) (H → G) ∨ ∧ ∨ ∧ ⊢ H G ∧ • Hence, the unicorn is not necessarily mythical, but it is horned and magical ! Fall 2010 43