예제 #1
0
 public void mutate_all(Random rand, double tau1, double tau2, Individ.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);
     }
 }
예제 #2
0
        public Individ mutate(Random rand, double tau1, double tau2, Individ.Type_Mutate type_mutate, double b_ro)
        {
            switch (type_mutate)
            {
            case 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 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);
        }
예제 #3
0
        public override Fuzzy_system.Approx_Singletone.a_Fuzzy_System TuneUpFuzzySystem(Fuzzy_system.Approx_Singletone.a_Fuzzy_System Approximate, Abstract_learn_algorithm_conf conf)
        {
            count_populate   = ((Es_Config)conf).Особей_в_популяции;
            count_child      = ((Es_Config)conf).Потомки;
            count_iterate    = ((Es_Config)conf).Количество_итераций;
            coef_t1          = ((Es_Config)conf).Коэффициент_t1;
            coef_t2          = ((Es_Config)conf).Коэффициент_t2;
            param_crossover  = ((Es_Config)conf).Вероятность_скрещивания;
            alg_cross        = ((Es_Config)conf).Алгоритм_Скрещивания;
            type_init        = ((Es_Config)conf).Алгоритм_Инициализации;
            count_Multipoint = ((Es_Config)conf).Точек_Скрещивания;
            type_mutate      = ((Es_Config)conf).Алгоритм_Мутации;
            b_ro             = ((Es_Config)conf).Изменение_РО;

            a_Fuzzy_System result   = Approximate;
            Population     main_pop = new Population(count_populate, count_child, result.Count_Vars, result.Learn_Samples_set);

            main_pop.init_first(result.Rulles_Database_Set[0], rand, type_init);
            for (int i = 0; i < count_iterate; i++)
            {
                double inparam = 0;
                switch (alg_cross)
                {
                case Individ.Alg_crossover.Унифицированный: inparam = param_crossover; break;

                case Individ.Alg_crossover.Многоточечный: inparam = count_Multipoint; break;
                }



                main_pop.select_parents_and_crossover(rand, alg_cross, inparam);
                main_pop.mutate_all(rand, coef_t1, coef_t2, type_mutate, b_ro);
                main_pop.union_parent_and_child();
                main_pop.Calc_Error(result);
                main_pop.select_global();
            }
            result.Rulles_Database_Set[0] = main_pop.get_best_database();
            GC.Collect();
            return(result);
        }