Hello, I need help in path planning from a Hamiltonian matrix with a condition that I visit each point only once with starting point known.
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
mat=[0,10,8,7,7;10,0,10,5,6;8,10,0,8,9;7,5,8,0,6;7,6,9,6,0] % C is a hamiltonian matrix containing relative distances
In this case the points are A,B,C,D,E and let A be the starting point. Now, from A, I can move to either D or E. So two different paths are possible. How do I write algorithm for this such that I compare the travelling distance for each path and choose with minimum travelling distance? I have code for the matrix with unique elements, but need help when there are more than 1 path is possible.
Note: the number of visiting points is a variable and I chose only 5 i.e A,B,C,D,E just to explain.
10 commentaires
Torsten
le 2 Mai 2018
Try this code:
https://de.mathworks.com/matlabcentral/fileexchange/13680-traveling-salesman-problem-genetic-algorithm
Best wishes
Torsten.
Réponses (0)
Voir également
Catégories
En savoir plus sur Traveling Salesman (TSP) dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!