Atelier des rouesLab FR
Objects/Documentation

packing32.py

Minimality on the grid · packing32.py

Download ↓
"""Test every possibility for six or seven refusal points in the archived finite clause pool."""
from itertools import combinations
from clauses32 import family
from union30 import transversal
import json
def study(catalogue=None):
    pool,clauses=family() if catalogue is None else catalogue;n=len(clauses);allbits=(1<<n)-1
    neighbours=[sum(1<<j for j,b in enumerate(clauses) if not a&b) for a in clauses]
    def indices(bits):
        while bits:
            bit=bits&-bits;bits-=bit;yield bit.bit_length()-1
    def independent(selected,future,size):
        if len(selected)==size:
            yield selected;return
        for i in indices(future):
            after=future&~((1<<(i+1))-1)&neighbours[i]

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.