Ejemplo n.º 1
0
        /// <summary>
        /// Runs the comparison for a given folder.
        /// </summary>
        public static void ComparisonSuite(String graphsFolder, String resultLog, bool parallelTest, bool runLayout)
        {
            string dataFolder = Path.GetFileName(Path.GetDirectoryName(graphsFolder));
            string dateTime   = DateTime.Now.ToString("-yyyy.MM.dd-HH_mm");

            //Set the current directory.
            subFolderName = "TestSuite2-";
            Directory.CreateDirectory(subFolderName + dataFolder + dateTime);
            Directory.SetCurrentDirectory(subFolderName + dataFolder + dateTime);
            int numberCores = 1;

            if (parallelTest)
            {
                numberCores = Environment.ProcessorCount;
            }

            var testSuite = new OverlapRemovalTestSuite(resultLog);

            testSuite.overlapMethods = CollectionOverlapRemovalMethods();
            testSuite.layoutMethods  = CollectionInitialLayout(runLayout);


            string[] filePaths = Directory.GetFiles(graphsFolder, "*.dot");

            Parallel.ForEach(
                filePaths,
                new ParallelOptions {
                MaxDegreeOfParallelism = numberCores
            },
                testSuite.RunOverlapRemoval
                );

            testSuite.Finished();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Runs the comparison for a given folder.
        /// </summary>
        public static void ComparisonSuite(String graphsFolder, String resultLog, bool parallelTest, bool runLayout)
        {
            string dataFolder = Path.GetFileName(Path.GetDirectoryName(graphsFolder));
            string dateTime   = DateTime.Now.ToString("-yyyy.MM.dd-HH_mm");

            //Set the current directory.
            subFolderName = "TestSuite2-";
            Directory.CreateDirectory(subFolderName + dataFolder + dateTime);
            Directory.SetCurrentDirectory(subFolderName + dataFolder + dateTime);
            int numberCores = 1;

            if (parallelTest)
            {
                numberCores = Environment.ProcessorCount;
            }

            var testSuite = new OverlapRemovalTestSuite(resultLog);

            testSuite.overlapMethods = CollectionOverlapRemovalMethods();
            testSuite.layoutMethods  = CollectionInitialLayout(runLayout);


            string[] filePaths = Directory.GetFiles(graphsFolder, "*.dot");

            Console.WriteLine(@"total graphs  = {0} ", filePaths.Count());
            Parallel.ForEach(
                filePaths,
                new ParallelOptions {
                MaxDegreeOfParallelism = numberCores
            },
                graphFilename => testSuite.RunOverlapRemoval(graphFilename, runLayout)
                );

            int prismWins = 0;
            int gtreeWins = 0;

            foreach (var t in testSuite._errorDict)
            {
                if (t.Value.prismError < t.Value.gtreeError)
                {
                    prismWins++;
                }
                else if (t.Value.prismError > t.Value.gtreeError)
                {
                    gtreeWins++;
                }
            }
            Console.WriteLine(@"total graphs {2} prism wins {0} gtree wins {1}", prismWins, gtreeWins, filePaths.Length);
            testSuite.Finished();
        }