SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.21066 · NeurIPS · 2024

Learning to Handle Complex Constraints for Vehicle Routing Problems

Jie Zhang, Yining Ma, Zhiguang Cao, Wen Song, Jieyi Bi, Jianan Zhou, Yaoxin Wu

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 4 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/2410.21066.json · badge: /api/ran/2410.21066.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
jieyibi/PIP-constraint canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
jieyibi/pip-constraint canonical (classifier label)
classifier basis: classifier_2025
0 ran · 3 no recorded run
FunctionStatusWhere it lives
calc_vrp_cost Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jieyibi/PIP-constraint/GFACS+PIP/lkh.py
code served (permissive licence) · get_code("f4b9a37d67290bfd")
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 float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np

# Create a simple depot (starting point) - 2D coordinates
depot = np.array([0.0, 0.0])

# Create locations for 4 nodes (must be 2D coordinates to match depot dimensionality)
loc = np.array([
    [1.0, 0.0],
    [1.0, 1.0],
    [0.0, 1.0],
    [-1.0, 0.0]
])

# Create a valid tour visiting all nodes exactly once
# Tour must contain nodes numbered 1 to len(loc) in some order
tour = np.array([1, 2, 3, 4])

ARGS = {
    "depot": depot,
    "loc": loc,
    "tour": tour
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
calculate_log_pb_uniform Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/train_nar.py
code served (permissive licence) · get_code("767b477005da5d85")
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 1, dtype family float, shape (2,) 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 numpy as np
import math
import scipy

torch.manual_seed(0)

# Create a small batch of paths
# The function expects a tensor where:
# - axis 1 represents positions in a path
# - values are node indices (non-zero for valid nodes, zero for padding)
# We'll create batch_size=2, sequence_length=4
paths = torch.tensor([
    [1, 2, 0, 0],
    [1, 2, 3, 0]
], dtype=torch.float32)

ARGS = {
    "paths": paths
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
check_extension Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/lkh.py
code served (permissive licence) · get_code("01df1926cf07ac89")
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 str. 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 os

def check_extension(filename):
    if os.path.splitext(filename)[1] != '.pkl':
        return filename + '.pkl'
    return filename

ARGS = {
    'filename': 'myfile.txt'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
gen_tw_naive Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/data_generator.py
code served (permissive licence) · get_code("207388a6fced0206")
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 ndarray, ndim 3, dtype family int, shape (2, 4, 2) 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 numpy as np

class RandomState:
    """Stand-in for np.random.RandomState with required methods"""
    def __init__(self, seed=None):
        self.rng = np.random.RandomState(seed)
    
    def randint(self, low, high, size=None):
        return self.rng.randint(low, high, size=size)
    
    def uniform(self, low, high, size=None):
        return self.rng.uniform(low, high, size=size)

ARGS = {
    'size': 2,
    'graph_size': 4,
    'time_factor': 10.0,
    'dura_region': [0.5, 1.5],
    'rnds': RandomState(seed=42),
    'tw_type': 'easy'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (2, 4, 2) — shape (2, 4, 2) 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
get_edge_matrix Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jieyibi/PIP-constraint/GFACS+PIP/data_generator.py
code served (permissive licence) · get_code("58edcba2f8498729")
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 3, dtype family float, shape (2, 3, 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 numpy as np
import torch

torch.manual_seed(0)

# Create a small tensor of nodes for testing
# Shape: (batch_size, num_nodes, num_features)
# Using distinct sizes: batch=2, num_nodes=3, num_features=4
nodes_torch = torch.randn(2, 3, 4)

# Also create a numpy version for testing the numpy path
nodes_numpy = np.random.randn(2, 3, 4)

ARGS = {
    "nodes": nodes_torch
}
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 Tensor, ndim 3, dtype family float, shape (2, 3, 3) — shape (2, 3, 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
get_random_tour Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/data_generator.py
code served (permissive licence) · get_code("303d938f80c0f3f5")
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 ndarray, ndim 1, dtype family float, shape (2,) 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 numpy as np

# Analyze the function to understand what edge_matrix should be:
# - edge_matrix.shape[0] = size (number of tours/batches)
# - edge_matrix.shape[1] = graph_size (number of nodes)
# - edge_matrix is indexed as: edge_matrix[d0, tours[:, :-1], tours[:, 1:]]
#   This means it's a 3D array: [batch_idx, from_node, to_node]

# Create a small edge matrix
size = 2  # batch size
graph_size = 4  # number of nodes in graph

# edge_matrix[batch, from_node, to_node] = edge weight/cost
edge_matrix = np.random.rand(size, graph_size, graph_size)

# Create a random number generator
rnds = np.random.RandomState(42)

ARGS = {
    "edge_matrix": edge_matrix,
    "rnds": rnds,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) 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
load_dataset Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/lkh.py
code served (permissive licence) · get_code("69062811f34d8ff6")
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 dict. 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 os
import pickle
import tempfile

# Create a temporary pickle file for testing
temp_dir = tempfile.mkdtemp()
test_data = {"sample": "data", "values": [1, 2, 3]}
test_file_path = os.path.join(temp_dir, "test_dataset.pkl")

with open(test_file_path, 'wb') as f:
    pickle.dump(test_data, f)

# Remove the .pkl extension for the argument to test the check_extension logic
test_filename = os.path.join(temp_dir, "test_dataset")

ARGS = {
    "filename": test_filename
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
validate_route Ran
ran; our contract draft was wrong, not the code
jieyibi/PIP-constraint/GFACS+PIP/train_nar.py
code served (permissive licence) · get_code("fe1d8fbff7db28f0")
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, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# Build distance matrix: 4x4 distance matrix between nodes
distance = torch.tensor([
    [0.0, 1.0, 2.0, 3.0],
    [1.0, 0.0, 1.5, 2.5],
    [2.0, 1.5, 0.0, 1.0],
    [3.0, 2.5, 1.0, 0.0]
], dtype=torch.float32)

# Build time windows: 4x2 tensor with [start, end] for each node
tw = torch.tensor([
    [0.0, 100.0],    # node 0: depot
    [5.0, 15.0],     # node 1
    [10.0, 20.0],    # node 2
    [15.0, 25.0]     # node 3
], dtype=torch.float32)

# Build a valid route that visits all nodes: [0, 1, 2, 3]
routes = [
    torch.tensor(0, dtype=torch.long),
    torch.tensor(1, dtype=torch.long),
    torch.tensor(2, dtype=torch.long),
    torch.tensor(3, dtype=torch.long)
]

ARGS = {
    "distance": distance,
    "tw": tw,
    "routes": routes
}
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, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
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
SINGLEModel Not yet run
unverified (harvested, no recorded run)
jieyibi/pip-constraint/POMO+PIP/models/SINGLEModel.py
code served (permissive licence) · get_code("3df49b2f459b128d")
How it ran

no invocation recorded.

SINGLE_Decoder Not yet run
unverified (harvested, no recorded run)
jieyibi/pip-constraint/POMO+PIP/models/SINGLEModel.py
code served (permissive licence) · get_code("246d64b95e2c6b6c")
How it ran

no invocation recorded.

SINGLE_Encoder Not yet run
unverified (harvested, no recorded run)
jieyibi/pip-constraint/POMO+PIP/models/SINGLEModel.py
code served (permissive licence) · get_code("51325c5a01cb50d8")
How it ran

no invocation recorded.

get_options Not yet run
unverified (harvested, no recorded run)
jieyibi/PIP-constraint/AM+PIP/options.py
code served (permissive licence) · get_code("248273aac0ceb091")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 2 later) and 9 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
check_extension 7 other papers
5 dated earlier, 1 later, 1 same year, order not determinable
1803.08475 (2018-03)
Attention, Learn to Solve Routing Problems!
2205.13225 (2022-05)
DevFormer: A Symmetric Transformer for Context-Aware Device Placement
2305.19587 (2023-05)
Towards Omni-generalizable Neural Methods for Vehicle Routing Problems
and 4 more not named here
load_dataset 4 other papers
3 dated earlier, 1 later
1803.08475 (2018-03)
Attention, Learn to Solve Routing Problems!
2205.13225 (2022-05)
DevFormer: A Symmetric Transformer for Context-Aware Device Placement
2403.07041 (2024-03)
Ant Colony Sampling with GFlowNets for Combinatorial Optimization
and 1 more not named here
calc_vrp_cost 1 other paper
1 dated earlier
2403.07041 (2024-03)
Ant Colony Sampling with GFlowNets for Combinatorial Optimization

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

Vehicle Routing Problems (VRPs) can model many real-world scenarios and often involve complex constraints. While recent neural methods excel in constructing solutions based on feasibility masking, they struggle with handling complex constraints, especially when obtaining the masking itself is NP-hard. In this paper, we propose a novel Proactive Infeasibility Prevention (PIP) framework to advance the capabilities of neural methods towards more complex VRPs. Our PIP integrates the Lagrangian multiplier as a basis to enhance constraint awareness and introduces preventative infeasibility masking to proactively steer the solution construction process. Moreover, we present PIP-D, which employs an auxiliary decoder and two adaptive strategies to learn and predict these tailored masks, potentially enhancing performance while significantly reducing computational costs during training. To verify our PIP designs, we conduct extensive experiments on the highly challenging Traveling Salesman Problem with Time Window (TSPTW), and TSP with Draft Limit (TSPDL) variants under different constraint hardness levels. Notably, our PIP is generic to boost many neural methods, and exhibits both a significant reduction in infeasible rate and a substantial improvement in solution quality.

For agents

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

get_harvested_code_for_paper("2410.21066")
get_code_for_paper("2410.21066")
have("2410.21066")

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

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

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

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

Connect an agent — have() is free.