Beispiel #1
0
        public PairwiseComparisonMatrix(double[,] matrix, IWeightsResolutionStrategy weightsResolutionStrategy, IReproachResolutionStrategy reproachResolutionStrategy)
            : base(matrix)
        {
            _weightsResolutionStrategy  = weightsResolutionStrategy;
            _reproachResolutionStrategy = reproachResolutionStrategy;

            if (_weightsResolutionStrategy != null)
            {
                _weights          = new Lazy <double[]>(() => _weightsResolutionStrategy.GetWeights(this));
                _consistencyIndex = new Lazy <double>(() => _weightsResolutionStrategy.GetConsistencyIndex(this));
            }
        }
        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);
        }