internal WorkingFuzzySet moValFzyTmp; // Fuzzy working space to hold temp copies

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new Continuous Variable
        /// </summary>
        /// <param name="fuzzyBase">FuzzyBase</param>
        /// <param name="name">Name</param>
        /// <param name="discourseLo">Low</param>
        /// <param name="discourseHi">High</param>
        public ContinuousFuzzyRuleVariable(FuzzyRuleBase fuzzyBase, string name, double discourseLo, double discourseHi)
            : base(EnumFuzzyDataType.ContinuousVariable, fuzzyBase, name)
        {
            mdDiscourseLo = discourseLo;
            mdDiscourseHi = discourseHi;
            moSetList = new Dictionary<string, FuzzySet>();
            bValKnown = false;
            mdValCrisp = 0.0;
            moValFzy = new WorkingFuzzySet(this, name + " Fuzzy Solution Space", moRuleBase.AlphaCut, discourseLo, discourseHi);
            moValFzyTmp = new WorkingFuzzySet(this, name + " Fuzzy Work Space", moRuleBase.AlphaCut, discourseLo, discourseHi);
        }
Пример #2
0
        /// <summary> 
        /// Implicates the current working set to the given fuzzy set using the
        /// given infer method.
        /// </summary>
        /// <param name="inputSet">the WorkingFuzzySet object to implicate to</param>
        /// <param name="inferMethod">the integer that represents the infer method</param>
        internal virtual void ImplicateTo(WorkingFuzzySet inputSet, EnumFuzzyInferenceMethod inferMethod)
        {
            switch (inferMethod)
            {
                case EnumFuzzyInferenceMethod.Add:
                    for (int i = 0; i < Constants.FUZZY_MAXVALUES; ++i)
                    {
                        double sum = mdTruthVector[i] + inputSet.GetTruthValue(i);

                        if (sum < 1.0)
                        {
                            mdTruthVector[i] = sum;
                        }
                        else
                        {
                            mdTruthVector[i] = 1.0;
                        }
                    }
                    break;

                case EnumFuzzyInferenceMethod.MinMax:
                    for (int i = 0; i < Constants.FUZZY_MAXVALUES; ++i)
                    {
                        if (mdTruthVector[i] < inputSet.GetTruthValue(i))
                        {
                            mdTruthVector[i] = inputSet.GetTruthValue(i);
                        }
                    }
                    break;
            }
        }