Reputation: 5476
I have a question about how to use a tournament selection in GA. Suppose that I have 100 individuals as an initial population and then I want to apply tournament selection for n generations, so I end up with only 20% of chromosomes for each iteration. The algorithm that I came up with is:
choose 20% of the initial population
while (not end of iterations)
select randomly n individuals from the left population (20%)
if (number of chromosomes greater than two)
select the best and mutate
add to the population
if (number of chromosomes greater than three)
select best two of each pair and crossover them
add crossover product to the population
repeat process with new population
end while
is this schema correct? Thanks
Upvotes: 0
Views: 714
Reputation: 4779
It could be, but it depends on some of the details of what you're doing in that outline:
In addition, that said:
Upvotes: 0
Reputation: 6475
Disregarding 80% of the population is not the intention of the GA. Why do you have them anyway? This will increase genetic drift and lead to premature convergence.
Tournament selection works such that you take n individuals and then take the best individual as parent 1. Then you take n individuals again and obtain parent 2. These are the ones that you cross.
For a population of size 100 binary tournament should usually excert enough selection pressure.
Upvotes: 2