cycle - How can I control the maximum time the algorithm runs?