THERMO LAB STATION 09 / 16 EXP 9 · QUBO

The Travelling Salesperson — ten cities, one loop

The TSP encoded as an N×N permutation-matrix QUBO. Chromatic block Gibbs updates resolve row and column constraints while shrinking the tour. Below, that sampler runs live in your browser: watch the loop over ten cities anneal from the naive ordering down toward the proven optimum.

Live anneal — the tour

—
current tour length
Loading the field…

Published result · Exp 9

100%

optimal tour — the sampler found the provably shortest loop

Annealed tour length6.296
Naive tour length17.986
Runtime20.110 s

simulated benchmark result, results may vary (not customer results)

Sampler controls

Drag the temperature slider to hold the sampler at that heat and keep sampling — hot tours thrash, cold tours freeze. You can also drag any city on the map; the optimum is recomputed as you let go.

Permutation matrix — the QUBO state

Rows are stops in the tour, columns are cities. Exactly one cell is lit per row and per column — that is the permutation constraint the QUBO enforces. Rows are tinted by chromatic block; the outlined pair is the block updating this sweep.

Live readouts

Best tour found—
Proven optimum (Held–Karp)—
Current tour gap to optimum—
Naive tour (id order)—
Temperature—
Sweep0
Block updatingB1
Move acceptance—

Tour length over sweeps

current length proven optimum naive start

How the QUBO holds a tour together

The tour is written as a 10×10 binary matrix: cell (stop, city) is 1 when that city is visited at that stop. A valid tour needs exactly one 1 in every row and every column, so the QUBO adds a heavy penalty for any row or column that breaks the rule, and a cost term that sums the distance of each leg the matrix selects.

Chromatic block Gibbs updates split the ten stop-positions into five colored blocks. A sweep freezes four blocks and resamples the fifth, so row and column constraints are repaired block by block instead of being fought all at once — and because every proposed move is a swap inside the permutation, the matrix never stops being a legal tour while the distance term pulls it shorter.

The demo above runs that process on the cities in front of you. Its optimum is not assumed — it is proven by exhaustive Held–Karp dynamic programming over all orderings of these ten cities, so the gap readout is exact.

Run the benchmark

$uv run thrml-bench run --exp 9

Experiment 9 of the thermo benchmark suite — the travelling salesperson, encoded as a permutation-matrix QUBO and solved with chromatic block Gibbs sampling.