How can I solve this problem in Programming?

1 次查看(过去 30 天)
The problem: A traveling salesman wants to visit several cities, and route distances between cities are known. Consider the problem, starting and ending in a given city, determining the route to be taken by the traveling salesman who, once passing through the remaining cities, minimizes the total distance to be traveled.
For this it is necessary to create a function that uses the neighbor heuristic which consists of, at each moment, choosing the next city to visit that, among the cities not yet visited, is closest to the city where you are. For this heuristic is used in the traveling salesman problem, in the end the route of the last city visited to the city of origin.
For this it is necessary to develop a function called 'pcv_vmp' with an implementation of its algorithm.
I'm having trouble doing this function because I don't know how to get started. Someone can help me?
  1 个评论
Steven Lord
Steven Lord 2019-11-18
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by