Commit 76d6283
committed
Add checkpoint/resume functionality to EMD solver
Implements pause and resume capabilities for the EMD (Earth Mover's Distance)
solver, allowing long-running optimizations to be interrupted and continued
from their exact state.
Changes:
- Modified EMD_wrap() signature to accept checkpoint parameters for saving
and restoring complete internal solver state (flow, potentials, tree structure)
- Added saveCheckpoint(), restoreCheckpoint(), and runFromCheckpoint() methods
to NetworkSimplexSimple class in network_simplex_simple.h
- Extended emd_c() Cython wrapper to handle checkpoint dictionaries with 12 fields
(10 arrays + 2 scalar arc counts)
- Added 'checkpoint' and 'return_checkpoint' parameters to emd() Python API
- Includes search_arc_num and all_arc_num scalars in checkpoint to preserve
initialization state required by start() method
Tests:
- Added test_emd_checkpoint() for basic save/resume functionality
- Added test_emd_checkpoint_multiple() for multiple pause/resume cycles
- Added test_emd_checkpoint_structure() to verify checkpoint field integrity1 parent d3867c6 commit 76d6283
File tree
6 files changed
+458
-34
lines changed- ot/lp
- test
6 files changed
+458
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
96 | | - | |
97 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
98 | 126 | | |
99 | 127 | | |
100 | 128 | | |
| |||
111 | 139 | | |
112 | 140 | | |
113 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
114 | 151 | | |
115 | 152 | | |
116 | 153 | | |
117 | 154 | | |
118 | 155 | | |
119 | 156 | | |
120 | 157 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | 158 | | |
125 | 159 | | |
126 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
235 | 246 | | |
236 | 247 | | |
237 | 248 | | |
| |||
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
244 | | - | |
| 255 | + | |
| 256 | + | |
245 | 257 | | |
246 | 258 | | |
247 | 259 | | |
| |||
321 | 333 | | |
322 | 334 | | |
323 | 335 | | |
324 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
325 | 373 | | |
326 | 374 | | |
327 | 375 | | |
| |||
345 | 393 | | |
346 | 394 | | |
347 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
348 | 412 | | |
349 | 413 | | |
350 | 414 | | |
| |||
0 commit comments