Пример #1
0
        /////////////////////////////////////////////////////////////////////////////////////////////
        // These additional solver methods will be implemented as part of the group project.
        ////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// finds the greedy tour starting from each city and keeps the best (valid) one
        /// </summary>
        /// <returns>results array for GUI that contains three ints: cost of solution, time spent to find solution, number of solutions found during search (not counting initial BSSF estimate)</returns>
        public string[] greedySolveProblem()
        {
            string[] results = new string[3];

            GreedySolver greedy = new GreedySolver(Cities, bssf, results);

            bssf = greedy.Solve();

            return(results);
        }
Пример #2
0
        /// <summary>
        /// performs a Branch and Bound search of the state space of partial tours
        /// stops when time limit expires and uses BSSF as solution
        /// </summary>
        /// <returns>results array for GUI that contains three ints: cost of solution, time spent to find solution, number of solutions found during search (not counting initial BSSF estimate)</returns>
        public string[] bBSolveProblem()
        {
            string[] results = new string[3];

            //Find a smart starting bssf
            GreedySolver greedy = new GreedySolver(Cities, bssf, results);

            bssf = greedy.Solve();

            BranchAndBoundSolver brancher = new BranchAndBoundSolver(Cities, bssf, results, time_limit);

            bssf = brancher.Solve();

            return(results);
        }