python - Genetic Algorithm roulette selection - returning 2 parent chromosomes -
i want implement roulette wheel selection in ga algorithm. tried following guide https://stackoverflow.com/a/5315710/536474 sends new population instead of 2 best parents. suppose found fitness score initial population , need select 2 parent chromosomes population according fitness. , further goes crossover , mutation processes. in following case, how can find 2 best parents crossover based on roulette wheel selection?
population = [[text1],[text2],[text3],.....[textnum]] fitnesses = [0.8057515980834005, 1.2151126619653638, 0.6429369518995411, ... 0.805412427797966] num = 50
it doesn't send new population, num
parents. if want 2 parents call roulette_select
way:
roulette_select(population, fitnesses, 2)
often ga crossover operator expects 2 parents there variations many parents (e.g. genetic algorithms multi-parent recombination - a.e. eiben, p-e. raué, zs. ruttkay).
there self-crossover operators.
so having num
input parameters makes sense.
Comments
Post a Comment