遗传算法 - Parent 选择与交叉概率

Genetic Algorithm - Parent Selection vs. Crossover Probability

我阅读了 TutorialsPoint and this question and answer on Whosebug 上的教程。但是,我仍然不明白Parent遗传算法选择和交叉过程中交叉概率的含义。

假设我的人口规模为 100,交叉概率为 0.9。这是什么意思?我:

然后,parents 以某种方式交叉,一些个体发生变异。此时种群是否需要刚好有 100 个成员,或者还有一个 selection 个体可以传给下一代?

不完全是 10 parents,平均是 10 parents。 以下是我遵循的伪代码。

current_population <- comes from previous generation
new_population <- []

for i upto number of chromosomes in current_population :
    parent1, parent2 <- pick 2 parents from current population based on fitness function

    if random_number is less than cross_over_ratio :
        offspring <- crossover (parent1, parent2)
    else:
        if random_number is 0.5:
            offspring <- parent1
        else:
            offspring <- parent2

    append the offspring to new_population

for i upto number of chromosomes in new_population :

    if random_number is less than mutation_ratio :
        i_th chromosome in new_population <- mutation (i_th chromosome in new_population)

正如 Carcingenicate 所提到的,实施可能会有所不同。 0.90 的交叉率表示 90% 的后代或 child 种群将通过对 parent 解的交叉操作创建。这可能会被实施,使得恰好 90% 的 child 是由每一代交叉产生的,或者它可能被概率地实施(如 AI_Learning 的示例中所做的那样)。交叉产生的 children 可能会也可能不会发生突变。

parent 解决方案的 select 编辑方式也可能有所不同。可能更适合 parent 的解决方案更有可能被 select 产生后代,无论产生什么后代,都将构成下一代的 parent 种群。或者,可以随机选择 parent 个解决方案来产生后代。然后对组合的 parent 和后代种群进行选择,以创建下一代的 parent 种群。

通常,parent 人口将始终等于规定的人口规模。但是,有可能产生更多的后代,然后 select 只产生一个子集。或者每代可能只创建几个后代,每个后代都可能替换 parent 解决方案。一些实现也可能随着时间的推移改变人口规模,可能最初使用大量人口来促进探索,然后随着时间的推移减少人口规模以促进开发。