On Wed, Jan 27, 2021 at 02:53:14PM +0000, Carl-Fredrik Nyberg Brodda (MTH - Postgraduate Researcher) wrote: > Hi all, > > A problem which I recently stumbled upon is the following: is there a way > to execute a given GAP command only for a certain amount of time, before > stepping past the command and continuing execution? > > Let us say I have a table of finitely many finitely presented groups, > and wish to see whether GAP has a "naive" solution for their word > problem. I find a KnuthBendixRewritingSystem() of the group, and then run > MakeConfluent() on this rewriting system. Of course, this process may not > terminate at all! But sometimes it does. My problem is essentially that > I wish to run MakeConfluent() for some amount of time (say 5 seconds), > and then, if the command has not terminated, continue on with the next > group. This avoids all decidability issues, and would in other programming > languages be easily implemented with a timer. > > Of course the problem is general, so the above is just a use-case. Is > there something that can help with this? > > Best, > Carl-Fredrik Nyberg Brodda
Dear Forum, I have used successfully the function ParTakeFirstResultByFork from the IO package for this kind of applications. It has an optional third argument which allows to specify a timeout. Best regards, Frank -- /// Dr. Frank Lübeck, Lehrstuhl für Algebra und Zahlentheorie, \\\ Pontdriesch 14/16, 52062 Aachen, Germany /// E-mail: frank.lueb...@math.rwth-aachen.de \\\ WWW: http://www.math.rwth-aachen.de/~Frank.Luebeck/ _______________________________________________ Forum mailing list Forum@gap-system.org https://mail.gap-system.org/mailman/listinfo/forum