On Thu, 1 Oct 2015, Travis Scrimshaw wrote:

But in any case, there is no way to run some codes that iterate over all posets of size n when n is too big. This is because there is no way to ask UniqueRepresentation to release memory. Or --- will gc.collect() do this also?

It does release memory when there are no *strong* references back to the object. A strong reference is would be something like P = Poset({}) or L = [Poset({})], a top-level variable that points to the object in some capacity

OK. Still one small question: is there some way to tweak automatic garbage collection? Like running it if Sage uses more than 4 GB of memory or like?

I have a (non-public) code from Peter Jipsen(*) to compute covering relations for all lattices of given size up to isomorphism. Let's call it Lc. I have done basically

def foobar(L): . . . something interesting here . . .

for x in Lc:
    L = LatticePoset(x)
    if not foobar(L):
        print "Counter-example!"
        L.show()
        break

but this must be modified to

i=0
for x in Lc:
    i += 1
    if i%100000: gc.collect()
     . . .

---

(*) Would be a good addition to SageMath...

--
Jori Mäntysalo

Reply via email to