Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
The 2-column vector contains cities' coordinates. The algorithm generates the optimal path to visit all the cities exactly once, and return to the starting city.
Do for all the cities:
1. select a city as current city.
2. find out the shortest edge connecting the current city and an unvisited city.
3. set the new city as current city.
4. mark the previous current city as visited.
5. if all the cities are visited, then terminate.
6. Go to step 2.
The algorithm has its limitations, and based on the cities' distribution on the map it may or may not give the optimal solution.
It resolves the problem of the equally distant cities, that some other submitted files had.
Zitieren als
ajevtic (2026). Nearest Neighbor algorithm for the Travelling Salesman Problem (https://de.mathworks.com/matlabcentral/fileexchange/25542-nearest-neighbor-algorithm-for-the-travelling-salesman-problem), MATLAB Central File Exchange. Abgerufen .
Allgemeine Informationen
- Version 1.1.0.0 (2,51 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.1.0.0 | The algoritm implementation logic added in the description. |
||
| 1.0.0.0 |
