Checkpoint.py 625 B

12345678910111213141516171819202122232425262728
  1. # main imports
  2. import os
  3. import logging
  4. class Checkpoint():
  5. def __init__(self, _algo, _every, _filepath):
  6. self.algo = _algo
  7. self.every = _every
  8. self.filepath = _filepath
  9. # build path if not already exists
  10. head, tail = os.path.split(self.filepath)
  11. if not os.path.exists(head):
  12. os.makedirs(head)
  13. def run(self):
  14. """
  15. Check if necessary to do backup based on `_every` variable
  16. """
  17. pass
  18. def load(self):
  19. """
  20. Load last backup line of solution and set algorithm state at this backup
  21. """
  22. pass