chapter 3dechter/books/chapter03.pdf · chapter 3. fall i2003 cs 275a - on st rai ne w k 2...

53
1 Chapter 3

Upload: ngophuc

Post on 07-Mar-2019

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

1

Chapter 3

Page 2: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 2

Approximation of inference:• Arc, path and i-consistecy

Methods that transform the original network into a tighter and tighter representations

Page 3: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 3

Arc-consistency

32,1,

32,1, 32,1,

1 ≤≤≤≤ X, Y, Z, T ≤≤≤≤ 3X <<<< YY = ZT <<<< ZX ≤≤≤≤ T

X Y

T Z

32,1,<<<<

=

<

Page 4: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 4

1 ≤≤≤≤ X, Y, Z, T ≤≤≤≤ 3X <<<< YY = ZT <<<< ZX ≤≤≤≤ T

X Y

T Z

<<<<

=

<

1 3

2 3

Arc-consistency

Page 5: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 5

Page 6: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 6

∏←A BABA DRR

.2,1 to of domain reduces

constriant ,3,2,1 ,3,2,1=

<==X

YX

RXYXRR

Page 7: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 7

)( jijiii DRDD ⊗∩← π

Page 8: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 8

!"

Page 9: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 9

#

)( 3enkO Complexity (Mackworth and Freuder, 1986): e = number of arcs, n variables,k values (ek^2, each loop, nk number of loops), best-case = ek,

Arc-consistency is: )( 2ekΩ

Page 10: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 10

)( 3ekO Complexity: Best case O(ek), since each arc may be processed in O(2k)

Page 11: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 11

$% &"" '

( % (

&&"

Page 12: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 12

)

)( 2ekO Complexity: (Counter is the number of supports to ai in xi from xj. S_(xi,ai) is the

set of pairs that (xi,ai) supports)

Page 13: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 13

*

&&

Implement AC-1 distributedly.

Node x_j sends the message to node x_i

Node x_i updates its domain:

Messages can be sent asynchronously or scheduled in a topological order

)( jijij

i DRh ⊗← π

)( jijiii DRDD ⊗∩← π

jiii

jijiii

hDD

DRDD

∩←

=⊗∩← )(π

Page 14: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 14

+,

Example: a triangle graph-coloring with 2 values.• Is it arc-consistent?• Is it consistent?

It is not path, or 3-consistent.

Page 15: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 15

-

Page 16: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 16

-

Page 17: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 17

)( kjkikijijij RDRRR ⊗⊗∩← π

Complexity: O(k^3) Best-case: O(t) Worst-case O(tk)

Page 18: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 18

-#

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) .

)( 55knO

Page 19: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 19

-.

)( 53knO Complexity: Optimal PC-4: (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))

)( 33knO

Page 20: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 20

$% &" &

PC-1 requires 2 processings of each arc while PC-2 may not Can we do path-consistency distributedly?

Page 21: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 21

+

Page 22: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 22

/""'

""

Page 23: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 23

)( ikO Complexity: for binary constraints For arbitrary constraints: ))2(( ikO

Page 24: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 24

)!% &"

Page 25: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 25

+

Page 26: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 26

0"(

Complexity: O(t k), t bounds number of tuples.Relational arc-consistency:

)( xSSxxx DRDD −⊗∩← π

)( xSxSxS DRR ⊗← −− π

Page 27: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 27

$% &""(

x+y+z <= 15, z >= 13 x<=2, y<=2

Example of relational arc-consistency

BAGGBA ¬∨¬¬→∧ ,,

Page 28: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 28

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

Do exercise 16

Page 29: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 29

$% &"""

A = 3,4,5,6 B = 3,4 C= 2,3,4,5 D= 2,3,4 E = 3,4 Alldiff (A,B,C,D,E Arc-consistency does nothing Apply GAC to sol(A,B,C,D,E)? 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)

Page 30: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 30

0""

Alldifferent Sum constraint Global cardinality constraint (a value can

be assigned a bounded number of times) The cummulative constraint (related to

scheduling tasks)

Page 31: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 31

1

Page 32: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 32

1 ""

Page 33: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 33

1"&&

(A V ~B) and (B)• B is arc-consistent relative to A but not vice-versa

Arc-consistency achieved by resolution:res((A V ~B),B) = A

Given also (B V C), path-consistency means:res((A V ~B),(B V C)) = (A V C)

What can generalized arc-consistency do to cnfs?Relational arc-consistency rule = unit-resolution

Page 34: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 34

1"&&

If Alex goes, then Becky goes: If Chris goes, then Alex goes: Query:

Is it possible that Chris goes to the party but Becky does not?

) (or, BA BA ∨¬→) (or, ACA C ∨¬→

e?satisfiabl Is

¬∨¬∨¬= C B, A,C B,Aϕtheorynalpropositio

Page 35: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 35

&&1"

2&&

Page 36: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 36

" ""

"(

Think about the following:• GAC-i apply AC-i to the dual problem when singleton

variables are explicit: the bi-partite representation.• What is the complexity?• Relational arc-consistency: imitate unit propagation.• Apply AC-1 on the dual problem where each subset of

a scope is presented.• Is unit propagation equivalent to AC-4?

Page 37: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 37

3,10,7

3],10,10[

5,10]9,5[],5,1[

10],15,5[],10,1[

−≥−−=+−−≥−−

≤+−∈

−≤−=+−−∈∈−

=+∈∈

zyyxaddingbyobtained

zxyconsistencpath

zy

z

yyxaddingby

yxyconsistencarc

yx

yx

Page 38: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 38

3""

Page 39: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 39

&"

'& )

Page 40: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 40

*

&&

Implement AC-1 distributedly.

Node x_j sends the message to node x_i

Node x_i updates its domain:

Generalized arc-consistency can be implemented distributedly: sending messages between constraints over the dual graph:

)( jijij

i DRh ⊗← π

)( jijiii DRDD ⊗∩← π

jiii hDD ∩←

)( xSxSxS DRR ⊗← −− π

Page 41: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 41

21

3

A

232C

1A

12

32

1323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R

2R

4R

3R

5R

6R

* ""

% &"

A

B C

D F

G

The message that R2 sends to R1 is

R1 updates its relation and domains and sends messages to neighbors

Page 42: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 42

*

b) Constraint network

DR-AC can be applied to the dual problem of any constraint network.

A

AB AC

ABD BCF

DFG

A

AB

A

A

AB

C

B

D F

A

Page 43: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 43

2

1

3

A

232C

1A

12321323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

* "4&

Page 44: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 44

21

3

A

232C

1A

12321323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

21

3

A21

3

A

21

3

A13

A

21

3

B13

B

21

3

A12

D

13

F

21

3

D

2C

21

3

B

2C

13

F

21

3

A

21

3

B

+#

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

Page 45: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 45

13

A

232C

1A12

3213

3B

1A

13F

232C

1B

1322131

2D

23

3B

1A

3G

1F

2D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+#

Page 46: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 46

13

A

232C

1A12

3213

3B

1A

13F

232C

1B

1322131

2D

23

3B

1A

3G

1F

2D

13

A

13

A

21

3

A13

A

13

A2D

13

F

21D

2C

13

B

2C

1F

21

3

A

13

B

21

3

B

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

+.

13

B

Page 47: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 47

13

A

232C

1A13

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

+.1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Page 48: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 48

13

A

13

A

13

A

3B

13

A2D

1F

2D

2C

13

B

2C

1F

13

A13

A13

A

232C

1A13

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

13

B

13

B

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+

Page 49: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 49

13

A

232C

1A

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+

Page 50: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 50

13

A

13

A

1A

3B

13

A2D

1F

2D

2C

3B

2C

1F

13

A13

A13

A

232C

1A

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

13

B

13

B

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+)

Page 51: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 51

1A

232C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+)

Page 52: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 52

1A

1A

1A

3B

3B

3B

1A

2D

1F

2D

2C

3B

2C

1F

1A

1A

1A

232C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+5

Page 53: Chapter 3dechter/books/chapter03.pdf · Chapter 3. Fall I2003 CS 275A - on st rai Ne w k 2 Approximation of inference:

Fall 2003 ICS 275A - Constraint Networks 53

1A

2C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

+5