コード例 #1
0
ファイル: Kernel.cs プロジェクト: sorenjuul/bddsharp
        private static int VarListQuantification(ref BddPairList varList, int u, Op op)
        {
            if (quantiHash.ContainsKey(u))
            {
                return(quantiHash[u]);
            }
            int low, high;

            if (!IsTerminal(Low(u)))
            {
                low = VarListQuantification(ref varList, Low(u), op);
            }
            else
            {
                low = Low(u);
            }

            if (!IsTerminal(High(u)))
            {
                high = VarListQuantification(ref varList, High(u), op);
            }
            else
            {
                high = High(u);
            }

            int newU;

            if (varList.QuantificationContainsKey(Var(u)))
            {
                newU = Apply(op, low, high);
            }
            else
            {
                newU = Mk(Var(u), low, high);
            }

            quantiHash.Add(u, newU);
            return(newU);
        }
コード例 #2
0
ファイル: Kernel.cs プロジェクト: sorenjuul/bddsharp
        private static int AppEx(Op op, int u1, int u2, ref BddPairList varList)
        {
            int u;

            if (GAppEx.ContainsKey(u1, u2, op))
            {
                return(GAppEx[u1, u2, op]);
            }

            if (IsTerminal(u1) && IsTerminal(u2))
            {
                return(Lookup[(int)(byte)op, u1 * 2 + u2]);
            }
            else
            {
                switch (Var(u1).CompareTo(Var(u2)))
                {
                case 0:         //equals
                    u = Mk(Var(u1), AppEx(op, Low(u1), Low(u2), ref varList), AppEx(op, High(u1), High(u2), ref varList));
                    break;

                case -1:        //less than
                    u = Mk(Var(u1), AppEx(op, Low(u1), u2, ref varList), AppEx(op, High(u1), u2, ref varList));
                    break;

                default:        //greater than
                    u = Mk(Var(u2), AppEx(op, u1, Low(u2), ref varList), AppEx(op, u1, High(u2), ref varList));
                    break;
                }
            }
            if (varList.QuantificationContainsKey(Var(u)))
            {
                u = Apply(Op.DIS, Low(u), High(u));
            }
            GAppEx.Add(u1, u2, op, u);
            return(u);
        }