Exemple #1
0
        public override FuzzySystem.SingletoneApproximate.SAFuzzySystem TuneUpFuzzySystem(FuzzySystem.SingletoneApproximate.SAFuzzySystem Approximate, ILearnAlgorithmConf conf)
        {
            result = Approximate;
            Init(conf);

            Ocean = new SingletonHybride(new SAFuzzySystem(result));


            List <Task> AlgTasks = new List <Task>();



            Parallel.For(0, Configs.Count, magic =>


            {
                Task CurrentTask = new Task(() => { Algorithms[magic].TuneUpFuzzySystem(Ocean, new SAFuzzySystem(result), Configs[magic]); });
                AlgTasks.Add(CurrentTask);

                AlgTasks[magic].Start();
            }
                         );
            Task.WaitAll(AlgTasks.ToArray());
            List <KnowlegeBaseSARules> ListSystems = Ocean.Get(1, FuzzySystem.FuzzyAbstract.Hybride.FuzzyHybrideBase.goodness.best, FuzzySystem.FuzzyAbstract.Hybride.FuzzyHybrideBase.islandStrategy.All);

            ListSystems.Add(result.RulesDatabaseSet[0]);

            result.RulesDatabaseSet[0] = ListSystems.SelectBest(result, 1)[0];
            result.RulesDatabaseSet[0].TermsSet.Trim();
            return(result);
        }
Exemple #2
0
 public SAFuzzySystem TuneUpFuzzySystem(SingletonHybride Ocean, SAFuzzySystem Approximate, ILearnAlgorithmConf conf)
 {
     HybrideOcean = Ocean;
     base.TuneUpFuzzySystem(Approximate, conf);
     Ocean.Store(chooseDiscovers(1), this.ToString());
     return(result);
 }
Exemple #3
0
 public SAFuzzySystem TuneUpFuzzySystem(SingletonHybride Ocean, SAFuzzySystem Approximate, ILearnAlgorithmConf conf)
 {
     HybrideOcean = Ocean;
     base.TuneUpFuzzySystem(Approximate, conf);
     Ocean.Store(chooseDiscovers(1), this.ToString());
     theFuzzySystem.RulesDatabaseSet[0].TermsSet.Trim();
     return(theFuzzySystem);
 }
Exemple #4
0
        public SAFuzzySystem TuneUpFuzzySystem(SingletonHybride Ocean, SAFuzzySystem Approximate, ILearnAlgorithmConf conf)
        {
            SAFuzzySystem result = Approximate;
            BeeParamsConf Config = conf as BeeParamsConf;

            Init(Config);
            theFuzzySystem = result;

            if (result.RulesDatabaseSet.Count < 1)
            {
                throw (new Exception("Что то не так с базой правил"));
            }
            theHive = new HiveParams(this, result.RulesDatabaseSet[0]);
            //  HiveParams theHive = new ParallelHiveParams(this, result.RulesDatabaseSet[0]);
            // HiveParams theHive = new HiveParallelParams2(this, result.RulesDatabaseSet[0]);

            theBest = new BeeParams(result.RulesDatabaseSet[0], this);
            double temperature = initTemp;

            for (int r = 0; r < iterration; r++)
            {
                temperature = oneIterate(temperature);

                int CountSend = theHive.HostArchive.Count / 2;
                List <KnowlegeBaseSARules> toStore = new List <KnowlegeBaseSARules>();
                for (int i = 0; i < CountSend; i++)
                {
                    toStore.Add(theHive.HostArchive[i].PositionOfBee);
                }

                Ocean.Store(toStore, this.ToString());

                int toGet = theHive.HostArchive.Count - CountSend;

                List <KnowlegeBaseSARules> Getted = Ocean.Get(toGet, FuzzyAbstract.Hybride.FuzzyHybrideBase.goodness.best, FuzzyAbstract.Hybride.FuzzyHybrideBase.islandStrategy.All);

                toGet = Getted.Count < toGet ? Getted.Count : toGet;

                for (int i = 0; i < toGet; i++)
                {
                    theHive.HostArchive[i + CountSend].PositionOfBee = Getted[i];
                }


                GC.Collect();
            }
            theBest = lastStep(theBest);
            Approximate.RulesDatabaseSet[0] = theBest.PositionOfBee;

            return(result);
        }