NEROX/Travelling Salesman Problem
Problem Type

Travelling Salesman Problem

Find the shortest tour through any number of cities. GPU-accelerated for production logistics at any scale.

< 0.5%
avg. gap to optimal on TSPLIB instances
50,000
cities solved in a single GPU pass
8s
median solve time for 500-city TSP
3.8×
faster than leading open-source solvers

What is the TSP?

The Travelling Salesman Problem asks: given a list of cities and distances between them, what is the shortest route that visits each city exactly once and returns to the origin? TSP is NP-hard — no polynomial-time exact algorithm exists for arbitrary instances. At scale (hundreds of cities), heuristic solvers are the only practical option.

TSP appears in logistics route planning, circuit board drilling, DNA sequencing, telescope scheduling, and warehouse pick-path optimization. Even a 1% improvement in tour length translates directly to fuel savings and delivery time at scale.

Solving TSP with NEROX

python
import nerox
import numpy as np

# Build or load your distance matrix (n x n symmetric, zero diagonal)
n = 200
rng = np.random.default_rng(42)
coords = rng.random((n, 2)) * 1000
dist = np.linalg.norm(coords[:, None] - coords[None, :], axis=-1)

client = nerox.Client()
job = client.optimize.tsp(
    distance_matrix=dist,
    solver="gpu",          # gpu | tabu | hybrid
    n_runs=512,            # independent annealing chains
    time_limit_s=60,       # stop after 60 wall-clock seconds
)

result = job.wait()
print(f"Tour length: {result.objective:.1f}")
print(f"Tour order: {result.solution}")    # list of city indices

Large-scale TSP (1,000+ cities)

For instances over ~2,000 cities, switch to the Hybrid Solver which automatically decomposes the problem into GPU-sized subproblems and reconstructs the global tour.

python
job = client.optimize.tsp(
    distance_matrix=dist,
    solver="hybrid",
    n_passes=3,            # number of decomposition rounds
)
result = job.wait(timeout=600)

Streaming real-time progress

For interactive applications, stream solver progress as the GPU annealer improves the tour. Each event includes the current best tour length so you can update a live map.

python
for event in job.stream():
    print(f"Iter {event.iteration:6d}  best={event.best_energy:.1f}")

Asymmetric TSP

Supply a non-symmetric distance matrix (where distance from A→B ≠ B→A) for problems like directed road networks with one-way streets. NEROX handles asymmetric instances natively — no reformulation needed.

Recommended solver by instance size

≤ 500 citiesGPU Annealing< 10s
500 – 5,000 citiesGPU Annealing (more runs)< 2 min
5,000 – 50,000 citiesHybrid Solver2–10 min
50,000+ citiesHybrid + Multi-GPUContact us