Quick viewing(Text Mode)

Presentation Decision Diagrams White

Presentation Decision Diagrams White

The State Explosion Problem

¢ Many problems suffer from state space explosion : the number of states is exponential in the number of Symbolic Encoding variables in the system. using Decision Diagrams ¢ Decision diagrams (DDs): graph-based, canonical using Decision Diagrams representation of functions that avoids space explosion in many practical cases . 16.412J/6.834J Cognitive Robotics

Martin Sachenbacher M (using material from Randal Bryant, Alan Mishchenko, and Geert Janssen)

CiteSeer Database Overview

¢ Binary Decision Diagrams (BDDs)

¢ Extensions: ADDs, MDDs, ZDDs, SBDDs

¢ Decision Diagram Packages

¢ Combining Symbolic Encoding and Search

Boolean Functions Shannon Expansion

¢ Binary Variables x 1, …, xn ¢ Consider f (x 1, x 2, …, xn). Then: ¢ Function f: x , …, x → {0,1} 1 n f = ( ¬x ∧ f | ) ∨ (x ∧ f | ) x y z f(x,y,z) 1 x1 = 0 1 x1 = 1 Sum of Products (DNF) 0 0 0 0 f = ( ¬x∧y∧z) ∨ (x∧¬ y∧z) ∨ Cofactor Cofactor 0 0 1 0 (x∧y∧z) x1=0 x1=1 0 1 0 0 Product of Sums (CNF) 0 1 1 1 f = (x∨y∨z) ∧ (x∨y∨¬ z) ∧ 1 0 0 0 (x∨¬ y∨z) ∧ (¬x∨y∨z) ∧ 1 0 1 1 (¬x∨¬ y∨z) 1 1 0 0 1 1 1 1

1 Binary Decision Trees Variable Ordering

¢ Recursive Shannon expansion ¢ Impose arbitrary total ordering on variables

¢ Variables must obey ordering along all paths x 0 1 ¢ Property: No conflicting assignments along path

y z 0 1 0 1 x x z x

z z y y y y 0 1 0 1 0 10 1 z y x x 0 0 0 1 0 0 1 1

Ordered Binary Decision Avoiding Blow -Up

¢ Order x < y < z ¢ Decision tree no more space-efficient than truth table x 0 1 – Still explicitly enumerates all the 2 n possible valuations ¢ Idea: Transform to (DAG) y y – Promotes sharing of sub-expressions 01 0 1

z z z z M " 0 1 0 1 0 10 1

0 0 0 1 0 1 0 1

Ordered Binary Decision Tree Rule 1: Collapse Leaf Nodes

x No longer x 0 1 a tree. 0 1

y y y y 01 0 1 01 0 1

z z z z z z z z 1 1 0 1 0 0 1 0 1 0 10 1 0 0 1 0 0 0 1 0 1 0 1 0 1

2 Rule 2: Remove Redundant Tests Rule 2: Remove Redundant Tests

x x 0 1 0 1

y y y y 0 1 0 1 1 0 1 0 z z z z z z z 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 0 1

Rule 3: Isomorphic Subgraphs Rule 3: Isomorphic Subgraphs

x x 0 1 0 1

y y y 0 y 1 0 1 1 0 0 1 z z z z 1 0 1 0 1 0 0 1 0 1 0 1

Rule may become applicable again Final Representation

x x 0 1 0

y 0 y y 1 1 1 Reduced, Ordered 0 1 0 Binary Decision Diagram (ROBDD) z 1 z 1 0 0

0 1 0 1

3 OBDT to ROBDD Summary Canonicity of ROBDDs

An ROBDD can be obtained from an OBDT by ¢ Is there a unique DD for each boolean function?

repeatedly applying the following reduction rules ¢ Theorem: DD canonical , iff reduced and ordered . (until none of the them can be applied anymore): – Reduced: None of the reductions applicable – Ordered: There is a total variable ordering ¢ Remove duplicate terminal (leaf) nodes ¢ Enables checking equivalence of boolean functions ¢ Remove duplicate non-terminal (internal) nodes by checking equivalence of corresponding ROBDDs. ¢ Remove nodes with redundant tests

Equivalence Checking Example Solution by Combinatorial Search

¢ Do two circuits compute an identical function ? ¢ Prove all assignments fail to check equivalence

– Basic task in formal hardware verification ¢ Typically, must explore significant fraction of inputs – Compare new design to known “good” design ¢ Exponential time complexity

Circuit 1 Circuit 2 0 A 0 1 A A 1 C O1 B C O1 O2 1 B 1 C Diff 0 B 0 A 1 1 B 1 C O2 1

Solution using ROBDDs Example ROBDDs

S3 Cout ¢ Functions equal iff ROBDDs identical ¢ 4 bit adder a a – Never enumerate explicit function values – 31 nodes 3 3 – Exploit structure and regularity of functions ¢ 64 bit adder S2 b3 b3 b3 b3 – 571 nodes A a2 a2 a2 A ¢ … B S b b b b b b C O1 1 2 2 2 2 2 2 C a a a A 1 1 1 B Cout 0 1 S b b b b b b S 0 1 1 1 1 1 1 a a a A A B 0 0 0

B B b0 b0 C O2 C Linear growth 0 1 0 1

4 Influence of Variable Ordering Variable Ordering

¢ Function f = (a1 ∧ b1) ∨ (a2 ∧ b2) ∨ (a3 ∧ b3) ¢ ROBDD size depends strongly on variable ordering

¢ Finding variable ordering that produces minimal a a1 1 ROBDD size is intractable a a – But, heuristics exist for finding good variable orderings J b1 2 2 ¢ Functions exist whose ROBDD has exponential a a a a a L 2 3 3 3 3 size for any variable ordering b b b b – But, such functions are rarely encountered J b2 1 1 1 1

a b b 3 Good 2 2 Bad ordering: b ordering: b3 3 Linear Exponential 0 1 growth 0 1 growth

Manipulating ROBDDs Apply Operator

4 Root f <<< ¢ Procedure Apply(f,g) for implementing all the 2 = 16 ¢ Three possible cases x 1 Root g two-argument logical operations on boolean functions 0

x Apply(f,g) = 0 1 Apply Apply (¬x ∧ Apply(f |x =0 , g|x =0 )) ∨ (x ∧ Apply(f |x =1 , g|x =1 )) (f | x=0 , g) (f | x=1 , g)

Recursive Recursive Apply Apply x Root f >>> | | (f | , g | ) 1 descent into descent into (f x=0 , g x=0 ) x=1 x=1 0 Root g subtrees x=0 subtrees x=1 Root f === Root g Apply Apply

(f, g | x=0 ) (f, g | x=1 )

Apply Operator Pseudocode Apply Operator Example

Function Apply( F, G ) A B if ( AlreadyComputed( F, G ) ) return the result 1 a 1 a A1,B 1 elsif ( F ∈{0,1} and G∈{0,1} ) return oper( F, G ) elsif ( Var( F ) = Var( G ) ) A2 b A2,B 2 u ← CreateNode( Var(F), Apply(Fx’,Gx’), Apply(Fx,Gx)); elsif ( Var( F ) < Var( G ) ) A A ,B 6 c B5 c A6,B 2 6 5 u ← CreateNode( Var(F) , Apply(Fx’,G ), Apply(Fx,G )); ∨∨∨ else /* ( Var( F ) > Var( G ) ) */ B A3 2 A ,B A ,B u ← CreateNode( Var(G) , Apply(F,Gx’ ), Apply(F,Gx )); d d 3 2 5 2 A3,B 4 InsertComputed( F,G,u ); return u; 0 1 0 1 A ,B 4 3 A5,B 4 Complexity: O(|F| ∗∗∗|G|) A4 A5 B3 B4

5 Apply Operator Example Generating ROBDDs Incrementally

¢ Network of components as ROBDD A1,B 1 a a A ← new_var("a") T1 A B ← new_var("b“) A ,B 2 2 C O1 C ← new_var("c") b b T1 ← And(A, B) A ,B A ,B 6 2 6 5 B T2 T2 ← And(B, C) c c c O1 ← Or(T1, T2) A ,B 3 2 A5,B 2 A3,B 4 Decision Diagrams O1 d a d 1 1 T1 T2 A B C a b b b A ,B 4 3 A5,B 4 0 1 0 1 a b c b c c 0 1 0 1 0 1 0 1 0 1 0 1

ROBDDs Summary Overview

¢ Exploit structure and regularities of functions ¢ Binary Decision Diagrams (BDDs)

¢ Exponential number of discrete states can be ¢ Extensions: ADDs, MDDs, ZDDs, SBDDs

captured in polynomial-size ROBDD ¢ Decision Diagram Packages

¢ Satisfiability, , Complement constant ¢ Combining Symbolic Encoding and Search ¢ Apply (and, or, etc.) polynomial in ROBDD size

¢ Variable ordering important, but difficult to find

Algebraic DDs (ADDs ) [ Bahar 93] Multi -Valued DDs (MDDs ) [ Kam 90]

¢ Extension to functions with non-binary values ¢ Extension to functions with non-binary variables

¢ Canonicity of representation (as for BDDs) ¢ Canonicity of representation (as for ROBDDs)

¢ Applications in combinatorial optimization ¢ However, binary encoding of domains often better

x x y z f(x,y,z) ADD MDD x 0 0 0 3 y y 0 2 0 0 1 2 0 1 0 0 z z 1 0 1 1 1 … … 0 1 2 3

6 Zero -suppressed DDs (ZDDs ) [Minato 93] Shared BDDs (SBDDs ) [Minato 90]

¢ Adapted to sparse functions (many 0’s in on-) ¢ Global table storing unique nodes

¢ Modified rule 2: Remove node if 1-edge points to 0 ¢ Equivalence check for functions becomes constant

f g h x∧¬∧¬∧¬ y∨¬∨¬∨¬ x∧∧∧y x∧¬∧¬∧¬ y x∨¬∨¬∨¬ y g f h x x x x x x x 0 1 0 1 0 ZDD: 0 1 1 0 1 Default 0 y y 0 y y 1 0 y y 1 y y 11 1 0 11 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1

DD Templates [ Goel Hasteer Bryant 03] Overview

¢ Share not only functions, but also function types : ¢ Binary Decision Diagrams (BDDs)

¢ Extensions: ADDs, MDDs, ZDDs, SBDDs f:a b g: c d f: a b g: c d ¢ Decision Diagram Packages 0 1 0 1 0 1 0 1 ¢ Combining Symbolic Encoding and Search 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1

f ≡≡≡ g {a\c,b\d} a c x 0 0 0 b 1 d 1 1 0 0 0 y 0 1 0 1 0 1

Decision Diagram Packages Package Characteristics

Code Name Author(s) Affiliation Code Name of the package Vmax Maximum # of variables ABC ABCD 0.3 Armin Biere ETH Zurich BUD BuDDy 1.9 Jørn Lind-Nielsen ITU, Denmark Lang Programming language P Unique table per variable CAL CAL Rajeev Ranjan UC Berkeley T Type (Pointers/Indices) GC Ref. Count or Mark-Sweep CMU CMU David Long CMU/ATT R Traversal (Depth/Breadth) CT Computed table shared CUD CUDD 2.3.1 Fabio Somenzi Boulder, CO M Supports Managers DV Dynamic Variable ordering EST EST 1ed Robert Meolic Maribor, Slovenia Nmax Maximum # of nodes Ext # of functions in API IBM IBM Geert Janssen IBM Watson MON MONA Anders Møller ATT/BRICS Siz Size of a node in bytes Year First year when available PDT Cusinato/Corno Politecnico di Torino 64 Size increases on 64-bit Pro Quality of code STA StaticBdd 1.0 Stefan Edelkamp Freiburg, Germany TGR TiGeR 3.0? Coudert/Madre/Touati Bull/DEC/Xorix Source: [Janssen 2002] TUD TUDD 0.8.3a Stefan Höreth Darmstadt, Germany

7 Comparing Packages Overview

Code Lang T R M Nmax Siz 64 Vmax P GC CT DV Ext Year Pro ¢ Binary Decision Diagrams (BDDs) ABCC I DY2^25 8 - 2^10 NMS S N 441997B ¢ Extensions: ADDs, MDDs, ZDDs, SBDDs BUD C/C++ I D N2^32 20 N2^21 NMS M Y 116 1996 B CAL C P B Y 2^28 16 Y 2^16 Y RC 8 S Y 237 1994 C ¢ Decision Diagram Packages CMUC PD Y2^29 16 Y2^16 YRC 8 S Y 75 1993 C ¢ Combining Symbolic Encoding and Search CUD C/C++ P D Y 2^28 16 Y 2^16 N RC16 S Y 287 1995 B EST C PD N2^32 36 Y2^32 NRC32 M N 72 2000 A IBM C I D Y 2^30 16 N 2^24 N MS S Y 169 1999 A MONC I D Y2^24 16 N2^16 NMS M N 40 1997 D PDT C I D N2^31 24 N2^16 NMS M N 34 1993 C STA C++ I D N2^23 8 N2^ 9 NMS S N 66 1999 C TGR C P D Y 2^30 16 Y 2^16 Y RC16 M Y 90 1994 ? TUD C I D Y2^30 20 N2^16 YRC16 S Y 44 1998 B Source: [Janssen 2002]

Branch -and -Bound Search Symbolic Branch -and -Bound

Encode ¢ Each search node is a soft Symbolically ¢ Each search node is a set of constraint subproblem soft constraint subproblems

¢ Lower Bound (lb): ¢ Lower Bound Function

Optimistic estimate of (flb ): Optimistic estimates best solution in subtree of best solutions in subtree

¢ Upper Bound (ub): ¢ Upper Bound (ub): Best solution found so far Best solution found so far

¢ Prune, if lb ≥≥≥ ub . ¢ Prune, if flb ≥≥≥ ub .

Domain Splitting Example: 4 -Queens

Generalize to search over sets : ¢ Variables: Rows

¢ Partition domains into sets ¢ Domains: Columns

¢ Choose subset for unassigned variable ¢ Constraints:

¢ Combine all completely assigned constraints

Q Q Q Q

8 Example Example

¢ Search Tree Constraints ¢ Domain splitting with partitions involved

Solution Solution

Example Sinking Operation

¢ Domain splitting with partitions ¢ is a new constraint where all values of tuples have been replaced by

¢ Generalizes the test to functions

Constraint Constraint sink(c e2 ,0.05)

Solution

Symbolic Branch -and -Bound

¢ Function ( : assignments, : value): value

Distance lower bound: lb = identity. if then if then return let be an unassigned variable for each do

return

return Encode functions f t, flb as decision diagrams.

9