Run GAP calculation for fixed time

91 Views Asked by At

Is there a way to make gap stop a calculation after a certain amount of time?

I'm using an algorithm which is not guaranteed to terminate. But on (small) cases it will be either stop in under a second or run forever. In the moment I start the calculation and if it hasn't stop in, say 10 seconds, I break it manually with CTRL-C. But I would like to have a larger set of elements where the algorithm (probably) won't stop.

1

There are 1 best solutions below

1
On BEST ANSWER

There are CallWithTimeout and CallWithTimeoutList - see documentation here. They were introduced in GAP 4.8. Some examples of usage are in tst/teststandard/timeout.tst file in your GAP installation. It should do what you want.