[GAP Forum] Run GAP command for x seconds

Carl-Fredrik Nyberg Brodda (MTH - Postgraduate Researcher) C.Nyberg-Brodda at uea.ac.uk
Wed Jan 27 16:54:03 GMT 2021


Hi,

Thank you for your response. I am having trouble getting the timeout to work. Do you have an example of using the timeout?

I have attempted to pass the last (third, optional) argument of ParTakeFirstResultByFork as rec(TimeOut := rec(tv_sec :=2, tv_usec := 0)), hoping for my execution to run for 2 seconds, but this does not work (it never times out). I have also tried setting the tv_sec record to be the current time (plus 10 seconds or so), but this does not time out either.

Best,
Carl-Fredrik Nyberg Brodda
________________________________
From: Frank Lübeck <frank.luebeck at math.rwth-aachen.de>
Sent: Wednesday, January 27, 2021 3:53 PM
To: Carl-Fredrik Nyberg Brodda (MTH - Postgraduate Researcher) <C.Nyberg-Brodda at uea.ac.uk>
Cc: forum at gap-system.org <forum at gap-system.org>
Subject: Re: [GAP Forum] Run GAP command for x seconds

Warning: This email is from outside the UEA system. Do not click on links or attachments unless you expect them from the sender and know the content is safe.

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.Luebeck at Math.RWTH-Aachen.De
\\\  WWW:    https://eur01.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.math.rwth-aachen.de%2F~Frank.Luebeck%2F&amp;data=04%7C01%7CC.Nyberg-Brodda%40uea.ac.uk%7C81fad673503f44d5ed4108d8c2dbafe5%7Cc65f8795ba3d43518a070865e5d8f090%7C0%7C0%7C637473596109600890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=VM4Ge%2BdYctlZfYeoatsL8ByD1Y4AIR04LgRYmsbzUl0%3D&amp;reserved=0


More information about the Forum mailing list