SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1911.10092 · 2019

Smart Predict-and-Optimize for Hard Combinatorial Optimization Problems

arXiv · PDF · Open in the Atlas

Code that ran

6 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 6 have no contract verdict; 0 failures of our instrument; 7 no recorded run), measured 2026-11-22; 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/1911.10092.json · badge: /api/ran/1911.10092.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
JayMan91/aaai_predit_then_optimize canonical (classifier label)
classifier basis: census
6 ran · 7 no recorded run
FunctionStatusWhere it lives
data_reading Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/EnergyCost/ICON.py
code served (permissive licence) · get_code("ee1c6a3a00be8bc6")
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 tempfile
import os

# Create a temporary file with the expected data format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_filename = temp_file.name

# Write test data following the format expected by data_reading
content = """3
2
2
m 10 0.5 0.3
1 2
m 20 0.4 0.2
3 1
2
t 5 10 15 0.9
1 2 1
t 8 12 20 0.8
2 1 2
"""

temp_file.write(content)
temp_file.close()

ARGS = {
    'filename': temp_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
get_data Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/sgd_learner.py
code served (permissive licence) · get_code("2dd8ceebf2a365ec")
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 (3, 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
import numpy as np

torch.manual_seed(0)

# The function indexes into trch with slice [kn_start:kn_stop]
# So trch should be a tensor or list that supports slicing
# Parameters: trch, kn_nr, n_items
trch = torch.randn(10, 4)  # Small tensor with enough elements to slice
kn_nr = 1  # Knowledge number (multiplier for offset)
n_items = 3  # Number of items to retrieve

ARGS = {
    "trch": trch,
    "kn_nr": kn_nr,
    "n_items": n_items
}
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 2, dtype family float, shape (3, 4) — shape (3, 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
get_kn_indicators Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/sgd_learner.py
code served (permissive licence) · get_code("1592e9edaea942e4")
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 (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 numpy as np

# Mock functions for the knapsack solvers that are called when use_dp=True
def solveKnapsackProblem(V_pred, weights, c, warmstart=None):
    """Mock knapsack solver"""
    n = len(V_pred)
    # Simple greedy solution
    assignments = np.zeros(n, dtype=int)
    indices = np.argsort(-V_pred)
    remaining_capacity = c
    for idx in indices:
        if remaining_capacity >= weights[idx]:
            assignments[idx] = 1
            remaining_capacity -= weights[idx]
    return {
        'assignments': assignments,
        'runtime': 0.001
    }

def solveKnapsackProblemRelaxation(V_pred, weights, c, warmstart=None):
    """Mock relaxed knapsack solver"""
    n = len(V_pred)
    assignments = np.zeros(n)
    indices = np.argsort(-V_pred / weights)
    remaining_capacity = c
    for idx in indices:
        if remaining_capacity >= weights[idx]:
            assignments[idx] = 1.0
            remaining_capacity -= weights[idx]
        elif remaining_capacity > 0:
            assignments[idx] = remaining_capacity / weights[idx]
            remaining_capacity = 0
            break
    return {
        'assignments': assignments,
        'runtime': 0.001
    }

# Create test data
V_pred = np.array([5.0, 3.0, 8.0, 2.0])
c = 10.0
weights = np.array([2.0, 1.0, 3.0, 1.0])
warmstart = None

ARGS = {
    'V_pred': V_pred,
    'c': c,
    'weights': weights,
    'use_dp': False,
    'relaxation': False,
    'warmstart': warmstart
}
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 (4,) — shape (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
get_profits Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/EnergyCost/energy_cost.py
code served (permissive licence) · get_code("aa97787abf6034a7")
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 (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
import numpy as np

torch.manual_seed(0)

# The function accesses trch_y with slicing [kn_start:kn_stop]
# and then calls .data.numpy() and transposes
# So trch_y needs to be a torch tensor with at least (kn_nr * n_items + n_items) elements
# We'll make it a 2D tensor to match the .T[0] indexing pattern

n_items = 4
kn_nr = 2

# Create a tensor that will contain enough elements
# Shape: (kn_nr * n_items + n_items, 1) to support the slicing and transpose operations
total_rows = (kn_nr + 1) * n_items
trch_y = torch.randn(total_rows, 1)

ARGS = {
    "trch_y": trch_y,
    "kn_nr": kn_nr,
    "n_items": n_items,
}
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 ndarray, ndim 1, dtype family float, shape (4,) — shape (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
shortest_path Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/sgd_learner.py
code served (permissive licence) · get_code("95c25164471c4610")
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 (24,) 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

# Construct V_pred: a 1D numpy array of edge weights
# The function expects V_pred to be a flattened array of weights for all edges
# For a graph with height=3, width=3, we need:
# - Horizontal edges: (height+1) * width = 4 * 3 = 12
# - Vertical edges: height * (width+1) = 3 * 4 = 12
# - Total: 24 edges
V_pred = np.array([1.0, 2.0, 1.5, 2.5, 1.2, 2.2, 
                   1.8, 2.8, 1.1, 2.1, 1.3, 2.3,
                   1.4, 2.4, 1.6, 2.6, 1.7, 2.7,
                   1.9, 2.9, 1.0, 2.0, 1.5, 2.5], dtype=np.float32)

ARGS = {
    'V_pred': V_pred,
    'height': 3,
    'width': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, 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 (24,) — shape (24,) 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
solveKnapsackGreedily Ran
ran on a synthesized input
JayMan91/aaai_predit_then_optimize/KnapsackSolving.py
code served (permissive licence) · get_code("ba3145cb5e3d8213")
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.

# Analyzing the function:
# - profits: list of non-negative numbers (profits of items)
# - weights: list of positive numbers (weights of items)
# - capacity: positive integer (knapsack capacity)
# - Function performs greedy knapsack by sorting items by profit/weight ratio
# - Requires at least 2 items
# - Requires profits and weights to have same length

ARGS = {
    'profits': [60, 100, 120],
    'weights': [10, 20, 30],
    'capacity': 50
}
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
ICON_scheduling Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/EnergyCost/ICON.py
code served (permissive licence) · get_code("2a98612374aa111c")
How it ran

no invocation recorded.

ICON_scheduling_relaxation Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/EnergyCost/ICON.py
code served (permissive licence) · get_code("61a4f21373e9ada4")
How it ran

no invocation recorded.

get_energy Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/get_energy.py
code served (permissive licence) · get_code("3ee7504e77ee94cb")
How it ran

no invocation recorded.

get_energy_grouped Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/get_energy.py
code served (permissive licence) · get_code("8234b742ce34e9d8")
How it ran

no invocation recorded.

get_energy_pandas Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/get_energy.py
code served (permissive licence) · get_code("0d9b18d5fefc09ef")
How it ran

no invocation recorded.

solveKnapsackProblem Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/KnapsackSolving.py
code served (permissive licence) · get_code("6788adf385135210")
How it ran

no invocation recorded.

solveKnapsackProblemRelaxation Not yet run
unverified (harvested, no recorded run)
JayMan91/aaai_predit_then_optimize/KnapsackSolving.py
code served (permissive licence) · get_code("964934cb816c76c8")
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, 12 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 12 later) and 1 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
data_reading 2 other papers
2 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
2112.03609 (2021-12)
Decision-Focused Learning: Through the Lens of Learning to Rank
get_energy_pandas 2 other papers
2 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
2112.03609 (2021-12)
Decision-Focused Learning: Through the Lens of Learning to Rank
ICON_scheduling 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
ICON_scheduling_relaxation 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
get_data 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
get_energy 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
get_energy_grouped 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
get_kn_indicators 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
shortest_path 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
solveKnapsackGreedily 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
solveKnapsackProblem 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation
solveKnapsackProblemRelaxation 1 other paper
1 later
2010.13943 (2020-10)
Interior Point Solving for LP-based prediction+optimisation

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

Combinatorial optimization assumes that all parameters of the optimization problem, e.g. the weights in the objective function is fixed. Often, these weights are mere estimates and increasingly machine learning techniques are used to for their estimation. Recently, Smart Predict and Optimize (SPO) has been proposed for problems with a linear objective function over the predictions, more specifically linear programming problems. It takes the regret of the predictions on the linear problem into account, by repeatedly solving it during learning. We investigate the use of SPO to solve more realistic discrete optimization problems. The main challenge is the repeated solving of the optimization problem. To this end, we investigate ways to relax the problem as well as warmstarting the learning and the solving. Our results show that even for discrete problems it often suffices to train by solving the relaxation in the SPO loss. Furthermore, this approach outperforms, for most instances, the state-of-the-art approach of Wilder, Dilkina, and Tambe. We experiment with weighted knapsack problems as well as complex scheduling problems and show for the first time that a predict-and-optimize approach can successfully be used on large-scale combinatorial optimization problems.

For agents

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

get_harvested_code_for_paper("1911.10092")
get_code_for_paper("1911.10092")
have("1911.10092")

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

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

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

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

Connect an agent — have() is free.