예제 #1
0
        private void TestParrallelDependencyOnDataset(string SourcePath, string ResultPath)
        {
            DependencyCalculator cal = new DependencyCalculator();

            cal.LoadData(SourcePath);

            double[][] result = LoadResultMatrix(ResultPath);

            List <Action <int> > Methods = new List <Action <int> >();

            Methods.Add(cal.ParallelNativeForTransformation);
            Methods.Add(cal.ParralelTaskTransformation);
            Methods.Add(cal.ParralelOwnForTransformation);

            int size = result.Length;

            foreach (Action <int> parallelMethod in Methods)
            {
                parallelMethod(0);
                var depencencyMatrix = cal.getDependencyMatrix();
                for (int i = 0; i < size; ++i)
                {
                    for (int j = 0; j < size; ++j)
                    {
                        Assert.Equal(result[i][j], depencencyMatrix[i][j], PercisionDecimalPlaces);
                    }
                }
            }
        }
예제 #2
0
        public void TestDependencyMatrixResult()
        {
            _calculator.ParallelNaiveThreadTransformation();
            var depencencyMatrix = _calculator.getDependencyMatrix();

            Assert.Equal(1, depencencyMatrix[_calculator.GetRealId(1)][_calculator.GetRealId(4)], PercisionDecimalPlaces);
            Assert.Equal(0.4, depencencyMatrix[_calculator.GetRealId(7)][_calculator.GetRealId(4)], PercisionDecimalPlaces);
            Assert.Equal(0.75, depencencyMatrix[_calculator.GetRealId(8)][_calculator.GetRealId(7)], PercisionDecimalPlaces);
        }
예제 #3
0
        private double[][] LoadResultMatrix(string path)
        {
            string[]   lines = File.ReadAllLines(path);
            double[][] DependencyMatrix;

            DependencyCalculator ResultLoader = new DependencyCalculator();

            ResultLoader.LoadDependencyMatrix(path);
            DependencyMatrix = ResultLoader.getDependencyMatrix();
            return(DependencyMatrix);
        }