Binary moment diagram

From HandWiki

A binary moment diagram (BMD) is a generalization of the binary decision diagram (BDD) to linear functions over domains such as booleans (like BDDs), but also to integers or to real numbers.[1][2]

They can deal with Boolean functions with complexity comparable to BDDs, but also some functions that are dealt with very inefficiently in a BDD are handled easily by BMD, most notably multiplication.

The most important properties of BMD is that, like with BDDs, each function has exactly one canonical representation, and many operations can be efficiently performed on these representations.

The main features that differentiate BMDs from BDDs are using linear instead of pointwise diagrams, and having weighted edges.

The rules that ensure the canonicity of the representation are:

  • Decision over variables higher in the ordering may only point to decisions over variables lower in the ordering.
  • No two nodes may be identical (in normalization such nodes all references to one of these nodes should be replaced be references to another)
  • No node may have all decision parts equivalent to 0 (links to such nodes should be replaced by links to their always part)
  • No edge may have weight zero (all such edges should be replaced by direct links to 0)
  • Weights of the edges should be coprime. Without this rule or some equivalent of it, it would be possible for a function to have many representations, for example 2x + 2 could be represented as 2 · (1 + x) or 1 · (2 + 2x).

Pointwise and linear decomposition

In pointwise decomposition, like in BDDs, on each branch point we store result of all branches separately. An example of such decomposition for an integer function (2x + y) is:

[math]\displaystyle{ \begin{cases} \text{if } x \begin{cases} \text{if } y , 3 \\ \text{if } \neg y , 2 \end{cases} \\ \text{if } \neg x \begin{cases} \text{if } y \text{ , } 1 \\ \text{if } \neg y \text{ , } 0 \end{cases} \end{cases} }[/math]

In linear decomposition we provide instead a default value and a difference:

[math]\displaystyle{ \begin{cases} \text{always} \begin{cases} \text{always } 0 \\ \text{if } y , +1 \end{cases} \\ \text{if } x , +2 \end{cases} }[/math]

It can easily be seen that the latter (linear) representation is much more efficient in case of additive functions, as when we add many elements the latter representation will have only O(n) elements, while the former (pointwise), even with sharing, exponentially many.

Edge weights

Another extension is using weights for edges. A value of function at given node is a sum of the true nodes below it (the node under always, and possibly the decided node) times the edges' weights.

For example, [math]\displaystyle{ (4x_2 + 2x_1 + x_0) (4y_2 + 2y_1 + y_0) }[/math] can be represented as:

  1. Result node, always 1× value of node 2, if [math]\displaystyle{ x_2 }[/math] add 4× value of node 4
  2. Always 1× value of node 3, if [math]\displaystyle{ x_1 }[/math] add 2× value of node 4
  3. Always 0, if [math]\displaystyle{ x_0 }[/math] add 1× value of node 4
  4. Always 1× value of node 5, if [math]\displaystyle{ y_2 }[/math] add +4
  5. Always 1× value of node 6, if [math]\displaystyle{ y_1 }[/math] add +2
  6. Always 0, if [math]\displaystyle{ y_0 }[/math] add +1

Without weighted nodes a much more complex representation would be required:

  1. Result node, always value of node 2, if [math]\displaystyle{ x_2 }[/math] value of node 4
  2. Always value of node 3, if [math]\displaystyle{ x_1 }[/math] value of node 7
  3. Always 0, if [math]\displaystyle{ x_0 }[/math] value of node 10
  4. Always value of node 5, if [math]\displaystyle{ y_2 }[/math] add +16
  5. Always value of node 6, if [math]\displaystyle{ y_1 }[/math] add +8
  6. Always 0, if [math]\displaystyle{ y_0 }[/math] add +4
  7. Always value of node 8, if [math]\displaystyle{ y_2 }[/math] add +8
  8. Always value of node 9, if [math]\displaystyle{ y_1 }[/math] add +4
  9. Always 0, if [math]\displaystyle{ y_0 }[/math] add +2
  10. Always value of node 11, if [math]\displaystyle{ y_2 }[/math] add +4
  11. Always value of node 12, if [math]\displaystyle{ y_1 }[/math] add +2
  12. Always 0, if [math]\displaystyle{ y_0 }[/math] add +1

References

  1. Nakanishi, Masaki; Hamaguchi, Kiyoharu; Kashiwabara, Toshinobu (1999-05-25). "An Exponential Lower Bound on the Size of a Binary Moment Diagram Representing Integer Division". IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences E82-A (5): 756–766. ISSN 0916-8508. https://search.ieice.org/bin/summary.php?id=e82-a_5_756&category=A&year=1999&lang=E&abst=. 
  2. Sasao, T.; Nagayama, S. (May 2006). "Representations of Elementary Functions Using Binary Moment Diagrams". 36th International Symposium on Multiple-Valued Logic (ISMVL'06). pp. 28. doi:10.1109/ISMVL.2006.37. ISBN 0-7695-2532-6. https://ieeexplore.ieee.org/document/1623980.