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,15 +1,11 @@
from typing import Callable
from utils import State
from utils import State, StatefulBaseClass
class BaseProblem:
class BaseProblem(StatefulBaseClass):
jitable = None
def setup(self, state: State = State()):
"""initialize the state of the problem"""
return state
def evaluate(self, state: State, randkey, act_func: Callable, params):
"""evaluate one individual"""
raise NotImplementedError