Example #1
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);
        }