Exemplo n.º 1
0
        public static void runMeasures()
        {
            DynamicTSP     dynamic    = new DynamicTSP();
            TspBruteForce  brute      = new TspBruteForce();
            BranchAndBound branch     = new BranchAndBound();
            timeCounter    timemaster = new timeCounter(100);

            excel = new ExcelManager("pomiary");
            excel.createNewFile();
            for (int i = 2; i < 10; i++)
            {
                excel.changeCell(i, 3, timemaster.measureSolver(dynamic, i + 2).ToString()); //dynamic
                Console.WriteLine("Dynamic END" + i);
                excel.changeCell(i, 4, timemaster.measureSolver(branch, i + 2).ToString());  //branch
                Console.WriteLine("Branch&Bound done" + i);
                excel.changeCell(i, 2, timemaster.measureSolver(brute, i + 2).ToString());   //brute
                Console.WriteLine("BruteForce done" + i);
            }
            excel.close();
        }
Exemplo n.º 2
0
        public static void RunBranchBound()
        {
            isSolving   = true;
            path        = new List <int>();
            timeCounter = new Stopwatch();
            isSolving   = true;
            timeCounter.Start();
            BranchAndBound brancher = new BranchAndBound();

            brancher.SetVariables(_matrix);
            brancher.Solve();
            timeCounter.Stop();
            foreach (var element in brancher.finalPath)
            {
                path.Add(element);
            }



            cost      = brancher.max;
            isSolving = false;
        }