teeline · algorithms/2opt
2-opt Local Search
2-opt iteratively improves a tour by removing two edges and reconnecting the resulting segments in the only other valid way — reversing the segment between the two removed edges. Each pass scans all edge pairs and applies the best-improving swap; the algorithm stops when no improving swap exists (local optimum).
tour edge candidate (remove) candidate (add) removed new edge
Click Step to scan for improving swaps
Cost history
pass
0
swaps
0
best cost
2018
step
0
Scenarios