Skip to content

Refactor Generator Checkpointing into Reusable Class - #454

Open
electronsandstuff wants to merge 5 commits into
xopt-org:mainfrom
electronsandstuff:pierce/ga-outputs
Open

Refactor Generator Checkpointing into Reusable Class#454
electronsandstuff wants to merge 5 commits into
xopt-org:mainfrom
electronsandstuff:pierce/ga-outputs

Conversation

@electronsandstuff

Copy link
Copy Markdown
Collaborator

This PR moves the checkpointing feature in NSGA2Generator out into a new class to allow for reuse and enable new genetic algorithms with similar output to be created.

  • New class CheckpointMixin containing attribute checkpoint_file allowing end users to load their checkpoints.
    • Validator load_from_checkpoint which loads the data from the checkpoint and merges with other data from YAML file
    • _save_checkpoint callable by the generator to save a new checkpoint. The idea is that when checkpoints are saved is implementation specific.
  • While implementing, I realized that with Xopt 2.0, VOCS object is serialized with the generator, meaning that the previous workaround of saving a vocs.txt is no longer required. I have migrated the checkpoint system to not save, and to load from the full generator checkpoint instead. If it is not present (as in an old checkpoint is being loaded) it will still search for ../vocs.txt for legacy support.
  • New unit tests confirming that the checkpointing feature works.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant