William Lam CS 275 Project
description
Transcript of William Lam CS 275 Project
![Page 1: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/1.jpg)
An Overview of Compiling Constraint Networks into AND/OR Multi-valued
Decision Diagrams (AOMDDs)
William LamCS 275 Project
The slides on AND/OR search and decision diagrams were provided by Rina Dechter.
Papers:Mateescu R., Dechter R. Compiling Constraint Networks into AND/OR Multi-valued Decision Diagrams (AOMDDs). (CP 2006)
Mateescu R., Dechter R., and Marinescu, R. AND/OR Multi-valued Decision Diagrams (AOMDDs) for Graphical Models. (JAIR 2008)
![Page 2: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/2.jpg)
Outline Introduction AND/OR Search Spaces (Quick Review) Decision Diagrams – Binary and Multi-
valued (BDD/MDD) AND/OR MDDs (AOMDDs) Experiments Conclusion
2
![Page 3: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/3.jpg)
Introduction Combining two frameworks
AND/OR Search Spaces Multi-valued Decision Diagrams (MDDs)
Both are more compact ways to represent problems.
Their combination yields an even more compact representation.
Decision Diagrams are known to allow online speed queries.
3
![Page 4: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/4.jpg)
Introduction
4
)()()()()()(
ABCFCDFBDFBCFABEFACFF A
D
B C
E
F
Compiled structure
OFFLINE
ONLINE
Evaluate answer
Polytime? Constant time?
ONCE
MANY
Query
![Page 5: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/5.jpg)
Classic OR Search Space
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1
E
C
F
D
B
A 0 1
Ordering: A B E C D F
A
D
B C
E
F
![Page 6: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/6.jpg)
AND/OR Search Space
AOR
0AND 1
BOR B
0AND 1 0 1
EOR C E C E C E C
OR D F D F D F D F D F D F D F D F
AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
AND 0 10 1 0 10 1 0 10 1 0 10 1
A
D
B C
E
F
A
D
B
CE
F
Primal graph DFS tree
A
D
B C
E
F
A
D
B C
E
F
![Page 7: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/7.jpg)
AND/OR vs. ORAOR
0AND 1
BOR B
0AND 1 0 1
EOR C E C E C E C
OR D F D F D F D F D F D F D F D F
AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
AND 0 10 1 0 10 1 0 10 1 0 10 1
E 0 1 0 1 0 1 0 1
0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0B 1 0 1
A 0 1
E 0 1 0 1 0 1 0 1
0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0B 1 0 1
A 0 1
AND/OR
OR
A
D
B C
E
FA
D
B
CE
F
1
1
1
0
1
0
AND/OR size: exp(4), OR size exp(6)
![Page 8: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/8.jpg)
From AND/OR TreeA
D
B C
E
F
A
D
B
CE
F
G H
J
K
G
H
J
KAOR
0AND 1
BOR B
0AND 1 0 1
EOR C E C E C E C
OR D F D F D F D F D F D F D F D F
AND
AND 0 10 1 0 10 1 0 10 1 0 10 1
OR
OR
AND
AND
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
![Page 9: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/9.jpg)
To an AND/ORGraph
A
D
B C
E
F
A
D
B
CE
F
G H
J
K
G
H
J
KAOR
0AND 1
BOR B
0AND 1 0 1
EOR C E C E C E C
OR D F D F D F D F D F D F D F D F
AND
AND 0 10 1 0 10 1 0 10 1 0 10 1
OR
OR
AND
AND
0
G
H H
0 1 0 1
0 1
1
G
H H
0 1 0 1
0 1
0
J
K K
0 1 0 1
0 1
1
J
K K
0 1 0 1
0 1
![Page 10: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/10.jpg)
AND/OR Search Graphs Any two nodes that root identical subtrees/subgraphs
(are unifiable) can be merged
Minimal AND/OR search graph: of R relative to tree T is the closure under merge of the AND/OR search tree of R relative to T, where inconsistent subtrees are pruned.
Canonicity: The minimal AND/OR graph relative to T is unique for all constraints equivalent to R.
![Page 11: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/11.jpg)
All Four Search Spaces
Full OR search tree 126 nodes
Full AND/OR search tree54 AND nodes
Context minimal OR search graph28 nodes
Context minimal AND/OR search graph18 AND nodes
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 01 0 1 0 10 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10 1 0 1 01 0 1 0 1 0 1 01 010 1 01 0 1 01
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1
CD
FE
BA 0 1
AOR
0AND
BOR
0AND
OR E
OR F F
AND 0 1 0 1
AND 0 1
C
D D
0 1 0 1
0 1
1
E
F F
0 1 0 1
0 1
C
D D
0 1 0 1
0 1
1
B
0
E
F F
0 1 0 1
0 1
C
D D
0 1 0 1
0 1
1
E
F F
0 1 0 1
0 1
C
D D
0 1 0 1
0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
0 1
0 1 0 1
0 1 0 1
C
D
F
E
B
A 0 1
AOR0ANDBOR
0ANDOR E
OR F FAND 0 1
AND 0 1
C
D D0 1
0 1
1
EC
D D
0 1
1
B
0
E
F F
0 1
C
1
EC
A
E
C
B
F
D
![Page 12: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/12.jpg)
Ordered Binary Decision Diagram
12
A B C f(ABC)0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1
B = {0,1} f : B3 → B
Table
B
A
C
0 0
C
0 1
B
C
0 1
C
0 1
SimplifyMerge terminal nodes
B
A
C C
0 1
B
C C
1) Merge nodes with identical children
B
A
C
0 1
B
C
2) Remove redundant nodes
B
A
0 1
B
C
B
A
0 1
C
OBDD[Bryant86]
Ordering enables efficient operations
B
A
C
0 0
C
0 1
B
C
0 1
C
0 1
Decision tree
A
B
C
![Page 13: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/13.jpg)
Decision Diagrams
13
f = (A ∨ E) ∧ (B ∨ F)
g = (C ∨ G) ∧ (D ∨ H)
B
A
F
10
E
B
E f ∧ g = ?
f ∧ g =
OBDD
OBDD
D
C
H
10
G
D
G
ANDD
C
H
10
G
D
G
B
A
F
10
E
B
E
0 1
B
A
C
D D
C
B
D D
C
D D
C
D D
E E E E E E E E
F F
H
GG
F F
![Page 14: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/14.jpg)
AOMDDs
14
Point dead-ends to terminal node “0”
Point goods to terminal node “1”
0
A
0 1
B
0 1
1
C
0 1
B
0 1
Decision Diagram
A
B
C
A B C f(ABC)0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1
A
0 1
B
1
C
1
B
0 1
Minimal AND/OR graph
![Page 15: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/15.jpg)
Removing Redundancy
15
0
A
0 1
B
0 1
1
C
0 1
B
0 1
redundant
Group OR node together with its AND children into a meta-node
0
A
0 1
B
0 1
1
C
0 1
B
0 1
0
A
0 1
B
0 1
1
C
0 1
OBDD(pseudo tree is a chain)
A
B
C
A B C f(ABC)0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1
0
A
0 1
B
0 1
1
C
0 1
![Page 16: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/16.jpg)
AOBDD
16
A
B
C
A B C f(ABC)0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 01 1 1 1
0
A
0 1
B
0 1
1
C
0 1*
A
B
D
A
B
DC
=
A B D g(ABD)0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 11 1 1 0
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
0 1
B
0 1
0
C
0 1
D
0 1
1
B
0 1
D
0 1
![Page 17: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/17.jpg)
Apply Operator
17
0
A
0 1
B
0 1
1
C
0 1* =
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
B
DC
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
B6
B7
A1B1
A
0 1A1B1
A2B2
A4B6
B
0 1A2B2
A3B3
A4B4
0
![Page 18: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/18.jpg)
Apply Operator
18
0
A
0 1
B
0 1
1
C
0 1* =
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
B
DC
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
B6
B7
A
0 1A1B1
A4B6
B
0 1A2B2
A4B4
0
A4
B4
![Page 19: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/19.jpg)
Apply Operator
19
0
A
0 1
B
0 1
1
C
0 1* =
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
B
DC
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
B6
B7
A
0 1A1B1
A4B6
B
0 1A2B2
0
A4
B4
C
0 1A4
D
0 1B4
1
![Page 20: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/20.jpg)
Apply Operator
20
0
A
0 1
B
0 1
1
C
0 1* =
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
B
DC
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
B6
B7
A
0 1A1B1
A4B6
B
0 1A2B2
0
C
0 1A4
D
0 1B4
1
B
0 1A4B6
A4B4
A4B7
![Page 21: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/21.jpg)
Apply Operator
21
0
A
0 1
B
0 1
1
C
0 1* =
0
A
0 1
B
0 1
1
D
0 1
D
0 1
B
0 1
A
B
DC
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
B6
B7
A
0 1A1B1
B
0 1A2B2
0
C
0 1A4
D
0 1B4
1
B
0 1A4B6
A4B7
D
0 1B7
![Page 22: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/22.jpg)
And/Or Multi-Valued Decision Diagrams
AOMDDs are:
AND/OR search graphs
canonical representations, given a pseudo tree
Defined by two rules: All isomorphic subgraphs are merged There are no redundant (meta) nodes
22
![Page 23: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/23.jpg)
23
Example:
HG
ED
C F
B
A
F0 1
H0 1
0 1C1
A0 1
H0 1
0 1C2
A0 1
B0 1
G0 1
G0 1
B0 1
0 1C3
F0 1
G0 1
0 1C4
A0 1
E0 1
0 1C6
C0 1
E0 1
0 1C7
C0 1
D0 1
D0 1
0 1C8
B0 1
C0 1
0 1C9
B0 1
F0 1
0 1C5
m1
m3
m7
m6
m4 m 2m 5
A0 1
F0 1
H0 1
F0 1
H0 1
0 1m1
A0 1
B0 1
G0 1
F0 1
B0 1
G0 1
0 1m2
A0 1
E0 1
C0 1
0 1m4
C0 1
D0 1
D0 1
0 1m5
A0 1
B0 1
F0 1
G0 1
H0 1
F0 1
G0 1
B0 1
F0 1
F0 1
H0 1
0 1m3
A0 1
B0 1
C0 1
C0 1
D0 1
E0 1
D0 1
B0 1
C0 1
C0 1
0 1m6
m7
A
F
H
D
C B F
AE
G
H
primal graph
A
B
C F
D E G H
pseudo tree
A
B
F
G H
C
D
A
B
C
D E
A
B
C F
D E G H
A
B
F
G
C
E
A
(f h) (a∨ ∧ ∨ !h) (a#b#g) (f g) ∧ ∧ ∨ ∧(b f) (a e) (c e) (c#d) (b c)∨ ∧ ∨ ∧ ∨ ∧ ∧ ∨
![Page 24: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/24.jpg)
Example (continued)
24
B
A
m7
A0 1
B0 1
F0 1
G0 1
H0 1
F0 1
G0 1
B0 1
F0 1
F0 1
H0 1
0 1m3
A0 1
B0 1
C0 1
C0 1
D0 1
E0 1
D0 1
B0 1
C0 1
C0 1
0 1m6
A
B
C F
D E G H
m7
A0 1
B0 1
C0 1
0
D0 1
1
F0 1
G0 1
H0 1
C0 1
D0 1
E0 1
F0 1
G0 1
B0 1
C0 1
F0 1
C0 1
F0 1
H0 1
![Page 25: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/25.jpg)
AOBDD vs. OBDD
25
D
C
B
F
A
E
G
H
1 0
B
CC C
D D D D D
E E
F F F
G G G G
H
AOBDD18 nonterminals47 arcs
OBDD27 nonterminals54 arcs
A0 1
B0 1
C0 1
0
D0 1
1
F0 1
G0 1
H0 1
C0 1
D0 1
E0 1
F0 1
G0 1
B0 1
C0 1
F0 1
C0 1
F0 1
H0 1
A
B
C F
D E G H
A
B
C
F
D
E
G
H
D
C B F
AE
G
H
primal graph
![Page 26: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/26.jpg)
Complexity of Compilation The size of the AOMDD is O(n kw*)
The compilation time is also bounded by O(n kw*)
26
k = domain sizen = number of variablesw*= treewidth
![Page 27: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/27.jpg)
Semantic Treewidth Given a network, there may exist a sparser
equivalent network. Challenges the idea of using induced width
to measure the difficulty of the problem AOMDD sizes are much smaller than the
bound
27
![Page 28: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/28.jpg)
Semantic Treewidth With respect to a pseudo tree, this is the
smallest treewidth over all equivalent networks that can have that pseudo tree
With respect to the network, this is the smallest semantic treewidth over all pseudo trees that can express the set of solutions
Instead of the induced width bounding AOMDD size, we can use semantic treewidth.
28
![Page 29: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/29.jpg)
Experimental Results
29
Langford(2,k) problem as a CSP
![Page 30: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/30.jpg)
Experimental Results
30
Langford(2,k) problem as a SAT problem
![Page 31: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/31.jpg)
Experimental Results
31
Uniform Random 3-SAT instances
![Page 32: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/32.jpg)
Experimental Results
32
Equality constraint network results
![Page 33: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/33.jpg)
Conclusion AOMDDs allow us to encode the same
information about a problem in an exponentially more compact form
Canonicity aids in revealing whether the induced width is overestimating the difficulty of a problem
It may be interesting to perform more experiments on real-world CSPs.
33
![Page 34: William Lam CS 275 Project](https://reader035.fdocuments.in/reader035/viewer/2022062218/56815ede550346895dcd8172/html5/thumbnails/34.jpg)
Acknowledgements Rina Dechter
Pointing me to additional literature Providing me many of these slides
Radu Marinescu Providing me the code to compile AOMDDs
34