CheckpointMixin
- class negmas.checkpoints.CheckpointMixin[source]
Bases:
objectAdds the ability to save checkpoints to a
NamedObjectMethods 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() Path | None[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: str = 'current_step', every: int = 1, folder: PathLike | Path | str | None = None, filename: str | None = None, info: dict[str, Any] | None = None, exist_ok: bool = True, single: bool = True)[source]
Initializes the object to automatically save a checkpoint
- Parameters:
step_attrib – The attribute that defines the current step. If None, there is no step concept
every – Number of steps per checkpoint. If < 1 no checkpoints will be saved
folder – The directory to store checkpoints under
filename – Name of the file to save the checkpoint under. If None, a unique name will be chosen. If
single_checkpointwas False, then multiple files will be used prefixed with the step numberinfo – Any extra information to save in the json file associated with each checkpoint
exist_ok – Override existing files if any
single – If True, only the most recent checkpoint will be kept
Remarks:
single_checkpoint implies exist_ok