예제 #1
0
        private int varId; // Unique Id of next variable

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Creaes a Fuzzy Rule Base
        /// </summary>
        /// <param name="vsName">Name of the Rule Base</param>
        public FuzzyRuleBase(string vsName)
        {
            mdAlphaCut = Constants.FuzzyAlphaCutDefault;
            meCorrelationMethod = EnumFuzzyCorrelationMethod.Product;
            meDefuzzifyMethod = EnumFuzzyDefuzzifyMethod.Centroid;
            meInferenceMethod = EnumFuzzyInferenceMethod.Add;
            varId = Constants.FuzzyVarIdInitial;
            moVariableList = new Dictionary<string, FuzzyRuleVariable>();
            ruleId = Constants.FuzzyRuleIdInitial;
            moRuleList = new List<FuzzyRule>(10);
            moCndRuleList = new List<FuzzyRule>(10);
            moUncRuleList = new List<FuzzyRule>(10);
            moFbInitial = new System.Collections.BitArray(Constants.FUZZY_MAXVALUES);
            msName = vsName;
        }
예제 #2
0
        /// <summary>
        /// Clear the RuleBase
        /// </summary>
        public void Clear()
        {
            // Ruleset name
            msName = "";

            // Ruleset options
            mdAlphaCut = Constants.FuzzyAlphaCutDefault;
            meCorrelationMethod = EnumFuzzyCorrelationMethod.Product;
            meDefuzzifyMethod = EnumFuzzyDefuzzifyMethod.Centroid;
            meInferenceMethod = EnumFuzzyInferenceMethod.Add;

            // Lists of variables
            varId = Constants.FuzzyVarIdInitial;
            moVariableList.Clear();

            // Lists of rules
            ruleId = Constants.FuzzyRuleIdInitial;
            moRuleList.Clear();
            moCndRuleList.Clear();
            moUncRuleList.Clear();
            List<FuzzyRule> temp_fuzzylist;

            // Fact Base
            moFbInitial = new System.Collections.BitArray(Constants.FUZZY_MAXVALUES);
        }
예제 #3
0
        /// <summary> 
        /// Correlates the working set with the given input set using the given
        /// correlation method and truth value.
        /// </summary>
        /// <param name="inputSet">the FuzzySet object that contains the fuzzy set to be
        /// correlated with</param>
        /// <param name="corrMethod">the integer that represents the correlation method</param>
        /// <param name="truthValue">the double truth value</param>
        internal virtual void CorrelateWith(FuzzySet inputSet, EnumFuzzyCorrelationMethod corrMethod, double truthValue)
        {
            switch (corrMethod)
            {
                case EnumFuzzyCorrelationMethod.Minimise:
                    for (int i = 0; i < Constants.FUZZY_MAXVALUES; ++i)
                    {
                        if (truthValue <= inputSet.GetTruthValue(i))
                        {
                            mdTruthVector[i] = truthValue;
                        }
                        else
                        {
                            mdTruthVector[i] = inputSet.GetTruthValue(i);
                        }
                    }
                    break;

                case EnumFuzzyCorrelationMethod.Product:
                    for (int i = 0; i < Constants.FUZZY_MAXVALUES; ++i)
                    {
                        mdTruthVector[i] = (inputSet.GetTruthValue(i) * truthValue);
                    }
                    break;
            }
        }