在比赛选择中选择家长
我正在写一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太清楚你建议的替代方案之间的差异是什么意思,但一般来说,它的工作方式是你随机选择两个人,保留最好的一个,这将成为父母#1。然后你再随机挑选两个个体,保留最好的一个,它就成为“Parent #2”。然后,这两个父母重新结合,产生后代,这些后代进入儿童群体。重复这个过程,直到有足够的后代。
因此,您可以使用类似以下循环的方式生成子群体。 (您可以为每组父母生成多个后代...调整循环边界以适应您的情况)。
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).