/* * static void Main() * { * runTests(); * } */ static void runTests() { List <TSPInput> inputs = new List <TSPInput>(); for (int i = 5; i < 10; i++) { for (int j = 0; j < 10; j++) { inputs.Add(TSPGenerator.generateUniform(i)); } } TSPPreprocessor p = new TSPPreprocessor(); TreeEvaluator e = new TreeEvaluator(); Console.WriteLine("Number\tsize\tnormal\tbest\ttime (sec)"); for (int i = 0; i < inputs.Count; i++) { Console.Write(i + "\t" + inputs[i].nodesCount + "\t"); TreeNode root = TreeSolver.buildTree(inputs[i]); Console.Write(e.eval(root) + "\t"); DateTime start = DateTime.Now; p.findBestPermutation(inputs[i]); DateTime end = DateTime.Now; Console.WriteLine(p.bestFitness + "\t" + (end - start).TotalSeconds); } }