SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.07580 · ICML · 2025

BOPO: Neural Combinatorial Optimization via Best-anchored and Objective-guided Preference Optimization

Jiahai Wang, Jinbiao Chen, Zizhen Zhang, Zijun Liao, Debing Wang

arXiv · PDF · Open in the Atlas

Code that ran

11 of 13 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 9 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2503.07580.json · badge: /api/ran/2503.07580.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
L-Z-7/BOPO canonical (classifier label)
classifier basis not recorded on the link
11 ran · 2 no recorded run
FunctionStatusWhere it lives
SROLoss Ran
ran on a synthesized input
L-Z-7/BOPO/FJSP/sampling.py
code served (permissive licence) · get_code("83afac5eb44353b7")
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 0, dtype family float, shape () 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.functional as F
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class Solutions:
    mss: torch.Tensor
    logits: torch.Tensor
    trajs: torch.Tensor

# Set up tiny tensors
batch_size = 2
sequence_length = 3
num_classes = 4

# Create logits: shape (bs, s, n) = (2, 3, 4)
logits_b = torch.randn(batch_size, sequence_length, num_classes)
logits_w = torch.randn(batch_size, sequence_length, num_classes)

# Create trajectory targets: shape (bs, s) = (2, 3), values in [0, num_classes)
trajs_b = torch.randint(0, num_classes, (batch_size, sequence_length))
trajs_w = torch.randint(0, num_classes, (batch_size, sequence_length))

# Create mean step sizes (mss): shape (bs,) = (2,), positive values
mss_b = torch.abs(torch.randn(batch_size)) + 0.1
mss_w = torch.abs(torch.randn(batch_size)) + 0.1

# Construct Solutions objects
info_b = Solutions(
    mss=mss_b,
    logits=logits_b,
    trajs=trajs_b
)

info_w = Solutions(
    mss=mss_w,
    logits=logits_w,
    trajs=trajs_w
)

ARGS = {
    "info_b": info_b,
    "info_w": info_w
}
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 0, dtype family float, shape () — shape () 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
SROLoss Ran
ran on a synthesized input
L-Z-7/BOPO/JSP/sampling.py
code served (permissive licence) · get_code("6037c676f6c34423")
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
import torch.nn.functional as F
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class Solutions:
    mss: torch.Tensor
    logits: torch.Tensor
    trajs: torch.Tensor

# Set up dimensions
batch_size = 2
sequence_length = 3
num_classes = 4

# Create info_w (winner)
logits_w = torch.randn(batch_size, sequence_length, num_classes)
trajs_w = torch.randint(0, num_classes, (batch_size, sequence_length))
mss_w = torch.tensor([0.8, 0.9])  # scalar per batch item, representing some metric

info_w = Solutions(
    mss=mss_w,
    logits=logits_w,
    trajs=trajs_w
)

# Create info_l (loser)
logits_l = torch.randn(batch_size, sequence_length, num_classes)
trajs_l = torch.randint(0, num_classes, (batch_size, sequence_length))
mss_l = torch.tensor([0.6, 0.7])  # scalar per batch item, representing some metric

info_l = Solutions(
    mss=mss_l,
    logits=logits_l,
    trajs=trajs_l
)

ARGS = {
    "info_w": info_w,
    "info_l": info_l
}
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
find_nearest_distances Ran
ran on a synthesized input
L-Z-7/BOPO/JSP/utils.py
code served (permissive licence) · get_code("d8e128a319c026ce")
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 2, dtype family int; 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

# Analyze the function: find_nearest_distances takes a sequence (seq)
# The function iterates through seq accessing elements via seq[i]
# It checks membership with "val in last_seen" (dict lookup)
# It needs to work with hashable values
# The sequence should have some repeated elements to test the logic

seq = [1, 2, 1, 3, 2, 1]

ARGS = {
    "seq": seq
}
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 tuple, ndim 2, dtype family int — 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
gen_fjsp_instance Ran
ran on a synthesized input
L-Z-7/BOPO/FJSP/inout.py
code served (permissive licence) · get_code("74af803734a04c3f")
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, 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

class DesFJSP:
    def __init__(self, num_jobs=10, num_machines=5, num_operation=(4, 6), num_assign_machines=(1, 5), avg_pt=(1, 20)) -> None:
        self.num_jobs = num_jobs
        self.num_machines = num_machines
        self.num_operation = num_operation
        self.num_assign_machines = num_assign_machines
        self.avg_pt = avg_pt

    @property
    def name(self):
        return 'FJSP-{}x({}-{})x{}-{}'.format(self.num_jobs, self.num_operation, self.num_assign_machines, self.num_machines, self.avg_pt)

    @property
    def size(self):
        return 'FS{}x{}x{}'.format(self.num_jobs, np.max(self.num_operation), self.num_machines)

# Create a small DesFJSP instance with realistic parameters
instance = DesFJSP(
    num_jobs=(2, 4),  # Random between 2-4 jobs
    num_machines=3,    # Fixed 3 machines
    num_operation=(2, 4),  # Random between 2-4 operations per job
    num_assign_machines=(1, 2),  # Random between 1-2 machines assigned per operation
    avg_pt=(1, 10)  # Processing time between 1-10
)

# Create a random state for reproducibility
random_state = np.random.RandomState(seed=42)

ARGS = {
    'instance': instance,
    'random': random_state
}
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, 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
graph_edges Ran
ran on a synthesized input
L-Z-7/BOPO/JSP/inout.py
code served (permissive licence) · get_code("1060d49a2d882ad8")
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 int, shape (10, 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

torch.manual_seed(0)

# Parameters for graph_edges function
num_j = 2  # number of jobs
num_m = 3  # number of machines

# Create a machines tensor that assigns each operation to a machine
# Shape: (num_j * num_m,) - one machine index per operation
machines = torch.tensor([0, 1, 2, 0, 1, 2], dtype=torch.long)

device = 'cpu'

ARGS = {
    'num_j': num_j,
    'num_m': num_m,
    'machines': machines,
    'device': device
}
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 int, shape (10, 2) — shape (10, 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
multi_head_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
L-Z-7/BOPO/TSP/TSPModel.py
pointer only (licence: MIT); the stored copy get_code serves, from SobihanSurendran/LGS, is pointer only (licence: NONE) · get_code("6dc103e776ff9eed")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from SobihanSurendran/LGS, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

read_basic Ran
ran on a synthesized input
L-Z-7/BOPO/FJSP/inout.py
code served (permissive licence) · get_code("42c8b38938313614")
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 os
import tempfile
import numpy as np

# Create a temporary FJSP instance file
temp_dir = tempfile.mkdtemp()
fjsp_file = os.path.join(temp_dir, "test_instance.fjs")

# Write a simple FJSP instance file
# Format: N M K (jobs, machines, dummy)
# Then for each job: K (num operations), then for each operation: num_machines, machine1, time1, machine2, time2, ...
fjsp_content = """3 2 0
2 1 1 5 1 2 3
2 1 2 4 1 1 2
2 1 1 6 1 2 2
100
"""

with open(fjsp_file, 'w') as f:
    f.write(fjsp_content)

ARGS = {
    'f_path': fjsp_file
}
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 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
read_basic Ran
ran on a synthesized input
L-Z-7/BOPO/JSP/inout.py
code served (permissive licence) · get_code("a71aced07e2d5109")
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 tempfile
import os

torch.manual_seed(0)

# Create a temporary file with JSP instance data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "jsp_instance.txt")

# Write test data to the temporary file
with open(temp_file, 'w') as f:
    # Line 1: num_jobs num_machines
    f.write("2 3\n")
    # Line 2-3: instance matrix (2 jobs, 6 values each = 2*3 machines)
    f.write("1.0 2.0 3.0 4.0 5.0 6.0\n")
    f.write("7.0 8.0 9.0 10.0 11.0 12.0\n")
    # Line 4: makespan
    f.write("42.5\n")

ARGS = {
    'f_path': temp_file,
    'sep': ' ',
    'device': 'cpu'
}
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
reshape_by_heads Ran
ran; our contract draft was wrong, not the code
L-Z-7/BOPO/TSP/TSPModel.py
pointer only (licence: MIT); the stored copy get_code serves, from yihang0410/RADAR, is pointer only (licence: NONE) · get_code("459fe521069329c6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yihang0410/RADAR, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

shift Ran
ran on a synthesized input
L-Z-7/BOPO/JSP/utils.py
code served (permissive licence) · get_code("b010e092280877d0")
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 int, shape (5,) 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:
# - a: numpy array that gets copied and modified
# - idx: starting index for the shift operation
# - bias: determines the direction and magnitude of shifts

# Create a simple numpy array to shift elements within
a = np.array([10, 20, 30, 40, 50])

# idx: starting index for the shift operation
idx = 1

# bias: positive shifts right, negative shifts left
bias = 2

ARGS = {
    "a": a,
    "idx": idx,
    "bias": bias
}
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 int, shape (5,) — shape (5,) 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
standardize Ran
ran on a synthesized input
L-Z-7/BOPO/FJSP/inout.py
code served (permissive licence) · get_code("16c504e24ee35b7e")
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 (2, 4) 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

torch.manual_seed(0)

# Create a small tensor for standardization
# Shape: (2, 4) - batch size 2, feature dimension 4
input_tensor = torch.randn(2, 4)

# Define arguments for the standardize function
ARGS = {
    "input": input_tensor,
    "dim": 0,
    "eps": 1e-06
}
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 (2, 4) — shape (2, 4) 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_training_pair Not yet run
unverified (harvested, no recorded run)
L-Z-7/BOPO/FJSP/sampling.py
code served (permissive licence) · get_code("01597056ecf8f858")
How it ran

no invocation recorded.

solve_problem Not yet run
unverified (harvested, no recorded run)
L-Z-7/BOPO/FJSP/sampling.py
code served (permissive licence) · get_code("c2da96b9d22a09b5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 11 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
reshape_by_heads 28 other papers
19 dated earlier, 8 later, 1 undated · 15 only as an assembly brick
2010.16011 (2020-10)
POMO: Policy Optimization with Multiple Optima for Reinforcement Learning
2106.11113 (2021-06)
Matrix Encoding Networks for Neural Combinatorial Optimization
2203.15386 (2022-03)
Pareto Set Learning for Neural Multi-objective Combinatorial Optimization
and 25 more not named here
multi_head_attention 13 other papers
9 dated earlier, 3 later, 1 undated · 6 only as an assembly brick
2010.16011 (2020-10)
POMO: Policy Optimization with Multiple Optima for Reinforcement Learning
2203.15386 (2022-03)
Pareto Set Learning for Neural Multi-objective Combinatorial Optimization
2205.13209 (2022-05)
Sym-NCO: Leveraging Symmetricity for Neural Combinatorial Optimization
and 10 more not named here

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-22.

Repositories linked to this paper

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

Abstract

Neural Combinatorial Optimization (NCO) has emerged as a promising approach for NP-hard problems. However, prevailing RL-based methods suffer from low sample efficiency due to sparse rewards and underused solutions. We propose Best-anchored and Objective-guided Preference Optimization (BOPO), a training paradigm that leverages solution preferences via objective values. It introduces: (1) a best-anchored preference pair construction for better explore and exploit solutions, and (2) an objective-guided pairwise loss function that adaptively scales gradients via objective differences, removing reliance on reward models or reference policies. Experiments on Job-shop Scheduling Problem (JSP), Traveling Salesman Problem (TSP), and Flexible Job-shop Scheduling Problem (FJSP) show BOPO outperforms state-of-the-art neural methods, reducing optimality gaps impressively with efficient inference. BOPO is architecture-agnostic, enabling seamless integration with existing NCO models, and establishes preference optimization as a principled framework for combinatorial optimization.

For agents

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

get_harvested_code_for_paper("2503.07580")
get_code_for_paper("2503.07580")
have("2503.07580")

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

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

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

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

Connect an agent — have() is free.