Esempio n. 1
0
        private void ShuffleFringe()
        {
            int    n   = this.fringe.Count;
            Random rnd = new Random();

            while (n > 1)
            {
                int k = (rnd.Next(0, n) % n);
                n--;
                Clouse value = this.fringe[k];
                this.fringe[k] = this.fringe[n];
                this.fringe[n] = value;
            }
        }
Esempio n. 2
0
        /*
         * this is some test fot the algorithm relaying on the example from class
         * */
        public List <Clouse> build_example()
        {
            List <Clouse> formula = new List <Clouse>();
            Atomic        a       = new Atomic("ok", false);
            Atomic        a2      = new Atomic("uf", false);
            List <Atomic> l1      = new List <Atomic>();

            l1.Add(a);
            l1.Add(a2);
            Clouse c1 = new Clouse(l1, 0);

            c1.unknown = 2;
            c1.unknown_literals.Add(a);
            c1.unknown_literals.Add(a2);
            formula.Add(c1);
            /////

            Atomic        a3 = new Atomic("ok", false);
            Atomic        a4 = new Atomic("a", true);
            List <Atomic> l2 = new List <Atomic>();

            l2.Add(a3);
            l2.Add(a4);
            Clouse c2 = new Clouse(l2, 0);

            c2.unknown = 2;
            c2.unknown_literals.Add(a3);
            c2.unknown_literals.Add(a4);
            formula.Add(c2);

            /////

            Atomic        a5 = new Atomic("nco", true);
            Atomic        a6 = new Atomic("ia", false);
            List <Atomic> l3 = new List <Atomic>();

            l3.Add(a5);
            l3.Add(a6);
            Clouse c3 = new Clouse(l3, 0);

            c3.unknown = 2;
            c3.unknown_literals.Add(a5);
            c3.unknown_literals.Add(a6);
            formula.Add(c3);

            /////

            Atomic        a7 = new Atomic("a", false);
            Atomic        a8 = new Atomic("ia", false);
            List <Atomic> l4 = new List <Atomic>();

            l4.Add(a7);
            l4.Add(a8);
            Clouse c4 = new Clouse(l4, 0);

            c4.unknown = 2;
            c4.unknown_literals.Add(a7);
            c4.unknown_literals.Add(a8);
            formula.Add(c4);
            /////



            Atomic        a11 = new Atomic("ok", false);
            Atomic        a12 = new Atomic("rf", false);
            List <Atomic> l6  = new List <Atomic>();

            l6.Add(a11);
            l6.Add(a12);
            Clouse c6 = new Clouse(l6, 0);

            c6.unknown = 2;
            c6.unknown_literals.Add(a11);
            c6.unknown_literals.Add(a12);
            formula.Add(c6);

            /////

            Atomic        a13 = new Atomic("ia", true);
            Atomic        a14 = new Atomic("rf", false);
            List <Atomic> l7  = new List <Atomic>();

            l7.Add(a13);
            l7.Add(a14);
            Clouse c7 = new Clouse(l7, 0);

            c7.unknown = 2;
            c7.unknown_literals.Add(a13);
            c7.unknown_literals.Add(a14);
            formula.Add(c7);



            /////

            Atomic        a15 = new Atomic("nci", false);
            Atomic        a16 = new Atomic("a", false);
            Atomic        a17 = new Atomic("nco", true);
            List <Atomic> l8  = new List <Atomic>();

            l8.Add(a15);
            l8.Add(a16);
            l8.Add(a17);
            Clouse c8 = new Clouse(l8, 0);

            c8.unknown = 3;
            c8.unknown_literals.Add(a15);
            c8.unknown_literals.Add(a16);
            c8.unknown_literals.Add(a17);
            formula.Add(c8);

            /////

            Atomic        a18 = new Atomic("uf", false);
            Atomic        a19 = new Atomic("rf", false);
            List <Atomic> l9  = new List <Atomic>();

            l9.Add(a18);
            l9.Add(a19);
            Clouse c9 = new Clouse(l9, 0);

            c9.unknown = 2;
            c9.unknown_literals.Add(a18);
            c9.unknown_literals.Add(a19);

            formula.Add(c7);

            /////

            Atomic        a20 = new Atomic("rf", true);
            List <Atomic> l10 = new List <Atomic>();

            l10.Add(a20);
            Clouse c10 = new Clouse(l10, 0);

            c10.unknown = 1;
            c10.unknown_literals.Add(a20);

            formula.Add(c10);

            /////

            Atomic        a21 = new Atomic("ok", true);
            List <Atomic> l11 = new List <Atomic>();

            l11.Add(a21);
            Clouse c11 = new Clouse(l11, 0);

            c11.unknown = 1;
            c11.unknown_literals.Add(a21);

            formula.Add(c11);

            return(formula);
        }