Beispiel #1
0
 public void mutate_all(Random rand, double tau1, double tau2, FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate type_mutate, double b_ro)
 {
     for (int i = 0; i < the_childs.Count; i++)
     {
         the_childs[i].mutate(rand, tau1, tau2, type_mutate, b_ro);
     }
 }
Beispiel #2
0
 public virtual void Init(ILearnAlgorithmConf Conf)
 {
     Config           = Conf as ESConfig;
     count_populate   = Config.ESCPopulationSize;
     count_child      = Config.ESCCountChild;
     count_iterate    = Config.ESCCountIteration;
     coef_t1          = Config.ESCT1;
     coef_t2          = Config.ESCT2;
     param_crossover  = Config.ESCCrossoverPropability;
     alg_cross        = Config.ESCCrossoverType;
     type_init        = Config.ESCInitType;
     count_Multipoint = Config.ESCCountCrossoverPoint;
     type_mutate      = Config.ESCMutateAlg;
     b_ro             = Config.ESCAngleRotateB;
     main_pop         = new Population(count_populate, count_child, result.CountFeatures, result.LearnSamplesSet);
     main_pop.init_first(result.RulesDatabaseSet[0], rand, type_init);
 }
Beispiel #3
0
        public Individ mutate(Random rand, double tau1, double tau2, FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate type_mutate, double b_ro)
        {
            switch (type_mutate)
            {
            case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate.СКО:
            {
                hrom_vector.mutate_SKO(step_sko, rand);
                for (int i = 0; i < step_sko.Count; i++)
                {
                    step_sko[i] = step_sko[i] * Math.Exp(tau1 * GaussRandom.Random_gaussian(rand) + tau2 * GaussRandom.Random_gaussian(rand));
                }
                break;
            }

            case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate.СКО_РО:
            {
                List <double> Covariance_matrix_pruned = new List <double>();

                for (int i = 0; i < step_sko.Count; i++)         // mutate
                {
                    step_sko[i]    = step_sko[i] * Math.Exp(tau1 * GaussRandom.Random_gaussian(rand) + tau2 * GaussRandom.Random_gaussian(rand));
                    step_rotate[i] = step_rotate[i] + b_ro * GaussRandom.Random_gaussian(rand);
                }
                double avr_ro  = step_rotate.Sum() / step_rotate.Count;
                double avr_sko = step_sko.Sum() / step_sko.Count;

                for (int i = 0; i < step_sko.Count; i++)          //calc covariance_matrix_pruned
                {
                    Covariance_matrix_pruned.Add(Math.Abs(
                                                     (step_sko[i] - avr_sko) * (step_rotate[i] - avr_ro)
                                                     )
                                                 );
                }

                hrom_vector.mutate_SKO_RO(Covariance_matrix_pruned, rand);
                break;
            }
            }
            return(this);
        }
Beispiel #4
0
        protected override void fill_params(string[] args)
        {
            file_in = (args.Where(x => x.Contains("in"))).ToArray()[0];
            Console.WriteLine("Before cut {0}", file_in);
            file_in = file_in.Remove(0, 3);
            Console.WriteLine("After cut {0}", file_in);
            file_out = (args.Where(x => x.Contains("out"))).ToArray()[0];
            file_out = file_out.Remove(0, 4);


            string temp = (args.Where(x => x.Contains("init_alg"))).ToArray()[0];

            temp = temp.Split(':')[1];

            switch (temp)
            {
            case "Random": type_init = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init.Случайная; break;

            case "Constrain": type_init = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init.Ограниченная; break;

            default: type_init = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init.Ограниченная; break;
            }



            temp = (args.Where(x => x.Contains("type_mutate"))).ToArray()[0];
            temp = temp.Split(':')[1];

            switch (temp)
            {
            case "Adaptive": type_mutate = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate.СКО; break;

            case "CovarianceMatrix": type_mutate = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate.СКО_РО; break;

            default: type_mutate = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_Mutate.СКО_РО; break;
            }

            temp = (args.Where(x => x.Contains("type_cross"))).ToArray()[0];
            temp = temp.Split(':')[1];

            switch (temp)
            {
            case "Unified": type_cross = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover.Унифицированный; break;

            case "Multipoint": type_cross = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover.Многоточечный; break;

            default: type_cross = FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover.Унифицированный; break;
            }


            temp = (args.Where(x => x.Contains("pcross"))).ToArray()[0];
            temp = temp.Split(':')[1];
            string comma = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            temp = temp.Replace(".", comma);
            double.TryParse(temp, out pcross);

            temp = (args.Where(x => x.Contains("cpcross"))).ToArray()[0];
            temp = temp.Split(':')[1];

            temp = temp.Replace(".", comma);
            double.TryParse(temp, out cpcross);

            temp = (args.Where(x => x.Contains("angleR"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out angleR);

            temp = (args.Where(x => x.Contains("iterate"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out iterate);

            temp = (args.Where(x => x.Contains("cindiv"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out cindiv);

            temp = (args.Where(x => x.Contains("cchild"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out cchild);


            temp = (args.Where(x => x.Contains("coeft1"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out coeft1);

            temp = (args.Where(x => x.Contains("coeft2"))).ToArray()[0];
            temp = temp.Split(':')[1];
            temp = temp.Replace(".", comma);
            double.TryParse(temp, out coeft2);
        }