Пример #1
0
        public void constuct__and_add_the_Rule(List <Term> terms, SAFuzzySystem FS)
        {
            SARule Result;

            int[] order_of_terms = new int[terms.Count()];
            for (int i = 0; i < terms.Count(); i++)
            {
                order_of_terms[i] = TermsSet.Count;
                TermsSet.Add(terms[i]);
            }
            double kons_Value = KNNConsequent.NearestApprox(FS, TermsSet);

            Result = new SARule(TermsSet, order_of_terms, kons_Value);
            RulesDatabase.Add(Result);
        }
Пример #2
0
 public KnowlegeBaseSARules(KnowlegeBaseSARules source, List <bool> used_rules = null)
 {
     for (int i = 0; i < source.TermsSet.Count; i++)
     {
         Term temp_term = new Term(source.TermsSet[i]);
         TermsSet.Add(temp_term);
     }
     for (int j = 0; j < source.RulesDatabase.Count; j++)
     {
         if ((used_rules == null) || (used_rules[j]))
         {
             int[] order = new int[source.RulesDatabase[j].ListTermsInRule.Count];
             for (int k = 0; k < source.RulesDatabase[j].ListTermsInRule.Count; k++)
             {
                 Term temp_term = source.RulesDatabase[j].ListTermsInRule[k];
                 order[k] = source.TermsSet.FindIndex(x => x == temp_term);
             }
             double temp_DoubleOutputs = source.RulesDatabase[j].IndependentConstantConsequent;
             SARule temp_rule          = new SARule(TermsSet, order, temp_DoubleOutputs);
             RulesDatabase.Add(temp_rule);
         }
     }
 }