Пример #1
0
        public override int Run(string[] args)
        {
            Console.WriteLine("Start");
            fill_params(args);
            Console.WriteLine("Params get \nfile in {0} \n", file_in);

            Approx_learn_set = BaseUFSLoader.LoadLearnFromUFS(file_in);
            Console.WriteLine("Tra load");

            Approx_test_set = BaseUFSLoader.LoadTestFromUFS(file_in);
            Console.WriteLine("Tst load");
            conf = new MultiGoalOptimaze_conf();
            conf.Init(Approx_learn_set.CountVars);
            conf.loadParams(confParams);
            Console.WriteLine("Conf Filed");

            Approx_Singletone = new SAFuzzySystem(Approx_learn_set, Approx_test_set);
            Approx_Singletone = SAFSUFSLoader.loadUFS(Approx_Singletone, file_in);

            Console.WriteLine("Classifier created");
            optimaze          = new MultiGoalOpimize();
            Approx_Singletone = optimaze.TuneUpFuzzySystem(Approx_Singletone, conf);
            Console.WriteLine("Optimization complite");
            // a_FS_UFS.saveToUFS(Class_Pittsburg, file_out);
            Console.WriteLine("Saved");
            return(1);
        }
Пример #2
0
        public override int Run(string[] args)
        {
            Console.WriteLine("Start");
            fill_params(args);
            Console.WriteLine("Params get \nfile in {0} \n", file_in);

            Approx_learn_set = BaseUFSLoader.LoadLearnFromUFS(file_in);
            Console.WriteLine("Tra load");

            Approx_test_set = BaseUFSLoader.LoadTestFromUFS(file_in);
            Console.WriteLine("Tst load");
            conf = new PSOBacterySearchConf();
            conf.Init(Approx_learn_set.CountVars);
            conf.loadParams(confParams);
            Console.WriteLine("Conf Filed");

            Approx_Singletone = new SAFuzzySystem(Approx_learn_set, Approx_test_set);
            Approx_Singletone = SAFSUFSLoader.loadUFS(Approx_Singletone, file_in);

            Console.WriteLine("Classifier created");
            optimaze          = new PSOMethods.Approx.Term_config_PSO_Bactery();
            Approx_Singletone = optimaze.TuneUpFuzzySystem(Approx_Singletone, conf);
            Console.WriteLine("Optimization complite");
            SAFSUFSWriter.saveToUFS(Approx_Singletone, file_out);
            Console.WriteLine("Saved");
            return(1);
        }
Пример #3
0
        protected KnowlegeBaseSARules[] loadDatabase()
        {
            KnowlegeBaseSARules temp = result.RulesDatabaseSet[0];

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

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

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

            result.RulesDatabaseSet[0] = temp;

            return(tempResult);
        }
Пример #4
0
        protected KnowlegeBaseSARules[] loadDatabase()
        {
            KnowlegeBaseSARules temp = result.RulesDatabaseSet[0];
            string PathAlg           = (new FileInfo(Application.ExecutablePath)).DirectoryName + "\\FS\\fromBactery\\";

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

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

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

            result.RulesDatabaseSet[0] = temp;

            return(tempResult);
        }
Пример #5
0
 private void loadSAFSFromUFS()
 {
     FuzzySystem = SAFSUFSLoader.loadUFS(FuzzySystem as SAFuzzySystem, UFS_file_name);
 }
Пример #6
0
        public virtual 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 SAFuzzySystem(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 = SAFSUFSLoader.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 SAFuzzySystem, Rules_generator_conf[gen_index[ad]]) as SAFuzzySystem;

                    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 SAFuzzySystem, Learn_algorithm_conf[leant_index[l]]) as SAFuzzySystem;

                        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);
        }