Tournament Selection:
- Tournament selection is a method of selecting an individual from a population of individuals.
- Tournament selection involves running several "tournaments" among a few individuals chosen at random from the population.
- The winner of each tournament (the one with the best fitness) is selected for crossover.
- When the tournament size is smaller, Tournament selection also gives a chance to all individuals to be selected and thus it preserves diversity, although keeping diversity may degrade the convergence speed.
- But if the tournament size is larger, weak individuals have a smaller chance to be selected causes loss of diversity .
PseudoCode:
choose k (the tournament size) individuals from the population at random
choose the best individual from pool/tournament with probability p
choose the second best individual with probability p*(1-p)
choose the third best individual with probability p*((1-p)^2)
and so on...
Deterministic tournament selection selects the best individual (when p = 1) in any tournament. A 1-way tournament (k = 1) selection is equivalent to random selection. The chosen individual can be removed from the population that the selection is made from if desired, otherwise individuals can be selected more than once for the next generation. In comparison with the (stochastic) fitness proportionate selection method, tournament selection is often implemented in practice due to its lack of stochastic noise.
Tournament Selection in MatLab:
Matepool=randi(PopLength,PopLength,2);%%select two individuals randomly for tournament and chooose the one with best fitness value
%% number of tournament is equal to the number of population size
for i=1:PopLength
if Fitness(Matepool(i,1))>= Fitness(Matepool(i,2))
SelectedPop(i,1:IndLength)=CurrentPop(Matepool(i,1),1:IndLength);
else
SelectedPop(i,1:IndLength)=CurrentPop(Matepool(i,2),1:IndLength);
end
end