CP-SAT: reproducible first-solution difference between a model with this 21,058-term objective and the same proto with the objective field cleared (Instance23, NRP)
What I observe
On a public benchmark instance, a model reaches no solution at all within a 300 s solver
limit, while the same CpModelProto with only the objective field cleared reaches
OPTIMAL in every run, with a first solution at ~83 s.
I am reporting this as a reproducible performance observation. I have not identified the cause, and my first two explanations turned out to be wrong — see "Controls that did not support my explanations" below. I would appreciate help deciding whether this is expected behaviour for an objective of this shape or something worth looking at.
Setup
Instance: Curtois & Qu nurse rostering, Instance23, from
https://www.schedulingbenchmarks.org/nrp/ (public, 230 KB text).
sha256(Instance23.txt) = edef99672d5cbe76f768e527f1d7a8f6e226714c5c6372609fc96bedee866366
#Variables: 635'648 (#bools: 9'848 #ints: 11'210 in objective) (584'000 primary variables)
- 624'438 Booleans in [0,1]
- 1'940 in [0,2]
- 2'322 in [0,3]
- 825 in [0,4]
- 299 in [0,5]
- 5'824 in [0,100]
#kBoolOr: 72'390 (#literals: 220'780)
#kLinear1: 3'600
#kLinear2: 4'003'400
#kLinear3: 5'200
#kLinearN: 85'848 (#terms: 3'762'998)The objective is a sum of non-negative penalties, so its natural lower bound is 0 and it does not shrink the feasible set. Its 21,058 terms are 9,410 Boolean request penalties plus 11,648 integer under/over-coverage terms (5,824 coverage requirements × 2).
ortools 9.15.6755 (latest on PyPI at the time of measurement), Python 3.12.8,
12-core arm64 macOS.
Result
Arm B is model.Clone() of arm A followed by proto.clear_objective(). Every run prints the
sha256 of its own proto with the objective stripped; all 20 runs print the same value.
| arm | runs reaching any solution | time to first solution |
|---|---|---|
| A — objective present | 0 / 10 | — (all UNKNOWN) |
B — clear_objective() |
10 / 10 (all OPTIMAL) |
median 83.1 s (82.4–84.0) |
solver.parameters.max_time_in_seconds = 300 - build_time; observed end-to-end wall time for
arm A was 303.2–303.3 s including model construction. 8 search workers, random_seed = 0.
Fisher exact, two-tailed, on these 10 pre-specified runs per arm: p = 1.08e-05.
Measurement protocol: each run is an independent process, not a loop inside one process;
the same random_seed in every run, because the variability being measured is thread
scheduling rather than seed choice; execution order randomised across arms; time to first
solution recorded by a solution callback while the solver keeps running, so wall time is not
time-to-first-solution for arm A; any cell with more than one active shift fails the run
(none occurred).
Two earlier runs of the same comparison, on earlier working trees, gave 0/5 vs 5/5 and 0/10 vs 10/10.
Observed during arm A (diagnostic only, not a cause)
log_search_progress = True, same 8 workers, 300 s, seed 0:
6 full problem subsolvers: [core, default_lp, max_lp, no_lp, quick_restart, reduced_costs]
2 first solution subsolvers: [fj, fs_random_no_lp]
9 interleaved subsolvers: [feasibility_pump, graph_arc_lns, graph_cst_lns, graph_dec_lns,
graph_var_lns, ls, rins/rens, rnd_cst_lns, rnd_var_lns]
calls: fj 1'008 · feasibility_pump 1'008 · rins/rens 1'009 · fs_random_no_lp 1
graph_arc_lns 0 · graph_cst_lns 0 · graph_dec_lns 0 · graph_var_lns 0
rnd_cst_lns 0 · rnd_var_lns 0 · ls 0The LNS subsolvers reporting zero calls is a consequence of no incumbent ever existing, not a cause of anything. I include it only because it shows the first-solution subsolvers are invoked ~1,000 times each and still return nothing within the limit.
Controls that did not support my explanations (exploratory, n = 1 each)
I first assumed "an objective prevents the first solution", then "a large objective prevents it". Both are contradicted by my own controls, which is why this report makes no causal claim. All of these build the model without an objective and then attach one, so the constraints are identical in every row.
| objective attached | result | first solution |
|---|---|---|
Minimize(0) |
OPTIMAL |
86.8 s |
Minimize(<one penalty term>) |
OPTIMAL |
89.0 s |
| 10 request-penalty terms | UNKNOWN |
— |
| 100 request-penalty terms | UNKNOWN |
— |
| 1,000 request-penalty terms | FEASIBLE |
246.4 s |
| 5,000 request-penalty terms | FEASIBLE |
137.9 s |
| all 9,410 request-penalty terms (no coverage terms) | OPTIMAL |
168.6 s |
| the real 21,058-term objective | UNKNOWN (0/10) |
— |
These rows are n = 1 and not monotone, and they vary term identity, variable type and coefficients along with term count, so they do not isolate an effect of objective size and I draw no statistical conclusion from them. They are included because they are evidence against the two explanations I would otherwise have offered.
Question
What property of this objective makes the portfolio behave so differently from the identical model with the objective field cleared? Is a first-solution difference of this size expected for an objective with this structure, or is it worth investigating?
Reproduction
curl -O https://www.schedulingbenchmarks.org/nrp/instances1_24/Instance23.txt
curl -LO https://gist.github.com/hyojunguy/e94177c0e15b622995e122a60ba0eece/raw/repro.py
python repro.py --instance Instance23.txt --reps 10
python repro.py --instance Instance23.txt --log # one run per arm, with the search logrepro.py: https://gist.github.com/hyojunguy/e94177c0e15b622995e122a60ba0eece
repro.py is self-contained: it depends only on ortools, parses the public instance, builds
the model, clones it for arm B, runs each measurement in its own process, and writes one JSONL
row per run. I have not attached the serialized proto — binary export is 153 MB — because the
script rebuilds it from the 230 KB public instance file.
Source: google/or-tools