Write a matlab code that does the following coordinates [2,1; 3,1;4,5;2,3; 4,3] (this is just an example
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a matlab code that does the following coordinates [2,1; 3,1;4,5;2,3; 4,3] (this is just an example and the code must be able to handle all such distances)The code should be a function that takes the cityLocations as input and calculates the the tour with the nearest neighbor tour created by chosing random start node and moves to the nearest neighbour of univsited nodes. This distance should be the euclidean distance. It should not calculate the distance to itself so no zeros should be generated while calculatating any distances. After the end of a tour it should be returned to the starting city so also this distance should be caculated. So it is the total distance for this tour that should be returned by the function.
Related Book For
Posted Date: