New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New heuristic for the traveling salesman problem #1104
Comments
We welcome new code contributions :). Just a few pointers: an algorithmic contribution should be backed by a scientific paper/book, i.e. not a home-brew solution. Moreover, if we already have some algorithm for the particular problem, in this case TSP, it would be really helpful if you could show that the new code contribution improves upon the existing code, e.g. the new algorithm can be faster, or can be better in certain use cases. Note that the references you are referring to are quite old. This might not necessarily be bad, but we prefer to have state-of-the-art algorithms. |
Thanks so much for the answer. I did a little bit of homework and compared the implementation of the farthest-insertion (FI) with other heuristics implemented in JGrapht for the TSP like:
I tried with a couple of instances of 1000 and 2000 vertices generated in a 2D Euclidean space with a uniform random distribution. Regarding running times, the FI was faster than NI and slower than NN and GH. Regarding the quality of solutions, FI computed better tours than the others. ReferencesSkiena, S.-S. (2020). The Algorithm Design Manual (3rd ed.). Springer International Publishing. |
UpdateHi guys, I have been working on the implementation of the farthest-insertion heuristic for the jgrapht library. In fact, by checking implementations of other algorithms implemented in jgrapht, I took some ideas and I think I was able to improve considerably the performance of the farthest-insertion algorithm. I performed experimentation and comparison with other algorithms implemented in jgrapht for the TSP. I used a couple of instances of 1000 and 2000 vertices generated in a 2D Euclidean space with a uniform random distribution. The following table shows the results. Instance with 1000 vertices.
Instance with 2000 vertices.
The fitness column shows the length of the tour found of each algorithm. We can see that, at least for these instances, the farthest-insertion outperforms the other algorithms in terms of quality solutions and running time. |
Issue
JGrapht contains implementations of some heuristic algorithms for the traveling salesman problem (TSP), like nearest-neighbor and nearest-insertion. However, there are many other heuristic algorithms that may be useful to include in JGrapht for the TSP. Such is the case of the furthest-insertion heuristic. This heuristic provides an approximation factor of log n and according to some references listed below, this one provides good practical results compared with other heuristics like nearest-insertion and cheapest-insertion.
Proposal
Currently, I am working on an academic research project as part of my postgraduate studies and I am using JGrapht. I am considering using the furthest-insertion algorithm, so I am working on an implementation of this heuristic and it would be nice to include it as part of the catalog of TSP heuristics in JGrapht.
I believe I can use some ideas of the heuristics algorithms for the TSP that are already implemented in JGrapht. What do you think about it?
For more details about the furthest-insertion and other heuristics please check the references.
References
W. J. Cook, In Pursuit of the Traveling Salesman. New Jersey: Princeton
University Press, 1 ed., 2012.
D. Rosenkrantz, R. Stearns, and P. II, \An analysis of several heuristics for the
traveling salesman problem," SIAM J. Comput., vol. 6, pp. 563{581, 09 1977.
The text was updated successfully, but these errors were encountered: