建议 GA 操作员解决 TSP 问题?
我正在构建一种遗传算法来解决旅行商问题。不幸的是,我达到的峰值可以维持一千多代,然后才突变出来并获得更好的结果。在这种情况下,哪些交叉和变异算子通常表现良好?
I'm building a genetic algorithm to tackle the traveling salesman problem. Unfortunately, I hit peaks that can sustain for over a thousand generations before mutating out of them and getting better results. What crossover and mutation operators generally do well in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有序突变和有序交叉(参见本文)。标准变异和交叉操作通常会导致无效的解决方案(即路线中重复和/或丢失城市)。
最近有一个类似的问题。
我有 一个使用有序交叉和突变实现 TSP 的 Java 小程序,如果您有兴趣比较您的实现的性能。
Ordered mutation and ordered cross-over (see this article). Standard mutation and cross-over operations will usually result in invalid solutions (i.e. duplicate and/or missing cities in a route).
There was a similar question recently.
I have a Java applet that implements the TSP using ordered cross-over and mutation, if you are interested in comparing the performance of your implementation.
如果您的问题是峰值保持超过一千代,那么问题可能不在于交叉和变异算子。你可能没有向你的群体引入或保留足够的变异:我会检查一代到下一代的交叉、突变和幸存者的比例,并可能提高突变的比例。
If your problem is that peaks remain for over one thousand generations, then the problem might not be with the crossover and mutation operators. You might not be introducing or keeping enough variation to your population: I would examine the proportions of crossovers, of mutations, and of survivors from one generation to the next, and possibly raise the proportion of mutations.
你能澄清一下吗
您可以检查交叉算子,以确保子染色体中没有重复节点。其中的几个交叉算子是顺序交叉 (OX) 和边缘交叉算子。
突变可以是就像简单地交换单个染色体中的两个位置一样简单,
因为您已经标记了“python”,请查看 Pyevolve< /a>,它还有一个 TSP 示例。
Could you please clarify
You could check on the crossover operators, which make sure that you have no repeating nodes in the child chromosomes. Couple of those crossover operators are the Order Crossover (OX) and the Edge Crossover operators.
Mutation can be as simple as simply swapping two positions in a single chromosome.
BTW, since you have tagged "python", take a look at Pyevolve, it also has a TSP example.