如何避免遗传算法中的无效搜索空间?
我正在为一个学校项目开发一个 GA,我注意到在评估我的适应度函数时,个体相当于它的逆函数。
例如,集合 (1, 1, -1, 1)
相当于 (-1, -1, 1, -1)
。为了缩小搜索空间并更有效地找到解决方案,如何避免在搜索空间的后半部分中进行交叉搜索?
I am developing a GA for a school project and I've noticed that upon evaluating my functions for fitness, an individual is equivalent to its inverse.
For example, the set (1, 1, -1, 1)
is equivalent to (-1, -1, 1, -1)
. To shrink my search space and reach a solution more efficiently, how can I avoid my crossovers from searching in this second half of the search space?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将空间减半。要求第一个元素为非负数,那么如果有 (x_1, .. , x_n) 及其逆元素 (-x_1, .. , -x_n) ,则搜索空间中只有一个元素。 (如果 x_1 = 0 它们是相同的)
顺便说一句,你要解决的问题是什么?
Cut the space in half. Require the first element to be non-negative, then if you have (x_1, .. , x_n) and its inverse (-x_1, .. , -x_n) only one will be in the search space. (if x_1 = 0 they are the same)
BTW, what is the problem you are solving?
尝试重写您的健身函数,以将权重适当地分配给个人 - 不确定您要解决的问题或如何重新分配权重。请记住,最适合的个体应该在池中,并且更有可能被选择进行交叉 - 您不希望池中充满了与良好解决方案具有相同适应度的假人,这违背了遗传算法的目的
Try to re-write your fitness function to assign weights appropriately to individuals - not sure on the problem you're trying to solve or how weight can be re-assigned. Remember, fittest individuals should be in the pool and more likely to be selected for crossover - you don't want a pool full of dummys that have the same fitness as good solutions that defeats the purpose of the genetic algorithm
它的计算成本很高,但类似的东西应该可以完成这项工作。忽略第一代,对于每一代> = 2:
如果通过交叉/变异产生的子代是逆的,则忽略它并生成另一个子代,直到它是“好”子代。
Its computationally expensive, but something like this should do the job. Ignoring the 1st generation, for every generation >=2:
If the children produced via crossover/mutation is an inverse, ignore it and generate another child till it is a "good" child.