Commit 25129a2
committed
fix: correct UB and swapped bindings in set_cover pybind11 wrapper
Fix three bugs in ortools/set_cover/python/set_cover.cc:
1. VectorIntToVectorSubsetIndex: std::transform wrote to begin() of an
empty vector (undefined behavior). Added reserve() + back_inserter().
2. all_subsets property: same empty-vector UB pattern. Same fix.
3. GuidedTabuSearch: set_lagrangian_factor was bound to GetLagrangianFactor
and vice versa.
Added regression tests for all three code paths.1 parent dde278d commit 25129a2
2 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
| 207 | + | |
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
| |||
555 | 558 | | |
556 | 559 | | |
557 | 560 | | |
558 | | - | |
| 561 | + | |
559 | 562 | | |
560 | | - | |
| 563 | + | |
561 | 564 | | |
562 | 565 | | |
563 | 566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
225 | 254 | | |
226 | 255 | | |
227 | 256 | | |
| |||
0 commit comments