Пример #1
0
 public void init_constrain(Random rand, a_samples_set Data)
 {
     for (int j = 0; j < Fenotip_terms.Count; j++)
     {
         Term temp_term = Fenotip_terms[j];
         for (int i = 0; i < temp_term.Parametrs.Count(); i++)
         {
             temp_term.Parametrs[i] = temp_term.Parametrs[i] + Data.Attribute_Scatter(temp_term.Number_of_Input_Var) * (rand.NextDouble() - 0.5) * 0.1;
         }
     }
 }
Пример #2
0
        public Individ(Knowlege_base_ARules Source, a_samples_set data, int count_vars, bool the_first, Random rand, Type_init par_type_init)
        {
            hrom_vector       = new Hromosom(new Knowlege_base_ARules(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.Attribute_Scatter(i) * 0.05));
                step_rotate.Add(-1 * Math.PI + rand.NextDouble() * 2 * Math.PI);
            }
            if (!the_first)
            {
                switch (par_type_init)
                {
                case Type_init.Случайная: hrom_vector.init_random(rand, data); break;

                case Type_init.Ограниченная: hrom_vector.init_constrain(rand, data); break;
                }
            }
        }
Пример #3
0
        public void init_random(Random rand, a_samples_set Data)
        {
            for (int j = 0; j < Fenotip_terms.Count; j++)
            {
                Term temp_term = Fenotip_terms[j];
                for (int i = 0; i < temp_term.Parametrs.Count(); i++)
                {
                    temp_term.Parametrs[i] = Data.Attribute_Min(temp_term.Number_of_Input_Var) + Data.Attribute_Scatter(temp_term.Number_of_Input_Var) * rand.NextDouble();
                }
            }

            for (int j = 0; j < Fenotip_kons.Count; j++)
            {
                Fenotip_kons[j] = Data.Output_Attributes.Min + Data.Output_Attributes.Scatter * rand.NextDouble();
            }
        }