Beispiel #1
0
        public void Fire(List <Rule> rules)
        {
            Dictionary <string, List <double> > degrees = new Dictionary <string, List <double> >();

            for (int i = 0; i < mValues.Count; ++i)
            {
                degrees[mValues[i]] = new List <double>();
            }

            for (int i = 0; i < rules.Count; ++i)
            {
                Rule   rule       = rules[i];
                Clause consequent = rule.Consequent;
                if (consequent.Variable == this)
                {
                    double y = 1;

                    for (int j = 0; j < rule.AntecedentCount; ++j)
                    {
                        Clause     antecedent = rule.getAntecedent(j);
                        FuzzySet   variable   = antecedent.Variable;
                        string     value      = antecedent.Value;
                        Membership ms         = variable.GetMembership(value);
                        double     degree     = ms.degree(variable.X);
                        if (y > degree)
                        {
                            y = degree;
                        }
                    }
                    degrees[consequent.Value].Add(y);
                }
            }

            Dictionary <string, double> consequent_degrees = getRootSumSquare(degrees);

            mValX = getAreaCentroid(consequent_degrees);
        }
 public void Infer(FuzzySet output)
 {
     output.Fire(mRules);
 }
 public void AddFuzzySet(string variable, FuzzySet set)
 {
     mVariables.Add(variable);
     mWorkingMemory[variable] = set;
 }
 public Clause(FuzzySet variable, String condition, String value)
 {
     mVariable  = variable;
     mValue     = value;
     mCondition = condition;
 }
Beispiel #5
0
 public UcFuzzySet(string name, FuzzySet fuzzy_set)
 {
     InitializeComponent();
     mFuzzySetName = name;
     mFuzzySet     = fuzzy_set;
 }