public static void Ref(int u) { if (!Kernel.IsIthNode(u) && !Kernel.IsTerminal(u)) { if (Visitor.ContainsKey(u)) { AddCount(u); } else { if (!Kernel.IsTerminal(Kernel.Low(u))) { Ref(Kernel.Low(u)); } AddCount(u); if (!Kernel.IsTerminal(Kernel.High(u))) { Ref(Kernel.High(u)); } if (!Visitor.ContainsKey(u)) { Visitor.Add(u, 1); } } } }
public static void GarbageCollect(ref BDDHash H, ref BddTable T) { foreach (KeyValuePair <int, int> root in dic) { int u = root.Key; Mark(u); } int size = H.Size; H = new BDDHash(size * 2); Kernel.G.Clear(); BddTable newT = new BddTable(size * 2); foreach (BddTableEntry entry in T) { if (entry.node.mark == true) { BddNode n = entry.node; if (!Kernel.IsIthNode(entry.u) && !Kernel.IsTerminal(entry.u)) { n.mark = false; } newT.Add(entry.u, n); H.Add(entry.node.var, entry.node.low, entry.node.high, entry.u); } } T = newT; }
static void Mark(int u) { if (Kernel.T[u].mark != true) { if (!Kernel.IsTerminal(Kernel.Low(u))) { Mark(Kernel.Low(u)); } AddMark(u); if (!Kernel.IsTerminal(Kernel.High(u))) { Mark(Kernel.High(u)); } } }
public static void UnRef(int u) { if (!Kernel.IsIthNode(u) && !Kernel.IsTerminal(u)) { if (Visitor2.ContainsKey(u)) { DelCount(u); if (Kernel.T[u].refcount == 0) { DelNode(u); } } else { if (!Kernel.IsTerminal(Kernel.Low(u))) { UnRef(Kernel.Low(u)); } DelCount(u); if (!Kernel.IsTerminal(Kernel.High(u))) { UnRef(Kernel.High(u)); } if (Kernel.T[u].refcount == 0) { DelNode(u); } if (!Visitor2.ContainsKey(u)) { Visitor2.Add(u, 1); } } } }
public bool IsTerminal() { return(Kernel.IsTerminal(U)); }