public static void GetSalesman() { var graph = Initializing.CreateGraph(@"./salesman.txt"); var matrix = Initializing.CreateMatrix(@"./salesman.txt"); System.Console.WriteLine("\n"); MyPrinter.HeaderPrint("Salesman problem\n"); MyPrinter.PrintMatrix(matrix, "Matrix instance\n"); BranchAndBoundSolver brunchAndBound = new BranchAndBoundSolver(); var edges = brunchAndBound.BranchAndBound(matrix); // MyPrinter.PrintGraph(graph, "Graph instance"); MyPrinter.PrintPath(edges); }
public static void GetPostman() { var graph = Initializing.CreateGraph(@"./postman.txt"); var matrix = Initializing.CreateMatrix(@"./postman.txt"); Graph newGraph = new Graph(); if (!Postman.IsEvenDegree(graph.Nodes)) { var oddNodes = OddFinder.FindOddNodes(graph.Nodes); newGraph = Postman.PairingOddVertices(graph, oddNodes); } var eulerianPath = Postman.FindEulerianPath(newGraph); System.Console.WriteLine("\n"); MyPrinter.HeaderPrint("Chinese postman problem"); MyPrinter.PrintMatrix(matrix, "Matrix instance\n"); // MyPrinter.PrintGraph(graph, "Graph instance: Edges"); MyPrinter.ShowAdditionalEdges(graph, newGraph); MyPrinter.PrintNodes(graph.Nodes, newGraph.Nodes); MyPrinter.PrintPath(eulerianPath.ToArray()); }