Ejemplo n.º 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 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);
        }
Ejemplo n.º 2
0
        public override void Work()
        {
            GIBNormal      = fuzzy_system.getGIBNormal();
            GIBSumStraigth = fuzzy_system.getGIBSumStrait();
            GIBSumReverce  = fuzzy_system.getGIBSumReverse();

            GICNormal     = fuzzy_system.getGICNormal();
            GICSumReverce = fuzzy_system.getGICSumReverce();
            GICSumStraigh = fuzzy_system.getGICSumStraigth();

            GISNormal      = fuzzy_system.getGISNormal();
            GISSumReverce  = fuzzy_system.getGISSumReverce();
            GISSumStraigth = fuzzy_system.getGISSumStraigt();

            LindisNormal     = fuzzy_system.getLindisNormal();
            LindisSumStraigh = fuzzy_system.getLindisSumStraight();
            LindisSumReverce = fuzzy_system.getLindisSumReverse();

            NormalIndex       = fuzzy_system.getNormalIndex();
            SumReverseIndex   = fuzzy_system.getIndexSumReverse();
            SumsStraigthIndex = fuzzy_system.getIndexSumStraigt();



            SAFSUFSWriter.saveToUFS(fuzzy_system, Source);
        }
Ejemplo n.º 3
0
        protected virtual void save_FS(SAFuzzySystem FS, string Name_alg)
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }


            string file_name = DateTime.Now.ToLongDateString() + " " + DateTime.Now.TimeOfDay.ToString("hh','mm','ss") + " (" + Thread.CurrentThread.ManagedThreadId.ToString() + ")" + "[" + FS.ValueComplexity().ToString() + "]{" + Name_alg + "}.ufs";

            SAFSUFSWriter.saveToUFS(FS, path + file_name);
            //  SAFSUFSWriter.Knowledge_base_Jsonto(FS.RulesDatabaseSet[0],fileName+".json");
        }
Ejemplo n.º 4
0
        private void saveFS(SAFuzzySystem Classifier, string path, string dataSet, int seed, int numstep, int globalCounter, bool isPath)
        {
            string RootPath = path + "\\" + dataSet + "\\";

            if (!Directory.Exists(RootPath))
            {
                Directory.CreateDirectory(RootPath);
            }
            string name = globalCounter.ToString() + "_s" + seed.ToString();

            if (isPath)
            {
                name += "_p" + numstep.ToString();
            }
            name += ".ufs";
            SAFSUFSWriter.saveToUFS(Classifier, RootPath + name);
        }
Ejemplo n.º 5
0
 public override int Run(string[] args)
 {
     Console.WriteLine("Start");
     fill_params(args);
     Console.WriteLine("Params get \nfile tra {0} \nfile name tst {1} ", file_learn, file_test);
     Approx_learn_set = new SampleSet(file_learn);
     Console.WriteLine("Tra create");
     Approx_test_set = new SampleSet(file_test);
     Console.WriteLine("Tst create");
     conf = new InitEveryoneWithEveryone();
     conf.Init(Approx_learn_set.CountVars);
     fill_conf();
     Console.WriteLine("Conf Filed");
     Approx_Singletone = new SAFuzzySystem(Approx_learn_set, Approx_test_set);
     Console.WriteLine("Classifier created");
     generator         = new GeneratorRulesEveryoneWithEveryone();
     Approx_Singletone = generator.Generate(Approx_Singletone, conf) as SAFuzzySystem;
     Console.WriteLine("Gereration complite");
     SAFSUFSWriter.saveToUFS(Approx_Singletone, file_out);
     Console.WriteLine("Saved");
     return(1);
 }
Ejemplo n.º 6
0
        protected void savetoUFS(List <KnowlegeBaseSARules> Source, int startpos, int endPos, int TryNum)
        {
            KnowlegeBaseSARules temp = result.RulesDatabaseSet[0];


            if (!Directory.Exists(PathAlgSource))
            {
                Directory.CreateDirectory(PathAlgSource);
            }
            string[] files = Directory.GetFiles(PathAlgSource, "*.ufs");
            foreach (string file in files)
            {
                File.Delete(file);
            }

            for (int i = startpos; i <= endPos; i++)
            {
                result.RulesDatabaseSet[0] = Source[i];

                SAFSUFSWriter.saveToUFS(result, PathAlgSource + TryNum.ToString() + "_" + i.ToString() + ".ufs");
            }
            result.RulesDatabaseSet[0] = temp;
        }
Ejemplo n.º 7
0
        protected void savetoUFS(List <KnowlegeBaseSARules> Source, int startpos, int endPos, int TryNum)
        {
            KnowlegeBaseSARules temp = result.RulesDatabaseSet[0];

            string PathAlg = (new FileInfo(Application.ExecutablePath)).DirectoryName + "\\FS\\toBactery\\";

            if (!Directory.Exists(PathAlg))
            {
                Directory.CreateDirectory(PathAlg);
            }
            string[] files = Directory.GetFiles(PathAlg, "*.ufs");
            foreach (string file in files)
            {
                File.Delete(file);
            }

            for (int i = startpos; i <= endPos; i++)
            {
                result.RulesDatabaseSet[0] = Source[i];

                SAFSUFSWriter.saveToUFS(result, PathAlg + TryNum.ToString() + "_" + i.ToString() + ".ufs");
            }
            result.RulesDatabaseSet[0] = temp;
        }
Ejemplo n.º 8
0
 private void writeSAtoUFS(IFuzzySystem FS, string fileName)
 {
     SAFSUFSWriter.saveToUFS(FS as SAFuzzySystem, fileName);
 }