pastas.timer.SolveTimer#

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

Progress indicator for model optimization.

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]

Notes

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

Methods#

timer(_[, n])

Callback method for ps.Model.solve().