Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Please provide an unique answer and do not copy material from the internet. Note that the code must be written in matlab

I do not have any test cases.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting IFRS

Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield

3rd edition

1119372933, 978-1119372936

Students also viewed these Finance questions