遗传算法的每一代应该有多少个单元?

发布于 07-16 07:50 字数 109 浏览 9 评论 0原文

我正在开发一款 Roguelike 游戏,并使用 GA 来生成关卡。 我的问题是,我的每一代 GA 应该有多少个级别? 而且,它应该有几代? 是每一代有几个级别更好,还是有很多代更好,或者反之亦然?

I am working on a roguelike and am using a GA to generate levels. My question is, how many levels should be in each generation of my GA? And, how many generations should it have? It it better to have a few levels in each generation, with many generations, or the other way around?

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

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

发布评论

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

评论(2

吲‖鸣2024-07-23 07:50:00

对于这类事情确实没有硬性规定——大多数实验都喜欢在群体中至少使用至少 200 名成员,然后扩展到数百万甚至更多。 世代数通常在 100 至 10,000 范围内。 一般来说,为了回答你的最后一个问题,最好在种群中拥有大量成员,以便“晚熟”基因在种群中停留足够长的时间以成熟,然后使用较少的代数。

但实际上,这些都不是重要的事情。 任何遗传算法最关键的部分是适应度函数。 如果你没有一个像样的适应度函数来准确评估你认为的“好”水平或“坏”水平,那么无论你使用多少代,你都不会得到有趣的结果,或者你们的人口有多少:)

There really isn't a hard and fast rule for this type of thing - most experiments like to use at least 200 members in a population at the barest minimum, scaling up to millions or more. The number of generations is usually in the 100 to 10,000 range. In general, to answer your final question, it's better to have lots of members in the population so that "late-bloomer" genes stay in a population long enough to mature, and then use a smaller number of generations.

But really, these aren't the important thing. The most critical part of any GA is the fitness function. If you don't have a decent fitness function that accurately evaluates what you consider to be a "good" level or a "bad" level, you're not going to end up with interesting results no matter how many generations you use, or how big your population is :)

橘虞初梦2024-07-23 07:50:00

正如迈克所说,你需要尝试不同的数字。 如果你的人口众多,你需要确保有良好的选择功能。 由于人口众多,很容易导致 GA 过早收敛到“不太好”的答案。

Just as Mike said, you need to try different numbers. If you have a large population, you need to make sure to have a good selection function. With a large population, it is very easy to cause the GA to converge to a "not so good" answer early on.

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