Fast 2-Opt Travelling Salesman Problem (TSP)
- x: An N-by-M matrix representing the coordinates of N-nodes (cities) in M-dimensions.
- iter (optional): Iteration count, specified as a scalar or a vector. If scalar, it represents the number of iterations. If vector, the first element specifies the number of attempts. If (any) negative, the non-symmetric TSP is solved. Default: max(10, ceil(n/10))
- N/A (optional): If passed, flag to query for the longest possible route. Default: none
- path: A vector containing the indices of the nodes in the order they are visited in the optimized path.
- dist: The total distance of the computed path.
Citation pour cette source
Moreno, M. (2025). Fast 2-Opt Travelling Salesman Problem (TSP) (https://fr.mathworks.com/matlabcentral/fileexchange/169161-fast-2-opt-travelling-salesman-problem-tsp), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Plateformes compatibles
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
| Version | Publié le | Notes de version | |
|---|---|---|---|
| 1.0.9 | Final version: optimal 2-opt implementation given an iteration number |
||
| 1.0.8 | Problem-based default iteration count
|
||
| 1.0.7 | - Added non-symmetric problem (TSP2OPT1)
|
||
| 1.0.6 | Fully-optimized code via test functions. |
||
| 1.0.5 | Separated first segment from the FOR loop to accelerate the calculation.
|
||
| 1.0.4 | Corrected a small error in the final distance calculation |
||
| 1.0.3 | Increased speed of the function and grouped inputs more intuitively. |
||
| 1.0.2 | Logo change. |
||
| 1.0.1 | Includes 'worst' possible solution upon an additional input parameter call |
||
| 1.0.0 |
