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 次查看(过去 30 天)
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 个评论
Torsten
Torsten 2018-5-2
Try this code:
https://de.mathworks.com/matlabcentral/fileexchange/13680-traveling-salesman-problem-genetic-algorithm
Best wishes
Torsten.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Traveling Salesman (TSP) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by