Esempio n. 1
0
        public static void GetSalesman()
        {
            var graph  = Initializing.CreateGraph(@"./_Third.txt");
            var matrix = Initializing.CreateMatrix(@"./_Third.txt");

            BnB_matrix brunchAndBound = new BnB_matrix();

            var edges = brunchAndBound.BranchAndBound(matrix);

            System.Console.WriteLine("\n");
            ConsolePrint.HeaderPrint("Salesman problem");
            ConsolePrint.PrintGraph(graph);
            ConsolePrint.PrintPath(edges);
        }
Esempio n. 2
0
        public static void GetChinesePostman()
        {
            var graph = Initializing.CreateGraph(@"./_Second.txt");

            Graph newGraph = new Graph();

            if (!ChinesePostman.IsEvenDegree(graph.Nodes))
            {
                var oddNodes = OddFinder.FindOddNodes(graph.Nodes);
                newGraph = ChinesePostman.PairingOddVertices(graph, oddNodes);
            }
            var eulerianPath = ChinesePostman.FindEulerianPath(newGraph);

            System.Console.WriteLine("\n");
            ConsolePrint.HeaderPrint("Chinese postman problem");
            ConsolePrint.PrintGraph(graph);
            ConsolePrint.ShowAdditionalEdges(graph, newGraph);
            // ConsolePrint.PrintNodes(graph.Nodes, newGraph.Nodes);
            ConsolePrint.PrintPath(eulerianPath.ToArray());
        }