add save and load function for classes.

This commit is contained in:
wls2002
2024-06-09 20:33:02 +08:00
parent 374c05f5b7
commit 52e5d603f5
13 changed files with 70 additions and 42 deletions

View File

@@ -1,12 +1,7 @@
from utils import State
from utils import State, StatefulBaseClass
class BaseAlgorithm:
def setup(self, state=State()):
"""initialize the state of the algorithm"""
raise NotImplementedError
class BaseAlgorithm(StatefulBaseClass):
def ask(self, state: State):
"""require the population to be evaluated"""
raise NotImplementedError