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
2018-5-2
Try this code:
https://de.mathworks.com/matlabcentral/fileexchange/13680-traveling-salesman-problem-genetic-algorithm
Best wishes
Torsten.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!