Papers › Attention, Learn to Solve Routing Problems!

Attention, Learn to Solve Routing Problems!

22 Mar 2018ICLR 2019 5arXiv:1803.08475archive 2025-07-28

Wouter Kool, Herke van Hoof, Max Welling

The recently presented idea to learn heuristics for combinatorial optimization problems is promising as it can save costly development. However, to push this idea towards practical implementation, we need better models and better ways of training. We contribute in both directions: we propose a model based on attention layers with benefits over the Pointer Network and we show how to train this model using REINFORCE with a simple baseline based on a deterministic greedy rollout, which we find is more efficient than using a value function. We significantly improve over recent learned heuristics for the Travelling Salesman Problem (TSP), getting close to optimal results for problems up to 100 nodes. With the same hyperparameters, we learn strong heuristics for two variants of the Vehicle Routing Problem (VRP), the Orienteering Problem (OP) and (a stochastic variant of) the Prize Collecting TSP (PCTSP), outperforming a wide range of baselines and getting results close to highly optimized and specialized algorithms.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 40 code samples harvested from 7 repositories linked to this paper: 27 ran (of which 0 constructed an object rather than computing a result; 16 with no instrument failure: 3 honoured, 0 violated, 13 with no contract checked; 11 where Syntology's instrument failed) · 13 unverified. Where Syntology's instrument failed: 8 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 5 samples from 1 repository, 3 ran (1 with no instrument failure; 2 where Syntology's instrument failed); community (archive-listed): 35 samples from 6 repositories, 24 ran (15 with no instrument failure; 9 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 2 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

15 repositories listed; official and paper-mentioned ones first.

wouterkool/attention-tsp officialmentioned in papermentioned on GitHubpytorchMITSyntology: 5 samples, 3 ran (2 instrument-failed) · 2 unverified report
wouterkool/attention-learn-to-route officialmentioned in paperpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Locker-based Truck-Drone Routing with Integrated Considerations of Pickups,... (arXiv:2606.30680; that paper's own run record: 10 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 1 honoured, 0 violated, 0 with no contract checked; 9 where Syntology's instrument failed) · 5 unverified); nothing checks that they implement this paper's method. report
LoganZhao1997/last_mile_challenge mentioned on GitHubpytorchSyntology: not harvested report
Rintarooo/VRP_DRL_MHA mentioned on GitHubpytorchMITSyntology: 5 samples, 4 ran (0 instrument-failed) · 1 unverified report
Rintarooo/VRP_MHA mentioned on GitHubtfMITSyntology: not harvested report
alexeypustynnikov/AM-VRP mentioned on GitHubtfSyntology: not harvested report
d-eremeev/ADM-VRP mentioned on GitHubtfSyntology: not harvested report
eharmonicminorperfect5thbelow/pytorch-attention-model-tsp mentioned on GitHubpytorchSyntology: 2 samples, 2 ran (1 instrument-failed) · 0 unverified report
ortec/euro-neurips-vrp-2022-quickstart mentioned on GitHubpytorchSyntology: not harvested report
raphaelavalos/attention_tsp_graph_net mentioned on GitHubtfSyntology: 3 samples, 3 ran (2 instrument-failed) · 0 unverified report
theresearchai/vehicle_routing_rl_2 mentioned on GitHubpytorchMITSyntology: 11 samples, 6 ran (6 instrument-failed) · 5 unverified report
tonydavis629/haucs mentioned on GitHubApache-2.0Syntology: 11 samples, 7 ran (0 instrument-failed) · 4 unverified report
yotaro-shimose/AttentionSolvesYourTSP mentioned on GitHubtfSyntology: not harvested report
ai4co/rl4co pytorchMITSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to RL4CO: an Extensive Reinforcement Learning for Combinatorial Optimization Benchmark (arXiv:2306.17100; that paper's own run record: 12 ran (of which 0 constructed an object rather than computing a result; 12 with no instrument failure: 0 honoured, 0 violated, 12 with no contract checked; 0 where Syntology's instrument failed) · 4 unverified); nothing checks that they implement this paper's method. report
wpwei/attention_to_route pytorchMITSyntology: 3 samples, 2 ran (0 instrument-failed) · 1 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

40 samples harvested: 27 ran (of which 0 constructed an object rather than computing a result; 16 with no instrument failure: 3 honoured, 0 violated, 13 with no contract checked; 11 where Syntology's instrument failed) · 13 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

3ran · honoured contract
8ran · our draft was wrong
3ran; the contract check could not run
13ran
13unverified

Licence: 5 of the 40 samples are pointer only, meaning Syntology does not serve that copy's text. For 2 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 7 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

wouterkool/attention-tsp official repository 5 samples, 3 ran (2 instrument-failed) · 2 unverified
generate_op_data generate_data.py ran · our draft was wrong MIT (permissive) · 82eaf1d494d4fc16 · report fixture: signature dataset_size:int/0/int, op_size:int/0/int, prize_type:str/0/str · returned list · level recorded 2026-09-22
generate_tsp_data in 7 papers generate_data.py ran · honoured contract fingerprinted MIT (permissive) · 50522f260eb670be · report fixture: signature dataset_size:int/0/int, tsp_size:int/0/int · returned list · level recorded 2026-09-22
generate_vrp_data in 7 papers generate_data.py ran · our draft was wrong MIT (permissive) · 3a929eede11222c2 · report fixture: signature dataset_size:int/0/int, vrp_size:int/0/int · returned list · level recorded 2026-09-22
solve_all_gurobi problems/tsp/tsp_gurobi.py unverified MIT (permissive) · c2eb1a9181034240 · report
solve_euclidian_tsp problems/tsp/tsp_gurobi.py unverified MIT (permissive) · c2edba20f4705527 · report
Rintarooo/VRP_DRL_MHA community (archive-listed) 5 samples, 4 ran (0 instrument-failed) · 1 unverified
data_from_txt PyTorch/data.py ran MIT (permissive) · 8daaa059e9c3cb2d · report fixture: signature path:str/0/str · returned tuple · level recorded 2026-09-26
generate_data in 66 papers PyTorch/data.py ran MIT (permissive) · a58fa4a05eb041d8 · report fixture: signature device:str/0/str, n_samples:int/0/int, n_customer:int/0/int, seed:int/0/int · returned tuple · level recorded 2026-09-26
get_dist in 12 papers PyTorch/dist_matrix.py ran fingerprinted MIT (permissive) · 25f758eab8954cab · report fixture: signature n1:Tensor/1/float, n2:Tensor/1/float · returned Tensor · level recorded 2026-09-26
get_dist_matrix PyTorch/dist_matrix.py ran MIT (permissive) · f8bd592f10d20c70 · report fixture: signature points:list/1/list, digit:int/0/int · returned list · level recorded 2026-09-26
load_pkl in 46 papers PyTorch/config.py unverified MIT (permissive) · b71b6ddb1c0ba51a · report
eharmonicminorperfect5thbelow/pytorch-attention-model-tsp community (archive-listed) 2 samples, 2 ran (1 instrument-failed) · 0 unverified
evaluate in 514 papers tsp.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant MIT (permissive) · 92bf6e766294e2b3 · report fixture: signature instances:Tensor/3/float, solutions:Tensor/2/int · returned Tensor · level recorded 2026-09-22
generate_instances tsp.py ran · honoured contract fingerprinted MIT (permissive) · 7c1af2ae74b68db5 · report fixture: signature size:int/0/int, num:int/0/int · returned Tensor · level recorded 2026-09-22
raphaelavalos/attention_tsp_graph_net community (archive-listed) 3 samples, 3 ran (2 instrument-failed) · 0 unverified
get_device in 101 papers train_single_gpu.py ran · our draft was wrong GPL-3.0 (copyleft) · pointer only · 08cb493b027671f6 · report fixture: signature args:Args/0/? · returned str · level recorded 2026-09-22
get_rollout_np train_single_gpu.py ran · honoured contract GPL-3.0 (copyleft) · pointer only · ddda4a28f60dd187 · report fixture: signature args:Args/0/?, conf:Conf/0/? · returned ndarray · level recorded 2026-09-22
get_validation_np train_single_gpu.py ran · our draft was wrong GPL-3.0 (copyleft) · pointer only · fd794d93df5fe1c0 · report fixture: signature args:Args/0/?, conf:Config/0/? · returned tuple · level recorded 2026-09-22
theresearchai/vehicle_routing_rl_2 community (archive-listed) 11 samples, 6 ran (6 instrument-failed) · 5 unverified
check_extension in 8 papers utils/data_utils.py ran · our draft was wrong fingerprinted MIT (permissive) · 01df1926cf07ac89 · report fixture: signature filename:str/0/str · returned str · level recorded 2026-09-22
load_dataset in 276 papers utils/data_utils.py ran · our draft was wrong MIT (permissive) · 69062811f34d8ff6 · report fixture: signature filename:str/0/str · returned dict · level recorded 2026-09-24
mask_bool2long utils/boolmask.py ran; the contract check could not run (RAISES) MIT (permissive) · 454003b7383dce9f · report fixture: signature mask:Tensor/2/int · returned Tensor · level recorded 2026-09-24
mask_long2bool utils/boolmask.py ran; the contract check could not run (RAISES) MIT (permissive) · 10638ccfaa13fb59 · report fixture: signature mask:Tensor/2/int, n:NoneType/0/? · returned Tensor · level recorded 2026-09-24
mask_long_scatter utils/boolmask.py ran · our draft was wrong MIT (permissive) · 1a3bb2f0ebdf9a4e · report fixture: signature mask:Tensor/3/int, values:Tensor/2/int, check_unset:bool/0/bool · returned Tensor · level recorded 2026-09-24
move_to in 15 papers utils/functions.py ran · our draft was wrong MIT (permissive) here; the stored copy is pointer only · 107d6628712f1a21 · report fixture: signature var:dict/0/?, device:str/0/str · returned dict · level recorded 2026-09-22
backtrack in 7 papers utils/beam_search.py unverified MIT (permissive) · 9d5b8d4a73d01c19 · report
get_beam_search_results utils/beam_search.py unverified MIT (permissive) · be9c547a8e748da5 · report
get_options in 25 papers options.py unverified MIT (permissive) · 0f6f8675d8280c4f · report
load_problem in 6 papers utils/functions.py unverified MIT (permissive) · 5deb1f5b2269293b · report
torch_load_cpu in 6 papers utils/functions.py unverified MIT (permissive) here; the stored copy is pointer only · 0538f709044ed305 · report
tonydavis629/haucs community (archive-listed) 11 samples, 7 ran (0 instrument-failed) · 4 unverified
CRC8_table_lookup haucs/mission_planner/splashdrone.py ran Apache-2.0 (permissive) · f25ac4888d367dac · report fixture: signature buffer:list/1/int, offset:int/0/int · returned int · level recorded 2026-09-26
coord2arr haucs/utils/utils.py ran fingerprinted Apache-2.0 (permissive) · 1004553fb8c91911 · report fixture: signature coords:ndarray/2/float · returned tuple · level recorded 2026-09-26
load_data_model haucs/solvers/googleORsolver.py ran Apache-2.0 (permissive) · bfdb082b8b60d5ae · report fixture: signature filename:str/0/str · returned dict · level recorded 2026-09-26
load_files in 10 papers haucs/mission_planner/splashdrone.py ran fingerprinted Apache-2.0 (permissive) · 222a077ac0dc342e · report fixture: signature save_dir:str/0/str, route_name:str/0/str · returned list · level recorded 2026-09-26
load_pts haucs/mission_planner/splashdrone.py ran Apache-2.0 (permissive) · 7432af444f223046 · report fixture: signature filename:str/0/str · returned list · level recorded 2026-09-26
normalize in 638 papers
census: 70 implementations from 82 papers, 51 distinct outputs across 11 buckets, one shared input per bucket
haucs/utils/utils.py ran fingerprinted Apache-2.0 (permissive) · c33c1c373528994c · report fixture: signature x:ndarray/1/float · returned ndarray · level recorded 2026-09-26
processGPS mobile_app/datalogger.py ran Apache-2.0 (permissive) · 3855f5b5d541ad04 · report fixture: signature message:list/1/str · returned tuple · level recorded 2026-09-26
gen_results haucs/solvers/googleORsolver.py unverified Apache-2.0 (permissive) · 82c1f4dc5f78132f · report
init_file mobile_app/datalogger.py unverified Apache-2.0 (permissive) · 646e8f569fdfb4c8 · report
init_file basestation/pc_basestation/datalogger.py unverified Apache-2.0 (permissive) · 63a2c7b484c8eb97 · report
save_norm_coords haucs/utils/utils.py unverified Apache-2.0 (permissive) · cf9bc36f5580661b · report
wpwei/attention_to_route community (archive-listed) 3 samples, 2 ran (0 instrument-failed) · 1 unverified
TSP problems.py ran MIT (permissive) · 64903ec0e6fee27f · report fixture: signature graphs:Tensor/3/float, permutations:Tensor/2/int · returned Tensor · level recorded 2026-09-26
load_dataset in 276 papers utils.py ran MIT (permissive) · c43c60dd79880c30 · report fixture: signature filename:str/0/str · returned ndarray · level recorded 2026-09-26
lkh_solve_tsp utils.py unverified MIT (permissive) · a9dc1cf1047bd89e · report

Tasks

Combinatorial Optimization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Introduced by this paper: AM

AMLSTMPointer NetworkREINFORCESigmoid ActivationSoftmaxTanh Activation

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections