Computing triangulations fails

asked 2024-06-04 14:01:37 +0100

fkoechlin gravatar image

updated 2024-06-10 20:43:27 +0100

tmonteil gravatar image

Hello everyone,

I hope this is the correct place to report a possible bug, sorry if I should have reported elsewhere.

I ran into some trouble with a sage function computing triangulations.

To give you an example, the following code does not seem to terminate on my work computer (and it makes Sage crash on my personal computer or on online sage servers due to the lack of ram (4 or 8GB)).

PointConfiguration.set_engine('internal');
points = [[64374, 1170],[28595,16],[1162, 658], [28874, 3308], [29974, 9436], [30590, 22299], [49434, 11393], [56042, 11982], [42392, 33338], [33404, 64878]];
p = PointConfiguration(points);
p_fine = p.restrict_to_fine_triangulations();
list_triangulations = list(p_fine.triangulations()) #does not seem to terminate in a reasonable amount of time

On my computer, it seems that the iterator p_fine.triangulations() is able to compute the first 1477 triangulations (out of 2002 triangulations), but fails to compute the 1478th. The points are in generic position, in the sense that the points are pairwise distinct and no three points are aligned.

To give you more context, I tested the triangulations() method on many configurations of 10 points coming from the database of order points available on Oswin Aichholzer's website (I do not have enough karma to publish a link). That is how I found several configurations for which the iterator computing fine triangulations seemed to not terminate (or at least take an excessive amount of memory and time).

Best regards,

Florent

edit retag flag offensive close merge delete

Comments

I can confirm I have the same issue on SageMath version 10.2:

sage: # define p_fine as above
sage: it = p_fine.triangulations()
sage: for i in range(1475): _ = next(it)
sage: next(it)
(<0,1,4>, <0,4,5>, <0,5,6>, <0,6,7>, <0,7,8>, <0,8,9>, <1,2,9>, <1,3,5>, <1,3,9>, <1,4,5>, <3,5,9>, <5,6,8>, <5,8,9>, <6,7,8>)
sage: next(it)
(<0,1,6>, <0,6,7>, <0,7,9>, <1,2,3>, <1,3,6>, <2,3,6>, <2,4,5>, <2,4,6>, <2,5,9>, <4,5,6>, <5,6,8>, <5,8,9>, <6,7,9>, <6,8,9>)
sage: next(it)
Killed
Sébastien gravatar imageSébastien ( 2024-06-06 22:31:28 +0100 )edit

@fkoechlinhttps://ask.sagemath.org/ is indeed a possible place for end users to report issues. Such questions can be tagged https://ask.sagemath.org/questions/sc... one the issue is confirmed and reported and https://ask.sagemath.org/questions/sc... once the issue is fixed.

@Sebastien i do not have a github account to do that myself.

@both it is not clear that there is a bug here. I did not look at the source code, but if it relies on some backtracking algorithm, it is frequent that at after exploring a prolific part of the tree, the algorithm has to explore a huge branch that does not provide anything interesting. I saw that behaviour in some other context.

How long did you wait ?

tmonteil gravatar imagetmonteil ( 2024-06-07 21:01:36 +0100 )edit

In my case, on my recent laptop, it's not me that kills it. The operation kills itself after less than 1 second.

On my older machine, the computation hangs and mentions a memory issue:

------------------------------------------------------------------------
cysignals fork: Cannot allocate memory
Unhandled SIGABRT: An abort() occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Aborted
Sébastien gravatar imageSébastien ( 2024-06-10 13:57:47 +0100 )edit

I created issue #38187 on github

Sébastien gravatar imageSébastien ( 2024-06-10 14:33:57 +0100 )edit

Hi, sorry for the delay, as I was at a conference I forgot to check the notifications.

@tmonteil I had two possible behaviours : either sage gets killed automatically (on my current old laptop), or the program uses a huge amount of ram and seems to loop (on my postdoc computer that I do no have anymore). I don't remember how long I waited, but I think I waited at least one hour. I cannot reproduce it for the moment as with my current laptop sage gets killed after a few seconds.

@Sébastien Thank you for handling the report on github!

fkoechlin gravatar imagefkoechlin ( 2024-06-17 17:54:01 +0100 )edit