Python Code of the 2-Opt Algorithm for Solving the Travelling Salesman Problems (TSP)

preview_player
Показать описание
In this video, I’m going to show you a Python code of the 2-Opt Algorithm for solving the traveling salesman problems (TSP). The 2-Opt Algorithm is quite simple but very effective for solving TSP. It is very simple to modify this Python code to solve new TSP instances.

The 2-opt algorithm is a simple local search algorithm for solving the traveling salesman problem. The 2-opt algorithm was first proposed by Croes in 1958, although the basic move had already been suggested by Flood. The main idea behind it is to take a route that crosses over itself and reorder it. A complete 2-opt local search will compare every possible valid combination of the swapping mechanism. This technique can be applied to the travelling salesman problem as well as many related problems. These include the vehicle routing problem (VRP) as well as the capacitated VRP, which require minor modification of the algorithm.

HERE ARE 6 LISTS OF MY VIDEOS YOU MAY BE INTERESTED IN:
1. Optimization Using Genetic Algorithm:
2. Optimization Using Particle Swarm Optimization:
3. Optimization Using Simulated Annealing Algorithm:
4. Optimization Using Optimization Solvers:
5. Optimization Using Matlab:
6. Optimization Using Python:

If you have any questions, please let me know by leaving a comment below.

Free Music from YouTube Audio Library.
Thank you for watching - I really appreciate it :)
All of my videos on the topic of Solving Optimization Problems: #MyPythonCode, #SolvingOptimizationProblems
© Copyright by Solving Optimization Problems. ☞ Do not Reup
Рекомендации по теме
Комментарии
Автор

Sir how to used in multiple traveling salesman problem using NSGA-2 in python.

theWorldOfIss
Автор

Sir multiple traveling salesman problem using NSGA-2 in python.

theWorldOfIss
Автор

Great video! Any chance of a MATLAB tutorial for NSGA II code? Many thanks

EliteShadowLeo
Автор

how to solve this problem using greedy search algorithms

mhassan
Автор

Thanks for the great explanation. I'm doing a research on this issue and I've got stuck in implementation of 2-opt in my ga for solving TSP. I would appreciate if you can help me with applying this 2-opt operator for my matlab code. Thanks in advance.

mahyarteymournezhad
Автор

Works until it doesn’t. I can come up with toy problems that aren’t optimal but aren’t caught using 2-opt (imagine someone drawing a path resembling a hair comb, for example).

I personally prefer a greedy algorithm as a start followed by simulated annealing. Maybe this could be used if there are thousands on points, and after trying other algorithms as a minor final tweak?

colonelgraff