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!