Exemplo n.º 1
0
 bool IsSame(LingValue other)
 {
     return(other.Membership == sumMembership &&
            other.NumOfRules == numOfRules &&
            other.ValueName.ToLower() == valueName.ToLower() &&
            other.VariableName.ToLower() == variableName.ToLower());
 }
Exemplo n.º 2
0
        //darkness
        internal static List <LingValue> DarknessFuzzification(double darknessAnswer)
        {
            LingValue lowValue  = new LingValue("darkness", "low", LowDarknessFunction(darknessAnswer));
            LingValue highValue = new LingValue("darkness", "high", HidhDarknessFunction(darknessAnswer));

            return(new List <LingValue>(new[] { lowValue, highValue }));
        }
Exemplo n.º 3
0
        //background
        internal static List <LingValue> BackgroundFuzzification(double backgrouundAnswer)
        {
            LingValue largeBackground  = new LingValue("background", "large", LargeBacgroundFunction(backgrouundAnswer));
            LingValue normalBackground = new LingValue("background", "normal", NormalBacgroundFunction(backgrouundAnswer));

            return(new List <LingValue>(new[] { largeBackground, normalBackground }));
        }
Exemplo n.º 4
0
        //identity
        internal static List <LingValue> IdentityFuzzification(double mccAnswer, double threshold)
        {
            LingValue sameValue      = new LingValue("identity", "same", SameFunction(mccAnswer, threshold));
            LingValue differentValue = new LingValue("identity", "different", DifferentFunction(mccAnswer, threshold));

            return(new List <LingValue>(new[] { sameValue, differentValue }));
        }
Exemplo n.º 5
0
        public bool Evaluate(List <LingValue> currentValues)
        {
            double newMembership = 1;
            double currentMembership;

            foreach (Term term in terms)
            {
                if (!term.Evaluate(currentValues, out currentMembership))
                {
                    return(false);
                }
                newMembership = Math.Min(newMembership, currentMembership);
            }
            int index = answer.FindIndex(currentValues);

            if (index == -1)
            {
                LingValue newValue = new LingValue(answer.VariableName, answer.ValueName, newMembership * factor);
                currentValues.Add(newValue);
            }
            else
            {
                currentValues[index].AddMembership(newMembership * factor);
            }
            return(true);
        }
Exemplo n.º 6
0
        //LowQualityBlocksNfiq
        internal static List <LingValue> LowQualityBlocksNfiqFuzzification(double nfiqBlocksAnswer)
        {
            LingValue manyBlocks   = new LingValue("LowQualityBlocks".ToLower(), "many", ManyLowQualityBlocksFunction(nfiqBlocksAnswer));
            LingValue littleBlocks = new LingValue("LowQualityBlocks".ToLower(), "little", LittleLowQualityBlocksFunction(nfiqBlocksAnswer));

            return(new List <LingValue>(new[] { manyBlocks, littleBlocks }));
        }
Exemplo n.º 7
0
 bool IsSame(LingValue other)
 {
   return other.Membership == sumMembership
      && other.NumOfRules == numOfRules
      && other.ValueName.ToLower() == valueName.ToLower()
      && other.VariableName.ToLower() == variableName.ToLower();
 }
Exemplo n.º 8
0
    public bool Evaluate(List<LingValue> currentValues)
    {

      double newMembership = 1;
      double currentMembership;

      foreach (Term term in terms)
      {
        if (!term.Evaluate(currentValues, out currentMembership))
        {
          return false;
        }
        newMembership = Math.Min(newMembership, currentMembership);
      }
      int index = answer.FindIndex(currentValues);
      if (index == -1)
      {
        LingValue newValue = new LingValue(answer.VariableName, answer.ValueName, newMembership * factor);
        currentValues.Add(newValue);
      }
      else
      {
        currentValues[index].AddMembership(newMembership * factor);
      }
      return true;
    }
Exemplo n.º 9
0
        internal static List <LingValue> AverageQualityNfiqFuzzification(double nfiqQualityAnswer)
        {
            LingValue highQualityNfiq = new LingValue("QualityNfiq".ToLower(), "high", HighQualityNfiqFunction(nfiqQualityAnswer));
            //LingValue middleQualityNfiq = new LingValue("QualityNfiq","Middle",MiddleQualityNfiqFunction(nfiqQualityAnswer));
            LingValue lowQualityNfiq = new LingValue("QualityNfiq".ToLower(), "low", LowQualityNfiqFunction(nfiqQualityAnswer));

            return(new List <LingValue>(new[] { highQualityNfiq, lowQualityNfiq }));
        }
Exemplo n.º 10
0
        internal LingValue GetAnswer(Tuple <InputVector, InputVector, InputVector> input, double threshold)
        {
            List <LingValue> firstAnswer  = GetAnswersForOneFinger(input.Item1, threshold);
            List <LingValue> secondAnswer = GetAnswersForOneFinger(input.Item2, threshold);
            List <LingValue> thirdAnswer  = GetAnswersForOneFinger(input.Item3, threshold);

            List <LingValue> existingValuesAnswer = new List <LingValue>();

            foreach (LingValue item in firstAnswer)
            {
                if (item.VariableName == "fingerprintAnswer".ToLower())
                {
                    LingValue newVal = new LingValue("fingerprintAnswer1".ToLower(), item.ValueName, item.Membership);
                    existingValuesAnswer.Add(newVal);
                }
            }

            foreach (LingValue item in secondAnswer)
            {
                if (item.VariableName == "fingerprintAnswer".ToLower())
                {
                    LingValue newVal = new LingValue("fingerprintAnswer2".ToLower(), item.ValueName, item.Membership);
                    existingValuesAnswer.Add(newVal);
                }
            }

            foreach (LingValue item in thirdAnswer)
            {
                if (item.VariableName == "fingerprintAnswer".ToLower())
                {
                    LingValue newVal = new LingValue("fingerprintAnswer3".ToLower(), item.ValueName, item.Membership);
                    existingValuesAnswer.Add(newVal);
                }
            }

            var results = EvaluateFullAnswers(existingValuesAnswer);

            return(FindMaxLingValue(results));
        }
    internal LingValue GetAnswer(Tuple<InputVector, InputVector, InputVector> input, double threshold)
    {
      List<LingValue> firstAnswer = GetAnswersForOneFinger(input.Item1, threshold);
      List<LingValue> secondAnswer = GetAnswersForOneFinger(input.Item2, threshold);
      List<LingValue> thirdAnswer = GetAnswersForOneFinger(input.Item3, threshold);

      List<LingValue> existingValuesAnswer = new List<LingValue>();
      
      foreach (LingValue item in firstAnswer)
      {
        if (item.VariableName == "fingerprintAnswer".ToLower())
        {
          LingValue newVal = new LingValue("fingerprintAnswer1".ToLower(), item.ValueName, item.Membership);
          existingValuesAnswer.Add(newVal);
        }
      }

      foreach (LingValue item in secondAnswer)
      {
        if (item.VariableName == "fingerprintAnswer".ToLower())
        {
          LingValue newVal = new LingValue("fingerprintAnswer2".ToLower(), item.ValueName, item.Membership);
          existingValuesAnswer.Add(newVal);
        }
      }

      foreach (LingValue item in thirdAnswer)
      {
        if (item.VariableName == "fingerprintAnswer".ToLower())
        {
          LingValue newVal = new LingValue("fingerprintAnswer3".ToLower(), item.ValueName, item.Membership);
          existingValuesAnswer.Add(newVal);
        }
      }

      var results = EvaluateFullAnswers(existingValuesAnswer);

      return FindMaxLingValue(results);
    }
Exemplo n.º 12
0
 //background
 internal static List<LingValue> BackgroundFuzzification(double backgrouundAnswer)
 {
     LingValue largeBackground = new LingValue("background", "large", LargeBacgroundFunction(backgrouundAnswer));
     LingValue normalBackground = new LingValue("background", "normal", NormalBacgroundFunction(backgrouundAnswer));
   return new List<LingValue>(new[] { largeBackground, normalBackground });
 }
Exemplo n.º 13
0
 //darkness
 internal static List<LingValue> DarknessFuzzification(double darknessAnswer)
 {
   LingValue lowValue = new LingValue("darkness", "low", LowDarknessFunction(darknessAnswer));
   LingValue highValue = new LingValue("darkness", "high", HidhDarknessFunction(darknessAnswer));
   return new List<LingValue>(new[] { lowValue, highValue });
 }
Exemplo n.º 14
0
 internal static List<LingValue> AverageQualityNfiqFuzzification(double nfiqQualityAnswer)
 {
   LingValue highQualityNfiq = new LingValue("QualityNfiq".ToLower(), "high", HighQualityNfiqFunction(nfiqQualityAnswer));
   //LingValue middleQualityNfiq = new LingValue("QualityNfiq","Middle",MiddleQualityNfiqFunction(nfiqQualityAnswer));
   LingValue lowQualityNfiq = new LingValue("QualityNfiq".ToLower(), "low", LowQualityNfiqFunction(nfiqQualityAnswer));
   return new List<LingValue>(new[] { highQualityNfiq, lowQualityNfiq });
 }
Exemplo n.º 15
0
 //identity
 internal static List<LingValue> IdentityFuzzification(double mccAnswer, double threshold)
 {
   LingValue sameValue = new LingValue("identity", "same", SameFunction(mccAnswer, threshold));
   LingValue differentValue = new LingValue("identity", "different", DifferentFunction(mccAnswer, threshold));
   return new List<LingValue>(new[] { sameValue, differentValue });
 }
Exemplo n.º 16
0
 //LowQualityBlocksNfiq
 internal static List<LingValue> LowQualityBlocksNfiqFuzzification(double nfiqBlocksAnswer)
 {
   LingValue manyBlocks = new LingValue("LowQualityBlocks".ToLower(), "many", ManyLowQualityBlocksFunction(nfiqBlocksAnswer));
   LingValue littleBlocks = new LingValue("LowQualityBlocks".ToLower(), "little", LittleLowQualityBlocksFunction(nfiqBlocksAnswer));
   return new List<LingValue>(new[] { manyBlocks, littleBlocks });
 }