Visit every waypoint
Find the exact shortest visit order through every waypoint in a small user-supplied distance matrix.
The example value has been entered. Check it immediately or change the value.
Input is processed in the browser. Refreshing returns a sample value.
Instructions and example
Dynamic programming stores the minimum cost for each visited subset and final waypoint, then backtracks the route.
The default optimum is 1→2→3 with distance 2+3=5; returning to the start gives total 14.
Use 2–12 waypoints, integer distances 0–1,000,000 and diagonal 0. Always starts at waypoint 1; no traffic, roads or maps are queried. Decimal results display at most 12 significant digits.
Frequently asked questions
Can outward and return distances differ?
Yes. Asymmetric matrices are supported; each cell is travel from its row to its column.
Does the route revisit intermediate waypoints?
No. Each listed waypoint is visited once; only return mode repeats the starting point at the end.
Calculation criteria and reference materials
- Google: travelling salesperson
The optimization problem of visiting every waypoint.
Verification of calculation criteria: · Calculation·verification principles · Report errors