예제 #1
0
        public static void EnforceTest()
        {
            Kernel.Setup();
            Bdd result;
            Fdd fdd = new Fdd(6);

            result = FddKernel.EnforceMaxValue(fdd, 6);

            BddSerializer.Serialize(result, "TTest");
        }
예제 #2
0
        static void Main(string[] args)
        {
            /*
             * BDDHash ht = new BDDHash();
             * BddNode b = new BddNode(3, 1, 0);
             * BddNode b1 = new BddNode(2, 1, 1);
             * BddNode b2 = new BddNode(16, 0, 0);
             * int key = ht.GenerateKey(b);
             * int key1 = ht.GenerateKey(b1);
             * int key2 = ht.GenerateKey(b2);
             * Console.WriteLine(key.ToString());
             *
             * Console.WriteLine(ht.count.ToString()); // test count for Add
             *
             * ht.Add(key, b); // test Add
             * ht.Add(key1, b1); // test Add
             * ht.Add(key2, b2); // test Add
             *
             * Console.WriteLine(ht.count.ToString()); // test count for after Add
             * ht.Clear();
             * Console.WriteLine(ht.count.ToString()); // test for Clear()
             * */

            Bdd result = new Bdd(true);

            BDD.Setup();
            {
                Bdd a = new Bdd(1);
                Bdd b = new Bdd(2);
                Bdd c = new Bdd(3);
                Bdd d = new Bdd(4);
                Bdd e;

                e = BDD.Equal(a, b);
                Console.WriteLine(BDD.TCount().ToString());
                c = BDD.Equal(c, d);
                Console.WriteLine(BDD.TCount().ToString());
                result = BDD.And(e, c);
                result = BDD.Or(result, e);
            }
            Console.WriteLine(BDD.TCount().ToString());

            BddSerializer.Serialize(result, "foo");
        }
예제 #3
0
        public static void CheckRestrict()
        {
            Kernel.Setup();
            Bdd a = new Bdd(1);
            Bdd b = new Bdd(2);
            Bdd c = new Bdd(3);

            Bdd result = new Bdd(false);

            result = Kernel.Or(Kernel.Equal(a, b), c);

            string s1 = Kernel.AnySat(result);

            result = Kernel.Restrict(result, b.Var, true);

            string s2 = Kernel.AnySat(result);

            BddSerializer.Serialize(result, "foo");
        }
예제 #4
0
        public string Run()
        {
            Bdd[] c = new Bdd[1000];
            Bdd[] cp = new Bdd[1000];
            Bdd[] h = new Bdd[1000];
            Bdd[] hp = new Bdd[1000];
            Bdd[] t = new Bdd[1000];
            Bdd[] tp = new Bdd[1000];
            Bdd   I, T, R;

            Kernel.Setup();

            List <int> PreState  = new List <int>();
            List <int> PostState = new List <int>();

            for (int n = 1; n < N; n++)
            {
                PreState.Add(n);
                PostState.Add(n + 1);
            }


            for (int n = 0; n < N; n++)
            {
                c[n]  = new Bdd(n);
                cp[n] = new Bdd(n + 1);
                t[n]  = new Bdd(n + 2);
                tp[n] = new Bdd(n + 3);
                h[n]  = new Bdd(n + 4);
                hp[n] = new Bdd(n + 5);
            }

            I = InitialState(t, h, c);
            T = Transitions(t, tp, h, hp, c, cp);
            R = Verification.ReachableStates(I, T, PreState, PostState);
            BddSerializer.Serialize(R, "output");

            //Kernel.Done();
            return(Kernel.SatCount(R).ToString());
        }