Пример #1
0
        public Individ(Individ the_individ)
        {
            hrom_vector       = new Hromosom(the_individ.hrom_vector);
            step_rotate       = new List <double>(the_individ.step_rotate);
            step_sko          = new List <double>(the_individ.step_sko);
            count_step_rotate = the_individ.count_step_rotate;

            count_step_sko = the_individ.count_step_sko;
            Data           = the_individ.Data;
        }
Пример #2
0
        public Hromosom crossover_multipoint(Hromosom another_Hrom, Random Rand, int current_pos, List <int> trigger_cross, bool flag_reverse)
        {
            Hromosom child_hrom = new Hromosom(this);


            for (int i = 0; i < Fenotip_terms.Count; i++)
            {
                if ((trigger_cross.Count > 0) && (current_pos == trigger_cross[0]))
                {
                    flag_reverse = !flag_reverse;
                    trigger_cross.RemoveAt(0);
                }



                if (flag_reverse)
                {
                    child_hrom.Fenotip_terms[i] = another_Hrom.Fenotip_terms[i];
                }
                current_pos++;
            }

            for (int i = 0; i < Fenotip_kons.Count; i++)
            {
                if ((trigger_cross.Count > 0) && (current_pos == trigger_cross[0]))
                {
                    flag_reverse = !flag_reverse;
                    trigger_cross.RemoveAt(0);
                }



                if (flag_reverse)
                {
                    child_hrom.Fenotip_kons[i] = another_Hrom.Fenotip_kons[i];
                }
                current_pos++;
            }



            return(child_hrom);
        }
Пример #3
0
        public Individ(KnowlegeBaseTSARules Source, SampleSet data, int count_vars, bool the_first, Random rand, FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init par_type_init)
        {
            hrom_vector       = new Hromosom(new KnowlegeBaseTSARules(Source));
            step_sko          = new List <double>(count_vars);
            step_rotate       = new List <double>(count_vars);
            count_step_sko    = count_vars;
            count_step_rotate = count_vars;
            Data = data;
            for (int i = 0; i < count_vars; i++)
            {
                step_sko.Add(0 + rand.NextDouble() * (data.InputAttributes[i].Scatter * 0.05));
                step_rotate.Add(-1 * Math.PI + rand.NextDouble() * 2 * Math.PI);
            }
            if (!the_first)
            {
                switch (par_type_init)
                {
                case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init.Случайная: hrom_vector.init_random(rand, data); break;

                case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Type_init.Ограниченная: hrom_vector.init_constrain(rand, data); break;
                }
            }
        }
Пример #4
0
        public Hromosom crossover_uniform(Hromosom another_Hrom, Random Rand, double level_cross)
        {
            Hromosom child_hrom = new Hromosom(this);

            for (int i = 0; i < Fenotip_terms.Count; i++)
            {
                if (Rand.NextDouble() < level_cross)
                {
                    child_hrom.Fenotip_terms[i] = another_Hrom.Fenotip_terms[i];
                }
            }

            for (int i = 0; i < Fenotip_kons.Count; i++)
            {
                if (Rand.NextDouble() < level_cross)
                {
                    child_hrom.Fenotip_kons[i] = another_Hrom.Fenotip_kons[i];
                }
            }



            return(child_hrom);
        }
Пример #5
0
 public Hromosom(Hromosom the_Source)
 {
     core_check    = new KnowlegeBaseTSARules(the_Source.core_check);
     Fenotip_kons  = core_check.all_conq_of_rules.ToList();
     Fenotip_terms = core_check.TermsSet.ToList();
 }