CheckpointMixin
- class negmas.checkpoints.CheckpointMixin[source]
Bases:
object
Adds the ability to save checkpoints to a
NamedObject
Methods Summary
Should be called at the end of the simulation to save the final state
checkpoint_init
([step_attrib, every, ...])Initializes the object to automatically save a checkpoint
Should be called on every step to save checkpoints as needed.
Methods Documentation
- checkpoint_final_step()[source]
Should be called at the end of the simulation to save the final state
- Remarks:
Should be called after all processing of the final step is conducted.
- checkpoint_init(step_attrib='current_step', every=1, folder=None, filename=None, info=None, exist_ok=True, single=True)[source]
Initializes the object to automatically save a checkpoint
- Parameters:
step_attrib (
str
) – The attribute that defines the current step. If None, there is no step conceptevery (
int
) – Number of steps per checkpoint. If < 1 no checkpoints will be savedfolder (
PathLike
|Path
|str
|None
) – The directory to store checkpoints underfilename (
str
|None
) – Name of the file to save the checkpoint under. If None, a unique name will be chosen. Ifsingle_checkpoint
was False, then multiple files will be used prefixed with the step numberinfo (
dict
[str
,Any
] |None
) – Any extra information to save in the json file associated with each checkpointexist_ok (
bool
) – Override existing files if anysingle (
bool
) – If True, only the most recent checkpoint will be kept
Remarks:
single_checkpoint implies exist_ok