コード例 #1
0
        protected KnowlegeBaseTSARules[] loadDatabase()
        {
            KnowlegeBaseTSARules temp = result.RulesDatabaseSet[0];

            if (!Directory.Exists(PathAlgDestiny))
            {
                Directory.CreateDirectory(PathAlgDestiny);
            }

            string[] files = Directory.GetFiles(PathAlgDestiny, "*.ufs", SearchOption.AllDirectories);
            KnowlegeBaseTSARules[] tempResult = new KnowlegeBaseTSARules[files.Count()];

            for (int i = 0; i < files.Count(); i++)
            {
                result        = TSAFSUFSLoader.loadUFS(result, files[i]);
                tempResult[i] = result.RulesDatabaseSet[0];
                File.Delete(files[i]);
            }

            result.RulesDatabaseSet[0] = temp;

            return(tempResult);
        }
コード例 #2
0
        public override void Calc()
        {
            DateTime   start__full_time = DateTime.Now;
            List <int> gen_index        = prepare_generate_to_Calc();
            List <int> leant_index      = prepare_learn_to_Calc();

            make_Log(Log_line.Start, TimerValue: start__full_time);
            int currentstep = 0;
            int all_step    = (Rules_generator.Count() + Learn_algorithms.Count() * Repeat_into) * Repeat_renew_global;

            currentstep = Make_inform_back_process(currentstep, all_step);

            //   Parallel.For(0, Repeat_renew_global, i =>
            LOG = "";
            for (int i = 0; i < Repeat_renew_global; i++)
            {
                Approx_Singletone = new TSAFuzzySystem(Approx_learn_set, Approx_test_set);
                DateTime start__curle_time = DateTime.Now;
                #region Генерация аппроксиматора

                make_Log(Log_line.StartGenerate, TimerValue: start__curle_time);
                if (Rules_generator.Count() == 0 && (is_UFS))
                {
                    Approx_Singletone = TSAFSUFSLoader.loadUFS(Approx_Singletone, UFS_file_name);
                }
                for (int ad = 0; ad < Rules_generator.Count(); ad++)
                {
                    make_Log(Log_line.PreGenerate_log, name_Alg: Rules_generator[ad].ToString());

                    Approx_Singletone =
                        Rules_generator[ad].Generate(Approx_Singletone as TSAFuzzySystem, Rules_generator_conf[gen_index[ad]]) as TSAFuzzySystem;

                    currentstep = Make_inform_back_process(currentstep, all_step);

                    make_Log(Log_line.PostGenerate_log, Approx_Singletone, name_Alg: Rules_generator[ad].ToString(true));
                    if (is_autosave)
                    {
                        save_FS(Approx_Singletone, Name_alg: Rules_generator[ad].ToString());
                    }
                    GC.Collect();
                }

                #endregion

                make_Log(Log_line.StartOptimaze, Approx_Singletone);

                for (int j = 0; j < Repeat_into; j++)
                {
                    #region Оптимизация аппроксиматора
                    for (int l = 0; l < Learn_algorithms.Count(); l++)
                    {
                        make_Log(Log_line.PreOptimaze_log, name_Alg: Learn_algorithms[l].ToString());
                        Approx_Singletone =
                            Learn_algorithms[l].TuneUpFuzzySystem(Approx_Singletone as TSAFuzzySystem, Learn_algorithm_conf[leant_index[l]]) as TSAFuzzySystem;

                        currentstep = Make_inform_back_process(currentstep, all_step);

                        make_Log(Log_line.PostOptimaze_log, FS: Approx_Singletone, name_Alg: Learn_algorithms[l].ToString(true));

                        if (is_autosave)
                        {
                            save_FS(Approx_Singletone, Learn_algorithms[l].ToString());
                        }
                        GC.Collect();
                    }
                    #endregion
                }
                make_Log(Log_line.EndCircle, TimerSpan: (DateTime.Now - start__curle_time));

                GC.Collect();
            }
            //  );
            make_Log(Log_line.End, TimerSpan: DateTime.Now - start__full_time);
        }
コード例 #3
0
 private void loadTSAFSFromUFS()
 {
     FuzzySystem = TSAFSUFSLoader.loadUFS(FuzzySystem as TSAFuzzySystem, UFS_file_name);
 }