static void Main(string[] args) { Dictionary <int, Node> graph = Program.loadGraphFromFile(args[0]); // Wybierz strategiÄ™ przeszukiwania BaseSearchStrategy bss; bss = new DFS(); if (args[1] == "BFS") { Console.WriteLine("Setting BFS"); bss = new BFS(); } if (args[1] == "AStar") { Console.WriteLine("Setting AStar"); bss = new AStar(); } if (args[1] == "B&B") { Console.WriteLine("Setting B&B"); bss = new BranchAndBound(); } List <Node> way = bss.findAWay(graph, Int32.Parse(args[2]), Int32.Parse(args[3])); Bitmap drawing = Graf_Finder.Drawing.draw(graph, way); drawing.Save("output.bmp"); }
//metoda znajdujaca trase public override List <Node> findAWay(Dictionary <int, Node> graph, int startNode, int endNode) { //podstaw pola tego obiektu this.graph = graph; this.endNode = endNode; this.startNode = startNode; //znajdz heurystyka najlepsza trase a potem wykonaj algorytm List <Node> path = new DFS().findAWay(graph, startNode, endNode); return(this.doTheAlgorithm(path)); }