timer#
This module contains a timer for model optimization.
The timer prints the time elapsed and number of iterations. Optionally, a maximum solve
time can be specified, to abort long optimizations. This class is not automatically
imported in pastas and requires the tqdm module (pip install tqdm).
Examples
Usage:
from pastas.timer import SolveTimer
with SolveTimer(max_time=60) as t: # max time in seconds
ml.solve(callback=t.timer)
This will print the following to the console:
Optimization progress: 73it [00:01, 67.68it/s]
Exceptions#
Custom Exception when model optimization exceeds threshold. |
Classes#
Progress indicator for model optimization. |