Engine.update(n_iters: int, *, timeout: int | None = None, checkpoint: int | None = None, transitions: StateTransition | None = None, save_path: str | bytes | PathLike | None = None, quiet: bool = False)

Update the Engine by advancing the Markov chains.

  • n_iters (int) – The number of iterations, or steps, to advance each chain (state)

  • timeout (int, optional) – The timeout in seconds, which is the maximum number of seconds any state should run. Note that if you have fewer cores than states (which is usually how it goes), then the update will run for longer than the timeout because not all the states will be able to run at the same time. If timeout is None (default), the run will stop when all requested iterations have been completed.

  • checkpoint (int, optional) – The number of iterations between saves. If save_path is not supplied checkpoints do nothing.

  • transitions (List[StateTransition], optional) – List of state transitions to perform. If None (default) a default set is chosen.

  • save_path (pathlike, optional) – Where to save the metadata. If None (default) the engine is not saved. If checkpoint is provided, the Engine will be saved at checkpoints and at the end of the run. If checkpoint is not provided, the Engine will save only at the end of the run.


Simple update for 100 iterations

>>> from lace.examples import Animals
>>> engine = Animals()
>>> engine.update(100)

Perform only specific transitions and set a timeout of 30 seconds

>>> from lace import RowKernel, StateTransition
>>> engine.update(
...     100,
...     timeout=30,
...     transitions=[
...         StateTransition.row_assignment(RowKernel.slice()),
...         StateTransition.view_alphas(),
...     ],
... )