1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| APPLY[T, H](op, u1, u2) # combine two ROBDDs? O(|u1||u2|) init(G)
function APP(u1, u2) # call from top to bottom, compute from bottom to top if G(u1, u2) != empty then return G(u1, u2) else if u1 in {0, 1} and u2 in {0, 1} then u <- op(u1, u2) else if var(u1) = var(u2) then u <- MK(var(u1), APP(low(u1), low(u2)), APP(high(u1), high(u2))) else if var(u1) < var(u2) then u <- MK(var(u1), APP(low(u1), u2), APP(high(u1), u2)) else # var(u1) > var(u2) u <- MK(var(u2), APP(u1, low(u2)), APP(u1, high(u2))) G(u1, u2) <- u return u end APP
return APP(u1, u2)
|