An external CP-SAT solver solves the pinned fifty-item instance under deterministic parameters. The diagram highlights exactly the items decoded from the run's own solution values, displayed as decoded.

highlighted = computed this step

Invocation

The invocation is cpsat_stream_solve solve knapsack.jsonl --params num_search_workers:1,random_seed:1, with the solution values written to a temporary --sol file. Why: a single search worker and a fixed seed make the run deterministic, so the selection quoted below is reproducible rather than anecdotal.

one worker, one seed, deterministic solve\text{one worker, one seed, deterministic solve}
Fifty-item knapsackRows I1 through I50, each cell showing weight and value.50 items, capacity 850I1w7v360I2w0v83I3w30v59I4w22v130I5w80v431I6w94v67I7w11v230I8w81v52I9w70v93I10w64v125I11w59v670I12w18v892I13w0v600I14w36v38I15w3v48I16w8v147I17w15v78I18w42v256I19w9v63I20w0v17I21w42v120I22w47v164I23w52v432I24w32v35I25w26v92I26w48v110I27w55v22I28w6v42I29w29v50I30w84v323I31w2v514I32w4v28I33w18v87I34w56v73I35w7v78I36w29v15I37w93v26I38w44v78I39w71v210I40w3v36I41w86v85I42w66v189I43w31v274I44w65v43I45w0v33I46w79v10I47w20v19I48w65v389I49w52v276I50w13v312items 50capacity 850DP optimum 7534

The solver's result

The solver reports status OPTIMAL with objective value 7534. Why: OPTIMAL means the solver proved a matching bound, not merely found a good packing; the objective is the deterministic field this lesson quotes, not timing or search statistics.

status OPTIMAL, objective=7534\text{status OPTIMAL, objective}=7534
Fifty-item knapsackRows I1 through I50, each cell showing weight and value.CP-SAT optimal value 7534I1*w7v360I2*w0v83I3w30v59I4*w22v130I5*w80v431I6w94v67I7*w11v230I8w81v52I9w70v93I10w64v125I11*w59v670I12*w18v892I13*w0v600I14w36v38I15*w3v48I16*w8v147I17*w15v78I18*w42v256I19*w9v63I20*w0v17I21w42v120I22*w47v164I23*w52v432I24w32v35I25*w26v92I26w48v110I27w55v22I28*w6v42I29*w29v50I30*w84v323I31*w2v514I32*w4v28I33*w18v87I34w56v73I35*w7v78I36w29v15I37w93v26I38w44v78I39*w71v210I40*w3v36I41w86v85I42*w66v189I43*w31v274I44w65v43I45*w0v33I46w79v10I47w20v19I48*w65v389I49*w52v276I50*w13v312items 50capacity 850DP optimum 7534selected 32weight 850 value 7534

The chosen items

The solver chose 32 of the fifty items, decoded from its own solution values. Why: the highlighted cells in the diagram are exactly those thirty-two items — the same decode that fed the weight and value checks, not a separately authored selection.

chosen items=32\text{chosen items}=32
Fifty-item knapsackRows I1 through I50, each cell showing weight and value.CP-SAT optimal value 7534I1*w7v360I2*w0v83I3w30v59I4*w22v130I5*w80v431I6w94v67I7*w11v230I8w81v52I9w70v93I10w64v125I11*w59v670I12*w18v892I13*w0v600I14w36v38I15*w3v48I16*w8v147I17*w15v78I18*w42v256I19*w9v63I20*w0v17I21w42v120I22*w47v164I23*w52v432I24w32v35I25*w26v92I26w48v110I27w55v22I28*w6v42I29*w29v50I30*w84v323I31*w2v514I32*w4v28I33*w18v87I34w56v73I35*w7v78I36w29v15I37w93v26I38w44v78I39*w71v210I40*w3v36I41w86v85I42*w66v189I43*w31v274I44w65v43I45*w0v33I46w79v10I47w20v19I48*w65v389I49*w52v276I50*w13v312items 50capacity 850DP optimum 7534selected 32weight 850 value 7534

Diagram note

Highlighted cells are the solver's own decoded selection, marked by role with a starred label, not a color-only marker. The cell entries are the original exact weights and values. Pixel positions are rounded for layout; every number shown is exact.

highlighted cells are the solver’s selection\text{highlighted cells are the solver's selection}
Fifty-item knapsackRows I1 through I50, each cell showing weight and value.CP-SAT optimal value 7534I1*w7v360I2*w0v83I3w30v59I4*w22v130I5*w80v431I6w94v67I7*w11v230I8w81v52I9w70v93I10w64v125I11*w59v670I12*w18v892I13*w0v600I14w36v38I15*w3v48I16*w8v147I17*w15v78I18*w42v256I19*w9v63I20*w0v17I21w42v120I22*w47v164I23*w52v432I24w32v35I25*w26v92I26w48v110I27w55v22I28*w6v42I29*w29v50I30*w84v323I31*w2v514I32*w4v28I33*w18v87I34w56v73I35*w7v78I36w29v15I37w93v26I38w44v78I39*w71v210I40*w3v36I41w86v85I42*w66v189I43*w31v274I44w65v43I45*w0v33I46w79v10I47w20v19I48*w65v389I49*w52v276I50*w13v312items 50capacity 850DP optimum 7534selected 32weight 850 value 7534