Exemplo n.º 1
0
        public override ILearnAlgorithmConf getConf(int CountFeatures)
        {
            ILearnAlgorithmConf result = new BeeParamsConf();

            result.Init(CountFeatures);
            return(result);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public void Init(BeeParamsConf Config)
 {
     hiveSize        = Config.ABCWHiveSize;
     persentScouts   = Config.ABCWPercentScoutInHive;
     countScouts     = (int)(hiveSize * persentScouts / 100);
     countWorkers    = (int)((hiveSize - countScouts) / 2);
     countOutLookers = hiveSize - countScouts - countWorkers;
     initTemp        = Config.ABCWInitTemperature;
     coefTemp        = Config.ABCWColdCoeff;
     iterration      = Config.ABCWCountIteration;
     border1         = Config.ABCWFirstBorder;
     repeat1         = Config.ABCWFirstRepeate;
     border2         = Config.ABCWSecondBorder;
     repeat2         = Config.ABCWSecondRepeate;
     border3         = Config.ABCWFirdBorder;
     repeat3         = Config.ABCWFirdRepeate;
     TypeSelection   = Config.ABCWTypeSelection;
 }