在比赛选择中选择家长

发布于 2025-01-03 13:38:25 字数 103 浏览 1 评论 0原文

我正在写一个 GA,我不确定在选择父母时我是否应该循环遍历我的人口,使用锦标赛选择找到每个父母,或者我是否打算为每个解决方案使用锦标赛选择找到两个父母在我的人口中。

是哪一个?

I'm writing up a GA and I'm not sure if when selecting the parents I'm suppose to loop through my population finding each a parent using tournament selection or if I'm meant to find two parents using tourament selection for each solution in my population.

Which one is it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

り繁华旳梦境 2025-01-10 13:38:25

我不太清楚你建议的替代方案之间的差异是什么意思,但一般来说,它的工作方式是你随机选择两个人,保留最好的一个,这将成为父母#1。然后你再随机挑选两个个体,保留最好的一个,它就成为“Parent #2”。然后,这两个父母重新结合,产生后代,这些后代进入儿童群体。重复这个过程,直到有足够的后代。

因此,您可以使用类似以下循环的方式生成子群体。 (您可以为每组父母生成多个后代...调整循环边界以适应您的情况)。

for i = 1 to N 
    pick individual t1 at random from parent population
    pick individual t2 at random from parent population
    parent1 = winner(t1, t2)

    pick individual t1 at random from parent population
    pick individual t2 at random from parent population
    parent2 = winner(t1, t2)

    generate offspring from parent1, parent2
    mutate offspring
    evaluate offspring
    add offspring to child population
end for

I'm not too clear what you mean to be the difference between your suggested alternatives, but generally, the way it works is that you pick two random individuals, keep the best one, and that becomes Parent #1. Then you pick two more random individuals, keep the best one, and it becomes Parent #2. Those two parents then recombine to produce offspring which go into the child population. Repeat until you have enough offspring.

So you generate a child population using something like the following loop. (You may generate multiple offspring per set of parents...adjust the loop bounds to fit your situation).

for i = 1 to N 
    pick individual t1 at random from parent population
    pick individual t2 at random from parent population
    parent1 = winner(t1, t2)

    pick individual t1 at random from parent population
    pick individual t2 at random from parent population
    parent2 = winner(t1, t2)

    generate offspring from parent1, parent2
    mutate offspring
    evaluate offspring
    add offspring to child population
end for
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文