Beispiel #1
0
        public Reproach FindReproach(PairwiseComparisonMatrix matrix)
        {
            Matrix <double> T     = matrix.EmpiricalMatrix();
            Matrix <double> delta = matrix.DeltaMatrix();

            double sigma = Math.Pow(delta.Variance(), 0.5);
            double a     = delta.Mean();

            var reproach = (from i in Enumerable.Range(0, matrix.Size)
                            from j in Enumerable.Range(0, matrix.Size)
                            select new
            {
                I = i,
                J = j,
                L = delta[i, j] > a + sigma
                        ? Math.Abs(delta[i, j] - a - sigma)
                        : delta[i, j] < a - sigma ? Math.Abs(delta[i, j] - a + sigma) : 0
            })
                           .OrderByDescending(e => e.L)
                           .FirstOrDefault();

            if (reproach != null)
            {
                return(new Reproach(reproach.I, reproach.J));
            }

            return(null);
        }
        public Reproach FindReproach(PairwiseComparisonMatrix matrix)
        {
            int[] ciArray = (from i in Enumerable.Range(0, matrix.Size)
                             select new
            {
                Index = i,
                CI = _weightsResolutionStrategy.GetConsistencyIndex(matrix.TruncatedMatrix(i))
            })
                            .OrderBy(e => e.CI)
                            .Select(e => e.Index)
                            .Take(2)
                            .ToArray();

            if (ciArray.Length == 2)
            {
                return(new Reproach(ciArray[0], ciArray[1]));
            }

            return(null);
        }
Beispiel #3
0
        public Reproach FindReproach(PairwiseComparisonMatrix matrix)
        {
            double[] tempVector;
            double[] rowCovariance    = new double[matrix.Size];
            double[] columnCovariance = new double[matrix.Size];

            for (int i = 0; i < matrix.Size; i++)
            {
                tempVector = new double[matrix.Size];

                for (int j = 0; j < matrix.Size; j++)
                {
                    if (i != j)
                    {
                        tempVector[j] = matrix.MatrixRow(i).Cov(matrix.MatrixRow(j));
                    }
                }

                rowCovariance[i] = tempVector.Mean() * matrix.Size / (matrix.Size - 1);
            }

            for (int i = 0; i < matrix.Size; i++)
            {
                tempVector = new double[matrix.Size];

                for (int j = 0; j < matrix.Size; j++)
                {
                    if (i != j)
                    {
                        tempVector[j] = matrix.MatrixColumn(i).Cov(matrix.MatrixColumn(j));
                    }
                }

                columnCovariance[i] = tempVector.Mean() * matrix.Size / (matrix.Size - 1);
            }

            return(new Reproach(Array.IndexOf(rowCovariance, rowCovariance.Min()),
                                Array.IndexOf(columnCovariance, columnCovariance.Min())));
        }