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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Step 1 If <strong>the</strong> node is 1 or 0 return this node.<br />

Step 2 If <strong>the</strong> set is empty or <strong>the</strong> variable which labels this node is greater than <strong>the</strong><br />

maximum variable in <strong>the</strong> set return 1 (<strong>the</strong> reason <strong>for</strong> this is that all descendants<br />

<strong>of</strong> this node are necessarily labeled with a greater variable so <strong>the</strong>y must be all<br />

projected away).<br />

Step 3 If <strong>the</strong> variable by which this node is labeled is present in X call <strong>the</strong> algorithm<br />

recursively on <strong>the</strong> true and false successors: <strong>the</strong> result will be <strong>the</strong> ROBDD whose<br />

root is labeled by this variable and has <strong>the</strong> results <strong>of</strong> <strong>the</strong> two recursive calls as its<br />

true and false successor respectively.<br />

Step 4 O<strong>the</strong>rwise this node must be projected away. We call <strong>the</strong> algorithm recursively<br />

on <strong>the</strong> true and false successors: <strong>the</strong> result will be <strong>the</strong> disjunction <strong>of</strong> <strong>the</strong> results <strong>of</strong><br />

<strong>the</strong> two recursive calls, according to Equation 1.1.<br />

The algorithm project_threshold, which projects away all variables in a ROBDD<br />

that are greater than a given variable, is analogous. The pseudo-code <strong>for</strong> both algorithms<br />

is given in Algorithm 8 and Algorithm 9.<br />

Require: a ROBDD node n and a set <strong>of</strong> variables V<br />

function project_set(n, V )<br />

if is_leaf(n) <strong>the</strong>n<br />

return n<br />

else if max(V ) ≺ nvar or V = ∅ <strong>the</strong>n<br />

return 1<br />

else if nvar ∈ V <strong>the</strong>n<br />

return make_node nvar, project_set(ntrue, V ), project_set(nfalse, V ) <br />

else<br />

return or_ite project_set(ntrue, V ), project_set(nfalse, V ) <br />

Algorithm 8: The project_set function<br />

Require: a ROBDD node n and a threshold variable t<br />

function project_threshold(n, t)<br />

if is_leaf(n) <strong>the</strong>n<br />

return n<br />

else if t ≺ nvar <strong>the</strong>n<br />

return 1<br />

else<br />

return make_node nvar, project_threshold(ntrue, t), project_threshold(nfalse, t) <br />

Algorithm 9: The project_threshold function<br />

3.2 ROBDD algorithms 21

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

Saved successfully!

Ooh no, something went wrong!