public override SAFuzzySystem TuneUpFuzzySystem(SAFuzzySystem Approx, ILearnAlgorithmConf conf)
        {
            SAFuzzySystem result = Approx;
            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);
                GC.Collect();
            }
            theBest = lastStep(theBest);
            Approx.RulesDatabaseSet[0] = theBest.PositionOfBee;
            Approx.RulesDatabaseSet[0].TermsSet.Trim();
            return(Approx);
        }
Exemple #2
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);
        }