teeline · algorithms/3opt
3-opt Local Search
3-opt removes three edges and reconnects the three resulting segments in one of seven ways (2-opt only has one). Cases 1–3 reverse segments; cases 4–7 swap segments — the moves 2-opt cannot express. Each pass scans all triples and applies the single best-improving reconnection, repeating until no triple yields an improvement.
Reconnection patterns
1
2
3
4
5
6
7
tour edge removed new edge chosen pattern
Click Step to scan triples for the best 3-opt reconnection
Cost over passes
pass
0
swaps
0
best cost
1367
distance
1367
last Δ
—
step
0
Scenarios