Beispiel #1
0
        public override Fuzzy_system.Approx_Singletone.a_Fuzzy_System TuneUpFuzzySystem(Fuzzy_system.Approx_Singletone.a_Fuzzy_System Approximate, Abstract_learn_algorithm_conf conf)
        {
            Mnk_lib.Mnk_class Mnk_me = new Mnk_lib.Mnk_class();

            double [,,] Extracted_rules  = extract_Rules(Approximate.Rulles_Database_Set[0]);
            double [,] Extracted_Samples = extract_Sample_table(Approximate.Learn_Samples_set);
            double [] Extracted_Samples_out = extract_Sample_table_Out(Approximate.Learn_Samples_set);
            int       count_rules           = Approximate.Count_Rules();
            int       count_samples         = Approximate.Learn_Samples_set.Count_Samples;
            int       count_Vars            = Approximate.Learn_Samples_set.Count_Vars;

            double []           New_consq = new double[count_rules];
            Type_Term_Func_Enum type_Func = Approximate.Rulles_Database_Set[0].Terms_Set[0].Term_Func_Type;
            int type_func = (int)type_Func;

            Mnk_me.mnk_R(Extracted_rules, count_rules, type_func, Extracted_Samples, Extracted_Samples_out, count_samples, count_Vars, out New_consq);

            a_Fuzzy_System Result = Approximate;

            double result_before = Result.approx_Learn_Samples(0);

            double [] Back_consq = Result.Rulles_Database_Set[0].all_conq_of_rules;
            Result.Rulles_Database_Set[0].all_conq_of_rules = New_consq;
            double result_after = Result.approx_Learn_Samples(0);

            if (result_before < result_after)
            {
                Result.Rulles_Database_Set[0].all_conq_of_rules = Back_consq;
            }
            GC.Collect();
            return(Result);
        }
Beispiel #2
0
        public override FuzzySystem.SingletoneApproximate.SAFuzzySystem TuneUpFuzzySystem(FuzzySystem.SingletoneApproximate.SAFuzzySystem Approximate, ILearnAlgorithmConf conf)
        {
            Mnk_lib.Mnk_class Mnk_me = new Mnk_lib.Mnk_class();

            double [,,] Extracted_rules  = extract_Rules(Approximate.RulesDatabaseSet[0]);
            double [,] Extracted_Samples = extract_Sample_table(Approximate.LearnSamplesSet);
            double [] Extracted_Samples_out = extract_Sample_table_Out(Approximate.LearnSamplesSet);
            int       count_rules           = Approximate.RulesDatabaseSet[0].RulesDatabase.Count;
            int       count_samples         = Approximate.LearnSamplesSet.CountSamples;
            int       count_Vars            = Approximate.LearnSamplesSet.CountVars;

            double []        New_consq = new double[count_rules];
            TypeTermFuncEnum type_Func = Approximate.RulesDatabaseSet[0].TermsSet[0].TermFuncType;
            int type_func = (int)type_Func;

            Mnk_me.mnk_R(Extracted_rules, count_rules, type_func, Extracted_Samples, Extracted_Samples_out, count_samples, count_Vars, out New_consq);

            SAFuzzySystem Result = Approximate;

            double result_before = Result.approxLearnSamples(Result.RulesDatabaseSet[0]);

            double [] Back_consq = Result.RulesDatabaseSet[0].all_conq_of_rules;
            Result.RulesDatabaseSet[0].all_conq_of_rules = New_consq;
            double result_after = Result.approxLearnSamples(Result.RulesDatabaseSet[0]);

            if (result_before < result_after)
            {
                Result.RulesDatabaseSet[0].all_conq_of_rules = Back_consq;
            }
            GC.Collect();
            Result.RulesDatabaseSet[0].TermsSet.Trim();
            return(Result);
        }