Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use python please and try to add comments when possible For now, let's just think about how to set up such a problem. One of
Use python please and try to add comments when possible
For now, let's just think about how to set up such a problem. One of the most challenging aspects of the Traveling Salesperson Problem is that there are many steps involved and you will need to break it down into pieces. For now, here are your tasks: Write a function that takes as input the number of cities, N. For now we will not use real cities, so within the function create the locations of N cities using random numbers. For convenience, you can just assume that the cities fall on a map in the rangex E [0, 1] and y E [0,1. Every city will have a random (x, y) location in that range Return from the function the coordinates of the N cities as two arrays (x values and y values) Call the function and store those returned array in some variables. Then, Make a plot to be sure it is working. You should get something that looks like this (with points in different locations, of course): 10 0.8 0.6 0.41 0.2 0.0 0.0 020.4 0.6 0.8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started