예제 #1
0
        public string Run(bool fake1, bool fake2, bool fake3)
        {
            //this.Cursor = Cursors.WaitCursor;
            DateTime startSetup = DateTime.Now;

            Kernel.Setup();
            DateTime finishSetup = DateTime.Now;
            TimeSpan timeSetup   = finishSetup - startSetup;

            DateTime start = DateTime.Now;

            SetupQueenProblem();
            DateTime finish = DateTime.Now;

            TimeSpan time = finish - start;

            string answer = "The time to calulate this problem: " + time + " Setup: " + timeSetup +
                            Environment.NewLine +
                            "There are " + Kernel.SatCountVarSet(queens) + " solutions." +
                            Environment.NewLine +
                            "Nodes in T are: " + Kernel.NodeCount();

            queens.Dispose();
            X = new Bdd[N, N];

            return(answer);
        }
예제 #2
0
        public void DisposeTest()
        {
            bool constant = false;

            Bdd target1 = new Bdd(constant);
            Bdd target2 = new Bdd(false);

            target1.Dispose();
            //Assert.AreEqual(target2, target1);


            Assert.Inconclusive("Not possible to implement good test /Soren");
        }
예제 #3
0
        public Bdd execute()
        {
            Bdd b      = body.execute();
            Bdd result = new Bdd(false);

            foreach (Var v in vars)
            {
                //Bdd b2 = v.execute();
                //result = BDD.And(BDD.Restrict(b.Var, b2.Var, true), BDD.Restrict(b.Var, b2.Var, false));
                result = BDD.Or(result, BDD.ForAll(v.execute().Var, b));
            }
            b.Dispose();
            return(result);
        }
예제 #4
0
        public Bdd execute()
        {
            // Calls specific methods from Kernel
            Bdd l      = left.execute();
            Bdd r      = right.execute();
            Bdd result = new Bdd(false);

            switch (op)
            {
            case Kind.DIS:
                result = BDD.Or(l, r);
                break;

            case Kind.CON:
                result = BDD.And(l, r);
                break;

            case Kind.BIMP:
                result = BDD.Equal(l, r);
                break;

            case Kind.NAND:
                result = BDD.Nand(l, r);
                break;

            case Kind.XOR:
                result = BDD.Xor(l, r);
                break;

            case Kind.NOR:
                result = BDD.Nor(l, r);
                break;

            case Kind.NOT:
                result = BDD.Not(r);
                break;
            }
            l.Dispose();                //forced garbage collection
            r.Dispose();

            return(result);
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            DateTime startSetup = DateTime.Now;

            Kernel.Setup();
            DateTime finishSetup = DateTime.Now;
            TimeSpan timeSetup   = finishSetup - startSetup;

            try
            {
                N = int.Parse(textBox1.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Input must be a integer");
                return;
            }
            DateTime start = DateTime.Now;

            SetupQueenProblem();
            DateTime finish = DateTime.Now;

            TimeSpan time = finish - start;

            textBox2.Text = "The time to calulate this problem: " + time + " Setup: " + timeSetup +
                            Environment.NewLine +
                            "There are " + Kernel.SatCount(queens) + " solutions." +
                            Environment.NewLine +
                            "Nodes in T are: " + Kernel.TCount();
            queens.Dispose();
            X = new Bdd[N, N];
            //Kernel.Done();
            //BddSerializer.Serialize(queens, "Queens");
            this.Cursor = Cursors.Arrow;
        }