예제 #1
0
        private double CalculateSuperiorityIdentifier(
            AlternativeBase lhs,
            AlternativeBase rhs)
        {
            double result = 0;

            for (int i = 0; i < _alternatives.Criterias.Count; ++i)
            {
                var criteria  = _alternatives.Criterias[i];
                var lhs_value = lhs.Values[i].Value;
                var rhs_value = rhs.Values[i].Value;
                if (criteria is IQualitativeCriteria)
                {
                    if (lhs_value >= rhs_value)
                    {
                        result += _configuration.CriteriaRanks[i];
                    }
                }
                else
                {
                    if (criteria.CriteriaDirection == CriteriaDirectionType.Maximization &&
                        lhs_value >= rhs_value)
                    {
                        result += _configuration.CriteriaRanks[i];
                    }
                    if (criteria.CriteriaDirection == CriteriaDirectionType.Minimization &&
                        lhs_value <= rhs_value)
                    {
                        result += _configuration.CriteriaRanks[i];
                    }
                }
            }

            return(result);
        }
예제 #2
0
        double PreferenceIndex(AlternativeBase lhs, AlternativeBase rhs)
        {
            double result = 0;

            for (int i = 0; i < lhs.Values.Count; ++i)
            {
                if (_alternatives.Criterias[i] is CriteriaBase)
                {
                    result +=
                        _configuration.PreferenceFunctions[i].GetValue(
                            _alternatives.Criterias[i].CriteriaDirection == CriteriaDirectionType.Maximization ? lhs.Values[i].Value - rhs.Values[i].Value : rhs.Values[i].Value - lhs.Values[i].Value
                            ) * _configuration.CriteriaRanks[i];
                }
                else
                {
                    result += _configuration.PreferenceFunctions[i].GetValue(lhs.Values[i].Value - rhs.Values[i].Value) * _configuration.CriteriaRanks[i];
                }
            }

            return(result);
        }