Commit 023e6ec
feat: CBC-style threaded branch & bound (-threads N)
Opportunistic parallel tree search as CBC's: N workers over a shared
node heap, incumbent and pseudocost arrays, each worker on its own
problem copy + LP (reduced-cost fixing mutates column bounds, and a
factor's solve scratch belongs to the LP that built it). Nodes crossing
the shared heap carry a Portable() basis — status/values only, no
factorization — and the receiving worker refactorizes, the same
contract as CBC handing CoinWarmStartBasis between threads. Each
worker re-applies reduced-cost fixing when another worker tightens the
incumbent. In-tree cut generation stays serial-only (local cut rows
would be dangling row indices in other workers' problems).
Serial (Threads<=1) runs the same treeSearch code path with
uncontended locks: 018/020/021 keep bit-identical nodes, pivots and
objectives vs main (7/31746, 774/182619, 3/62278).
Benchmarks: 90x30 multi-knapsack 1.58s -> 0.19s at 8 threads (8.4x,
same optimum); 020 10.4s -> 7.8s at 4 threads (1.33x) with the same
node-inflation pattern real CBC shows there (271 -> 832 nodes, 1.25x).
Race detector clean over unit tests and a full threaded 020 solve.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent a5784fc commit 023e6ec
5 files changed
Lines changed: 451 additions & 135 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| |||
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| |||
0 commit comments