Atelier des rouesLaboratoire EN
Objets/Documentation

octets22.py

Octets tracés pendant huit recherches de groupe · octets22.py

Télécharger ↓
"""Fresh subprocess per treatment. Trace Python allocations including graph setup."""
from functools import lru_cache
import gc,json,subprocess,sys,tracemalloc
from pathlib import Path
from stables18 import graph


def measure(v,cap,ranks):
    gc.collect();tracemalloc.start()
    adj=graph();mask=((1<<34)-1)&~(1<<v)&~adj[v]
    @lru_cache(maxsize=cap)
    def poly(rem):
        if not rem:return (1,)
        j=max((i for i in range(34) if rem>>i&1),key=lambda i:(rem&adj[i]).bit_count())
        rest=rem^(1<<j);a=poly(rest);b=(0,)+poly(rest&~adj[j])
        return tuple((a[i] if i<len(a) else 0)+(b[i] if i<len(b) else 0) for i in range(max(len(a),len(b))))

Lire dans son contexte

Commentaires

Les commentaires en français et en anglais sont réunis ici.

La discussion reste consultable. J’ouvrirai les participations dès que la protection antispam sera configurée.