Beispiel #1
0
        public void zeitOfAlgorithmus(string path, String methode)
        {
            Console.WriteLine(methode);

            Algorithmus algorithmus = new Algorithmus();

            Graph graph = Parse.getGraphByFile(path);

            DateTime befor = System.DateTime.Now;

            if (methode == "Neighbor")
            {
                algorithmus.nearestNeighbor(graph);
            }
            else if (methode == "DoubleTree")
            {
                algorithmus.DoubleTree(graph);
            }
            else if (methode == "bruteforce")
            {
                algorithmus.bruteforce(graph);
            }
            else
            {
                algorithmus.branchUndBound(graph);
            }

            DateTime after = System.DateTime.Now;
            TimeSpan ts    = after.Subtract(befor);

            Console.WriteLine("\n\n{0}s", ts.TotalSeconds);
        }