Ejemplo n.º 1
0
 public HiveParams(BeeParamsAlgorithm Parrent, KnowlegeBaseTSARules Best)
 {
     theParrent  = Parrent;
     hostArchive = new List <BeeParams>();
     hostArchive.Add(new BeeParams(Best, Parrent));
     hostArchive[0].getGoodsImproove();
 }
Ejemplo n.º 2
0
        public ScoutParams(KnowlegeBaseTSARules theSource, BeeParamsAlgorithm parrent, Random rand)
            : base(theSource, parrent)
        {
            for (int i = 0; i < PositionOfBee.TermsSet.Count; i++)
            {
                int    Varrible = PositionOfBee.TermsSet[i].NumVar;
                double Scatter  = Parrent.getCurrentNs().LearnSamplesSet.InputAttributes[Varrible].Scatter;

                switch (PositionOfBee.TermsSet[i].TermFuncType)
                {
                case TypeTermFuncEnum.Гауссоида: { PositionOfBee.TermsSet[i].Parametrs = optimizeGauss(Scatter, PositionOfBee.TermsSet[i].Parametrs, rand); } break;

                case TypeTermFuncEnum.Парабола: { PositionOfBee.TermsSet[i].Parametrs = optimizeParabolic(Scatter, PositionOfBee.TermsSet[i].Parametrs, rand); } break;

                case TypeTermFuncEnum.Трапеция: { PositionOfBee.TermsSet[i].Parametrs = optimizeTrapec(Scatter, PositionOfBee.TermsSet[i].Parametrs, rand); } break;

                case TypeTermFuncEnum.Треугольник: { PositionOfBee.TermsSet[i].Parametrs = optimizeTrianlge(Scatter, PositionOfBee.TermsSet[i].Parametrs, rand); } break;
                }
            }

            getGoodsImproove();

            //      SAFuzzySystem ToOpintNS = Parrent.getCurrentNs();

            /*      lock (ToOpintNS)
             *    {
             *        Adaptive_LSM tryOpt = new Adaptive_LSM();
             *
             *
             *
             *
             *        double tempgood = getGoodsImproove();
             *        KnowlegeBaseSARules tempPositionofBee = PositionOfBee;
             *        KnowlegeBaseSARules zeroSolution = ToOpintNS.RulesDatabaseSet[0];
             *        ToOpintNS.RulesDatabaseSet[0] = PositionOfBee;
             *
             *        tryOpt.TuneUpFuzzySystem(ToOpintNS, new NullConfForAll());
             *        PositionOfBee = ToOpintNS.RulesDatabaseSet[0];
             *        double newgood = getGoodsImproove();
             *
             *        if (newgood > tempgood)
             *        {
             *            PositionOfBee = tempPositionofBee;
             *            getGoodsImproove();
             *        }
             *    } */
        }
Ejemplo n.º 3
0
        public static List <BeeParams> FlyScout(int countofBee, Random rand, KnowlegeBaseTSARules Source, BeeParamsAlgorithm parrent)
        {
            List <BeeParams> result = new List <BeeParams>();

            for (int i = 0; i < countofBee; i++)
            {
                result.Add(new ScoutParams(Source, parrent, rand));
            }

            return(result);
        }
Ejemplo n.º 4
0
        public OutLookersBeeParams(KnowlegeBaseTSARules theSource, KnowlegeBaseTSARules Best, BeeParamsAlgorithm parrent, Random rand)
            : base(theSource, parrent)
        {
            for (int i = 0; i < PositionOfBee.TermsSet.Count; i++)
            {
                double [] Params = PositionOfBee.TermsSet[i].Parametrs;
                for (int j = 0; j < Params.Count(); j++)
                {
                    int Choose = rand.Next(2);
                    switch (Choose)
                    {
                    case 0: { Params[j] = Best.TermsSet[i].Parametrs[j] + Math.Abs(Best.TermsSet[i].Parametrs[j] - Params[j]) * rand.NextDouble(); } break;

                    case 1: { Params[j] = Best.TermsSet[i].Parametrs[j] - Math.Abs(Best.TermsSet[i].Parametrs[j] - Params[j]) * rand.NextDouble(); } break;
                    }
                }
                PositionOfBee.TermsSet[i].Parametrs = Params;
            }

            double[] consq = PositionOfBee.all_conq_of_rules;
            for (int i = 0; i < consq[i]; i++)
            {
                int choose = rand.Next(2);
                switch (choose)
                {
                case 0: { consq[i] = Best.all_conq_of_rules[i] + Math.Abs(Best.all_conq_of_rules[i] - consq[i]) * rand.NextDouble(); } break;

                case 1: { consq[i] = Best.all_conq_of_rules[i] - Math.Abs(Best.all_conq_of_rules[i] - consq[i]) * rand.NextDouble(); } break;
                }
            }
            PositionOfBee.all_conq_of_rules = consq;
            getGoodsImproove();
        }
Ejemplo n.º 5
0
        public static List <BeeParams> OutLookerFly(BeeParams Best, List <BeeParams> Source, Random rand, BeeParamsAlgorithm parrent)
        {
            List <BeeParams> Result = new List <BeeParams>();

            for (int i = 0; i < Source.Count(); i++)
            {
                Result.Add(new OutLookersBeeParams(Source[i].PositionOfBee, Best.PositionOfBee, parrent, rand));
            }

            return(Result);
        }
Ejemplo n.º 6
0
        public BeeParams(KnowlegeBaseTSARules theSource, BeeParamsAlgorithm parrent)
        {
            thePositionOfBee = new KnowlegeBaseTSARules(theSource);

            Parrent = parrent;
        }