Ejemplo n.º 1
0
        private void ShowBtn_Click(object sender, EventArgs e)
        {
            if (A == null)
            {
                return;
            }
            SolutionForm sf = new SolutionForm(A, new Solvers.NPuzzleBench.NPuzzle(N), start, goal);

            sf.Show();
        }
Ejemplo n.º 2
0
        private void BeginBtn_Click(object sender, EventArgs e)
        {
            InSearchState();



            if (radioButton1.Checked)
            {
                A     = new AWA(sucgen, hcal, 1);
                start = new ANode();
                goal  = new ANode();
            }
            else
            if (radioButton2.Checked)
            {
                A     = new Astar(sucgen, hcal);
                start = new ANode();
                goal  = new ANode();
            }
            else
            if (radioButton3.Checked)
            {
                A     = new AWinA(sucgen, hcal);
                start = new ANode();
                goal  = new ANode();
            }
            else
            {
                A     = new UCT(uctSucGen, 2, 30);
                start = new UCTNode();
                goal  = new UCTNode();
            }


            if (!SetParameters(A))
            {
                InitState();
                return;
            }


            start.Parent       = null;
            start.State        = GetStartState();
            start.UsedOperator = new DefaultOperator("init");

            goal.Parent       = null;
            goal.State        = new NPuzzleState(goalTiles);
            goal.UsedOperator = new DefaultOperator("init");



            A.InitStates(start, goal);



            exeThread = new Thread(() => A.Execute());

            exeThread.Start();


            while (exeThread.IsAlive)
            {
                Application.DoEvents();
            }

            StoppedState();

            IPolicy policy = A.getPolicy();

            SolutionForm sf = new SolutionForm(A, new Solvers.NPuzzleBench.NPuzzle(N), start, goal);

            sf.Show();
        }