/// <summary> /// Implicate rule results /// </summary> /// <param name="conditions">Rule conditions</param> /// <returns>Implicated conclusion</returns> public Dictionary <MamdaniFuzzyRule, IMembershipFunction> Implicate(Dictionary <MamdaniFuzzyRule, double> conditions) { Dictionary <MamdaniFuzzyRule, IMembershipFunction> conclusions = new Dictionary <MamdaniFuzzyRule, IMembershipFunction>(); foreach (MamdaniFuzzyRule rule in conditions.Keys) { MfCompositionType compType; switch (_implMethod) { case ImplicationMethod.Min: compType = MfCompositionType.Min; break; case ImplicationMethod.Production: compType = MfCompositionType.Prod; break; default: throw new Exception("Internal error."); } CompositeMembershipFunction resultMf = new CompositeMembershipFunction( compType, new ConstantMembershipFunction(conditions[rule]), ((FuzzyTerm)rule.Conclusion.Term).MembershipFunction); conclusions.Add(rule, resultMf); } return(conclusions); }
/// <summary> /// Implicate rule results /// </summary> /// <param name="conditions">Rule conditions</param> /// <returns>Implicated conclusion</returns> public Dictionary<MamdaniFuzzyRule, IMembershipFunction> Implicate(Dictionary<MamdaniFuzzyRule, double> conditions) { Dictionary<MamdaniFuzzyRule, IMembershipFunction> conclusions = new Dictionary<MamdaniFuzzyRule, IMembershipFunction>(); foreach (MamdaniFuzzyRule rule in conditions.Keys) { MfCompositionType compType; switch (_implMethod) { case ImplicationMethod.Min: compType = MfCompositionType.Min; break; case ImplicationMethod.Production: compType = MfCompositionType.Prod; break; default: throw new Exception("Internal error."); } CompositeMembershipFunction resultMf = new CompositeMembershipFunction( compType, new ConstantMembershipFunction(conditions[rule]), ((FuzzyTerm)rule.Conclusion.Term).MembershipFunction); conclusions.Add(rule, resultMf); } return conclusions; }