pastas.solver.timer.SolveTimer#

class pastas.solver.timer.SolveTimer(*args: Any, max_time: float | None = None, **kwargs: Any)#

Progress indicator for model optimization.

Notes

If the logger is also printing messages to the console the timer will not be updated quite as nicely.

Examples

Print timer and number of iterations in console while running ml.solve():

with SolveTimer() as t:
    ml.solve(callback=t.timer)

This prints the following to the console, for example:

Optimization progress: 73it [00:01, 67.68it/s]

Methods#

timer(p[, n])

Timer callback for ps.solver.LeastSquares.solve().