Chain Reduction for Binary and Zero-Suppressed Decision Diagrams Randal E. Bryant Carnegie Mellon University http://www.cs.cmu.edu/~bryant
Overview Decision Diagrams BDDs (Bryant, 1986) vs ZDDs (Minato, 1992) Representations of Boolean functions Here: over n variables Canonical in reduced form, totally ordered variables BDDs (Bryant, 1986) vs ZDDs (Minato, 1992) BDDs: General Boolean functions ZDDs: Encoding sparse sets Within n/2× of each other for any function Chain Reduction: Unify BDDs and ZDDs CBDDs: Within 3× of (C)ZDDs CZDDs: Within 2× of BDDs Implemented via modifications of standard DD algorithms
BDDs vs ZDDs How should level-skipping edges be interpreted? Reduced Form x1 How should level-skipping edges be interpreted? x2 x3 1
Interpretations Reduced Form BDD Interpretation ZDD Interpretation x1 x2 x3 x1 x1 x2 x2 x3 x2 x2 x3 x3 x3 x3 x3 1 1 Level skipping Don’t care Level skipping One leads to zero
Interpretations Reduced Form BDD Interpretation ZDD Interpretation x1 1 1 1 Level skipping Don’t care Level skipping One leads to zero
Single Variable Function f(x1, x2, x3, x4, x5) = x3 1 x3 x1 x2 x3 x5 x4 1 BDD: 3 nodes ZDD: n + 2 nodes
Single Minterm Function f(x1, x2, x3, x4, x5) = x1 x2 x3 x4 x5 1 x3 x1 x2 x4 x5 1 x3 x2 ZDD: p + 2 nodes p = # positive literals BDD: n + 2 nodes
Encoding q-Queens Solutions 1-Hot Encoding Binary Encoding 0 1 1 1 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0
q-Queens Complexity Variables Nodes to Encode Single Solution
q-Queens Node Counts
q-Queens Node Count Ratios
Size Ratio Bounds Knuth, TAOCP 4A (2011) BDD ZDD n/2
Chain Types t f t+1 b–1 b Zero-Chain (exploited by ZDDs) t f g t+1 b–1 Zero-Chain (exploited by ZDDs) t f g t+1 b–1 b Or-Chain
Chain BDD t f g t+1 b–1 b f g t : b Or-Chain Every node has two variable levels
CBDD Reduction Rule Reduced Form General Form f g f g t : m t : b m+1 : b f g t : b
CBDD Examples 1:1 Single Minterm: ≤ 2p + 3 nodes Single variable 2:2 1:1 2:2 3:3 4:5 1 3:3 Single Minterm: ≤ 2p + 3 nodes Single variable
Chain ZDD t f g t+1 b–1 b f g t : b Every node has two variable levels Don’t Care-Chain Exploited by BDDs
CZDD Reduction Rule Reduced Form General Form f g t : m m+1 : b f g t : b
CZDD Examples 1:3 4:5 2:2 3:3 Single variable ≤ 4 nodes Single Minterm 1 1:3 4:5 1 2:2 3:3 Single variable ≤ 4 nodes Single Minterm p + 2 nodes
Size Ratios From CZDD to CBDD From BDD to CZDD From CBDD to CZDD CBDD node for each CZDD node + for each CZDD edge At most 3X larger From BDD to CZDD CZDD node for each BDD edge At most 2X larger From CBDD to CZDD No direct translation for general Or-chain
Worst Case for CZDD CBDD 6k+2 nodes 2k+3 nodes
Worst Case for BDD CZDD 4k+3 nodes 2k+3 nodes
Size Ratios BDD ZDD CBDD CZDD n/2 1 3 2
Implementation Modified versions of Apply and other algorithms Next hash table entry High child Low child index Reference Count CUDD Node Representation Negation flags Next hash table entry High child Low child index Reference Count Negation flags Chain-CUDD Node Representation bindex Modified versions of Apply and other algorithms
q-Queens Node Counts
q-Queens Node Count Ratios
Utility CBDDs All advantages of BDDs + ability to represent sparse sets At most 3× larger than ZDD CZDDs Possible replacement for BDDs At most 2× larger Avoids risks of ZDDs Blow-up of intermediate results Often have functions that depend on only subset of variables Excessive operations due to long don’t-care chains
Related Work van Dijk, Wille, Mieolic, FMCAD 2017 Associate additional variable “tag” with each edge Allows single level-skipping edge to encode two intepretations Above tag: Implicit don’t care chain At and below tag: Implicit zero-chain
Tagged BDD Example Unreduced form Tagged BDD x3 x4 x2 x1 zero chain x2 x1 zero chain don’t care x4 x2 1 x1 ∞
Possible Implementation of Tags CUDD Node Representation Next hash table entry High child Low child index Reference Count Negation flags Tagged-CUDD Node Representation index Reference Count Next hash table entry High tag High child Negation flags Low tag Low child
Comparisons Traditional BDD/ZDD Chained DDs Tagged BDDs Encode one variable in each node Possible n/2× size difference Chained DDs Encode two variables in each node Possible 2–3× size difference For CUDD: Minor change to API Tagged BDDs Encode three variables in each node Guaranteed 1× size difference For CUDD: Major change to API
Future Work Extending all of CUDD to Chaining Dynamic variable ordering Quantification ... Extension to ADDs / MTBDDs Symbolic representation of hybrid systems Partially implemented Symbolic Model Checking of Sparse Systems Work with functions over disjoint sets of variables Present state / next state Lots of don’t-care variables