private void SearchRouteBttn_Click(object sender, EventArgs e) { if (!CanSearchRoute()) { MessageBox.Show(Locales.Strings.CantSearchRoute); return; } Graph = MatrixConverter.ConvertMatrixToGraph(Matrix); string pathTaken = Searcher.BFS(Graph.GetStartVertex(), Graph.GetDestinationVertices(), Graph); DisplayGraphAndBFS(pathTaken); }
private static void RunSingleSearch(PuzzleState initState, PuzzleState goalState) { Searcher searcher = new Searcher(initState, goalState); CostFunc cost = (state1, state2) => 1; List <Thread> searchThreads = new List <Thread>() { new Thread(() => Console.WriteLine(searcher.BFS().ToString())), new Thread(() => Console.WriteLine(searcher.DFS(6).ToString())), new Thread(() => Console.WriteLine(searcher.DFS(12).ToString())), new Thread(() => Console.WriteLine(searcher.DFS(18).ToString())), new Thread(() => Console.WriteLine(searcher.UCS().ToString())), new Thread(() => Console.WriteLine(searcher.GreedyBestFirstSearch(new ManhattanDistanceHeuristic()).ToString())), new Thread(() => Console.WriteLine(searcher.AStarSearch(new ManhattanDistanceHeuristic()).ToString())), new Thread(() => Console.WriteLine(searcher.GreedyBestFirstSearch(new ManhanttanDistanceWithLinearConflictHeuristic()).ToString())), new Thread(() => Console.WriteLine(searcher.AStarSearch(new ManhanttanDistanceWithLinearConflictHeuristic()).ToString())) }; searchThreads.ForEach(x => x.Start()); searchThreads.ForEach(x => x.Join()); }