赛事选择:
- 比赛选择是一种从个体群体中选择个体的方法。
- 比赛选择涉及在从人群中随机选择的几个人中运行几个“比赛”。
- 每场比赛的获胜者(体能最好的那个)被选为交叉赛。
- 当锦标赛规模较小时,锦标赛选择也给了所有个体被选择的机会,因此它保留了多样性,尽管保持多样性可能会降低收敛速度。
- 但如果比赛规模较大,弱个体被选中的机会较小,导致多样性损失。
伪代码:
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...
确定性锦标赛选择在任何锦标赛中选择最佳个人(当 p = 1 时)。单向锦标赛 (k = 1) 选择等同于随机选择。如果需要,可以从进行选择的群体中删除所选择的个体,否则可以为下一代多次选择个体。与(随机)适应度比例选择方法相比,由于缺乏随机噪声,锦标赛选择通常在实践中实现。
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