コード例 #1
0
        public KnowlegeBaseTSARules(KnowlegeBaseTSARules 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;
                    double[] temp_approx_RegressionConstantConsequent = source.RulesDatabase[j].RegressionConstantConsequent.Clone() as double [];
                    TSARule  temp_rule = new TSARule(TermsSet, order, temp_DoubleOutputs, temp_approx_RegressionConstantConsequent);
                    RulesDatabase.Add(temp_rule);
                }
            }
        }
コード例 #2
0
        public void ConstructNewRule(List <Term> terms, TSAFuzzySystem FS)
        {
            TSARule 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 [] temp_regressionCoefficent;
            double    kons_Value = LSMWeghtReqursiveSimple.EvaluteConsiquent(FS, TermsSet, out temp_regressionCoefficent);

            Result = new TSARule(TermsSet, order_of_terms, kons_Value, temp_regressionCoefficent);
            RulesDatabase.Add(Result);
        }