smttask.decorators.RecordedIterativeTask#
- smttask.decorators.RecordedIterativeTask(iteration_parameter=None, *, map: Dict[str, str] = None, cache=None, json_encoders=None)#
A specialized RecordedTask, meant for tasks which are repeatedly applied on their own output. Examples would be integrating an ODE by repeatedly applying its discretized update equations, and optimization an objective function by an iterative procedure (e.g. via gradient descent, annealing, or genetic algorithm).
The class variable _iteration_parameter is the name of the parameter which increments by 1 every time the task is applied. It must match a parameter in the Task inputs which has type int.
The advantage over a normal RecordedTask is that when searching for previous runs, it will find output files that were produced with the same parameters but fewer iterations. This allows one to e.g. restart a fit or simulation from a previous stop point.
Warning
This task will only attempt to load the most advanced recorded result. So for example, if there are both results for 10 and 20 iterations on disk, and we ask for >=20 iterations, the task will only attempt to load the latter. Normally this is the desired behaviour, however if the records fo 20 iterations are corrupted or partial, the task will not then attempt to load the results for 10 iterations. Rather, it would start again from 0.
In contrast to other decorators, RecordedIterativeTask cannot be used without arguments.
- Parameters:
map (dict (required)) – Key:value pairs correspond to [output var name]:[input var name]. They describe how modify the input arguments, given the outputs from a previous run, such the final state of that run can be recreated and iterations continued from that point.