SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.11677 · IJCAI · 2024

Cross-Problem Learning for Solving Vehicle Routing Problems

Zhiguang Cao, Wen Song, Yaoxin Wu, Yingqian Zhang, Zhuoyi Lin, Bangjian Zhou, Senthilnath Jayavelu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 2 failures of our instrument; 3 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2404.11677.json · badge: /api/ran/2404.11677.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
zhuoyi-lin/cross_problem_learning marked official in Papers with Code
Papers with Code archive
7 ran · 3 no recorded run
FunctionStatusWhere it lives
Adapter Ran
ran on a synthesized input · constructed an object; no result was computed
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("cac5ff2f23d7f0b9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Adapter: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    'embed_dim': 8,
    'activation_func': 'tanh'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Adapter — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Adapter output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AttentionModelFixed Ran
ran on a synthesized input · constructed an object; no result was computed
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("0b295d1d82504304")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AttentionModelFixed: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors with distinct dimensions to test the __getitem__ indexing
batch_size = 2
node_dim = 4
glimpse_dim = 3
num_nodes = 5

# node_embeddings: [batch_size, num_nodes, node_dim]
node_embeddings = torch.randn(batch_size, num_nodes, node_dim)

# context_node_projected: [batch_size, node_dim]
context_node_projected = torch.randn(batch_size, node_dim)

# glimpse_key: [num_nodes, batch_size, glimpse_dim]
glimpse_key = torch.randn(num_nodes, batch_size, glimpse_dim)

# glimpse_val: [num_nodes, batch_size, glimpse_dim]
glimpse_val = torch.randn(num_nodes, batch_size, glimpse_dim)

# logit_key: [batch_size, node_dim]
logit_key = torch.randn(batch_size, node_dim)

ARGS = {
    "node_embeddings": node_embeddings,
    "context_node_projected": context_node_projected,
    "glimpse_key": glimpse_key,
    "glimpse_val": glimpse_val,
    "logit_key": logit_key,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttentionModelFixed — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MultiHeadAttention Ran
ran on a synthesized input · constructed an object; no result was computed
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("95828c36546886bb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MultiHeadAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
import math
import numpy as np

torch.manual_seed(0)

# Setup parameters for MultiHeadAttention
ARGS = {
    'n_heads': 2,
    'input_dim': 4,
    'embed_dim': 8,
    'val_dim': 4,
    'key_dim': 4,
    'finetune_ways': 'normal',
    'rank': 2,
}

# Create the model to test the forward pass
model = nn.Module()
mha = nn.Module()

# Instantiate the attention module to verify it works
attention_module = __import__('torch').nn.Module()

# Create test inputs for forward pass
batch_size = 2
n_query = 3
graph_size = 5
input_dim = 4

q = torch.randn(batch_size, n_query, input_dim)
h = torch.randn(batch_size, graph_size, input_dim)
mask = torch.zeros(batch_size, n_query, graph_size, dtype=torch.bool)
mask[0, 0, 0] = True  # Mark one position as masked

# Test execution would be:
# attention = MultiHeadAttention(**ARGS)
# output = attention(q, h, mask)
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MultiHeadAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MultiHeadAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Normalization Ran
ran on a synthesized input · constructed an object; no result was computed
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("d7486b45b2dfeb02")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Normalization: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math
from torch import nn

torch.manual_seed(0)

ARGS = {
    'embed_dim': 4,
    'normalization': 'batch'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Normalization — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Normalization output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SkipConnection Ran
ran on a synthesized input · constructed an object; no result was computed
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("8101e9e48232516f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SkipConnection: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple module that can be used in SkipConnection
# The module must accept an input tensor and return a tensor of the same shape
class SimpleLinearModule(nn.Module):
    def __init__(self, dim):
        super(SimpleLinearModule, self).__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x):
        return self.linear(x)

# Build a module with input/output dimension 4
module = SimpleLinearModule(dim=4)

ARGS = {
    'module': module
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SkipConnection — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SkipConnection output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
do_batch_rep Ran
ran; our contract draft was wrong, not the code
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("e9cc8485dbd6af94")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (8, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function do_batch_rep handles dict, list, tuple recursively,
# and for tensors it adds a batch dimension and expands it.
# Let's create test arguments:

# Test with a simple tensor
v_tensor = torch.randn(4, 3)

# Test with n (number of repetitions)
n = 2

# We can also test the recursive cases with dict, list, tuple
v_dict = {
    'a': torch.randn(5, 2),
    'b': torch.randn(3, 4)
}

v_list = [
    torch.randn(6, 2),
    torch.randn(2, 3)
]

v_tuple = (
    torch.randn(4, 5),
    torch.randn(3, 2)
)

# For the basic case, use a simple tensor
ARGS = {
    'v': torch.randn(4, 3),
    'n': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (8, 3) — shape (8, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_many Ran
ran; our contract draft was wrong, not the code
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("c617380b35354072")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple inner_func that takes input and returns (_log_p, pi)
class InnerFunc(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, input):
        # input shape: (batch_size, graph_size, node_dim)
        batch_size = input.size(0)
        graph_size = input.size(1)
        # Return log probabilities and policy indices
        _log_p = torch.randn(batch_size, graph_size)
        pi = torch.randint(0, graph_size, (batch_size, 5))  # sequence of 5 indices
        return _log_p, pi

inner_func_inst = InnerFunc()

def inner_func(input):
    return inner_func_inst(input)

# Define a simple get_cost_func that takes input and pi, returns (cost, mask)
def get_cost_func(input, pi):
    # input shape: (batch_size, graph_size, node_dim)
    # pi shape: (batch_size, seq_length)
    batch_size = pi.size(0)
    cost = torch.randn(batch_size)
    mask = torch.ones(batch_size, dtype=torch.bool)
    return cost, mask

# Create input tensor: (batch_size=2, graph_size=3, node_dim=4)
input = torch.randn(2, 3, 4)

ARGS = {
    'inner_func': inner_func,
    'get_cost_func': get_cost_func,
    'input': input,
    'batch_rep': 2,
    'iter_rep': 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AttentionModel Not yet run
unverified (harvested, no recorded run)
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("51bd344e0972d3b3")
How it ran

no invocation recorded.

GraphAttentionEncoder Not yet run
unverified (harvested, no recorded run)
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("0ef134a41afa9250")
How it ran

no invocation recorded.

MultiHeadAttentionLayer Not yet run
unverified (harvested, no recorded run)
zhuoyi-lin/cross_problem_learning/nets/attention_model.py
code served (permissive licence) · get_code("5579c57075af815e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
Normalization
brick of this paper's assembly: helper
4 other papers
4 dated earlier · 4 only as an assembly brick
2110.02544 (2021-10)
Learning to Iteratively Solve Routing Problems with Dual-Aspect Collaborative Transformer
2110.13987 (2021-10)
Learning Collaborative Policies to Solve NP-hard Routing Problems
2204.03236 (2022-04)
Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum
and 1 more not named here
SkipConnection
brick of this paper's assembly: helper
4 other papers
4 dated earlier · 4 only as an assembly brick
2110.02544 (2021-10)
Learning to Iteratively Solve Routing Problems with Dual-Aspect Collaborative Transformer
2110.13987 (2021-10)
Learning Collaborative Policies to Solve NP-hard Routing Problems
2204.03236 (2022-04)
Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum
and 1 more not named here
do_batch_rep
brick of this paper's assembly: helper
3 other papers
3 dated earlier · 3 only as an assembly brick
2110.13987 (2021-10)
Learning Collaborative Policies to Solve NP-hard Routing Problems
2204.03236 (2022-04)
Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum
2205.13225 (2022-05)
DevFormer: A Symmetric Transformer for Context-Aware Device Placement
AttentionModelFixed
brick of this paper's assembly: helper
2 other papers
2 dated earlier · 2 only as an assembly brick
2110.13987 (2021-10)
Learning Collaborative Policies to Solve NP-hard Routing Problems
2204.03236 (2022-04)
Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum
sample_many
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2204.03236 (2022-04)
Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Existing neural heuristics often train a deep architecture from scratch for each specific vehicle routing problem (VRP), ignoring the transferable knowledge across different VRP variants. This paper proposes the cross-problem learning to assist heuristics training for different downstream VRP variants. Particularly, we modularize neural architectures for complex VRPs into 1) the backbone Transformer for tackling the travelling salesman problem (TSP), and 2) the additional lightweight modules for processing problem-specific features in complex VRPs. Accordingly, we propose to pretrain the backbone Transformer for TSP, and then apply it in the process of fine-tuning the Transformer models for each target VRP variant. On the one hand, we fully fine-tune the trained backbone Transformer and problem-specific modules simultaneously. On the other hand, we only fine-tune small adapter networks along with the modules, keeping the backbone Transformer still. Extensive experiments on typical VRPs substantiate that 1) the full fine-tuning achieves significantly better performance than the one trained from scratch, and 2) the adapter-based fine-tuning also delivers comparable performance while being notably parameterefficient. Furthermore, we empirically demonstrate the favorable effect of our method in terms of cross-distribution application and versatility. The code is available: https://github.com/Zhuoyi-Lin/ Cross problem learning.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2404.11677")
get_code_for_paper("2404.11677")
have("2404.11677")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2404.11677.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2404.11677.svg)](https://syntology.ai/paper/2404.11677)

Connect an agent — have() is free.