public void select_parents_and_crossover(Random Rand, FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover Alg_cross, double param) { the_childs.Clear(); for (int i = 0; i < size_child; i++) { int choose_one = Rand.Next(size_populate); int choose_two = Rand.Next(size_populate); the_childs.Add(the_popualate[choose_one].crossover(the_popualate[choose_two], Alg_cross, Rand, param)); } }
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); }
public Individ crossover(Individ another_parent, FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover type_cross, Random rand, double param) { Individ cross_hrom = null; switch (type_cross) { case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover.Унифицированный: cross_hrom = crossover_uniform(another_parent, param, rand); break; case FuzzySystem.FuzzyAbstract.learn_algorithm.conf.ESConfig.Alg_crossover.Многоточечный: cross_hrom = crossover_multipoint(another_parent, (int)param, rand); break; default: cross_hrom = crossover_uniform(another_parent, param, rand); break; } return(cross_hrom); }
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); }