Exemplo n.º 1
0
        /// <summary>
        /// Create an exact solution using input data from the Console
        /// </summary>
        private static void RunExactConsole()
        {
            Node[]               inputAsNodes = IO.ReadInputAsNodes(CENTER_RESEMBLANCE_CAP, ARTICULATION_POINT_MINIMUM);
            RecursiveSplit       recSplit     = new RecursiveSplit(inputAsNodes);
            RecursiveTree <Node> recTree      = recSplit.GetBestTree();
            string               output       = recTree.ToString();

            Console.Write(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Runs either the exact version of RecursiveSplit. Does not use any form of local search
        /// </summary>
        /// <param name="fileName">The name of the file to be used as input (without extension)</param>
        private static void RunExact(string fileName)
        {
            Console.WriteLine($"Starting file {fileName}...");

            Node[]         inputAsNodes = IO.ReadInputAsNodes($"..\\..\\..\\..\\..\\Testcases\\{fileName}.gr", CENTER_RESEMBLANCE_CAP, ARTICULATION_POINT_MINIMUM);
            RecursiveSplit recSplit     = new RecursiveSplit(inputAsNodes);

            RecursiveTree <Node> recTree;

            recTree = recSplit.GetBestTree();
            string output = recTree.ToString();

            using (StreamWriter sw = new StreamWriter($"..\\..\\..\\..\\..\\Results\\{fileName}.tree", false))
            {
                sw.Write(output);
            }

            Console.WriteLine($"Tree found with depth {recTree.Depth}.");
            Console.WriteLine();
        }