【发布时间】:2018-05-06 12:35:42
【问题描述】:
我有一个问题,关于在获得适应度成比例概率时如何处理为 0 的适应度(适应度'?)。如果成员的容器首先按最高适应度排序,然后执行类似这样的代码:
for all members of population
sum += fitness of this individual
end for
for all members of population
probability = sum of probabilities + (fitness / sum)
sum of probabilities += probability
end for
loop until new population is full
do this twice
number = Random between 0 and 1
for all members of population
if number > probability but less than next probability then you have been selected
end for
end
create offspring
end loop
当我使用随机生成的成员手动进行一次迭代时,我看到的问题是我有一些成员的适应度为 0,但是当获得这些成员的概率时,它保持与最后一个非零相同的概率成员。有没有办法可以将非零概率与零概率分开?我在想,即使我根据最高适应度进行排序,最后一个非零成员的概率也会与零概率相同。
【问题讨论】:
标签: algorithm genetic-algorithm fitness roulette-wheel-selection