Skip to content

Conversation

@nathanneike
Copy link

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 integrity

Types of changes

Motivation and context / Related issue

How has this been tested (if it applies)

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

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 integrity
@nathanneike nathanneike changed the title Add checkpoint/resume functionality to EMD solver [WIP]:Add checkpoint/resume functionality to EMD solver Nov 13, 2025
@nathanneike nathanneike changed the title [WIP]:Add checkpoint/resume functionality to EMD solver [WIP] Add checkpoint/resume functionality to EMD solver Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant