27.09.2013 Views

a modern C++ library for the manipulation of Boolean functions

a modern C++ library for the manipulation of Boolean functions

a modern C++ library for the manipulation of Boolean functions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

computed normally and an hash entry corresponding to <strong>the</strong> per<strong>for</strong>med computation is<br />

added. Since we per<strong>for</strong>m at most one recursive call <strong>for</strong> each pair <strong>of</strong> nodes and provided<br />

that our implementation <strong>of</strong> hash tables is good enough to bring <strong>the</strong> average cost <strong>of</strong> each<br />

recursive valuation to a constant value, <strong>the</strong> worst case complexity <strong>of</strong> <strong>the</strong> algorithm is in<br />

<strong>the</strong> order <strong>of</strong> nm, where n and m are <strong>the</strong> number <strong>of</strong> nodes in <strong>the</strong> first and <strong>the</strong> second<br />

ROBDD respectively.<br />

The implementation <strong>of</strong> operators with more than two arguments can be easily extended<br />

from this one.<br />

2.3.2 Implementation <strong>of</strong> <strong>the</strong> restriction operation<br />

Given a ROBDD representing <strong>the</strong> <strong>Boolean</strong> function f, v ∈ Vars and b ∈ {0, 1}, we can<br />

compute f[b/x] with a recursive procedure starting from <strong>the</strong> root <strong>of</strong> <strong>the</strong> ROBDD: each<br />

recursive call considers one node <strong>of</strong> <strong>the</strong> argument and returns one node <strong>of</strong> <strong>the</strong> resulting<br />

ROBDD. The base case is when <strong>the</strong> considered node is labeled with v: here we must<br />

simply return its true successor if b = 1 or its false successor if b = 0. For <strong>the</strong> recursive<br />

case we simply make recursive calls on both successors. The reduction <strong>of</strong> <strong>the</strong> result and<br />

<strong>the</strong> avoidance <strong>of</strong> multiple recursive calls can be guaranteed by using <strong>the</strong> usual techniques,<br />

with <strong>the</strong> obvious exception that <strong>the</strong> keys <strong>of</strong> <strong>the</strong> hash table that is used to avoid multiple<br />

recursive calls are composed by a single pointer.<br />

The techniques described in this chapter can be used to implement most operations on<br />

<strong>Boolean</strong> <strong>functions</strong>, although CORAL utilizes a few o<strong>the</strong>r tweaks which will be presented<br />

in <strong>the</strong> next two chapters.<br />

2.3 Operations on ROBDDs 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!