Atelier des rouesLaboratoire EN
Objets/Documentation

strate29.py

Un polynôme pour les calendriers à deux visites par résidu actif · strate29.py

Télécharger ↓
"""Count the (2,0,2) repeated stratum by a four-cycle of pair compatibility matrices."""
from itertools import combinations
from functools import lru_cache
from longueurs28 import transfer
import json
from math import comb
def accepts(times,N,k):
    # Visit times have prescribed shifts. An automaton enforces both boundary dwells.
    fixed=dict(times);states={(s,0,0) for s in (-1,0,1)}
    for slot in range(N):
        new=set()
        for s,age,c in states:
            for v in (s,) if age<2 or c==k else (-1,0,1):
                if slot in fixed and fixed[slot]!=v:continue
                new.add((v,min(2,age+1) if v==s else 1,c+int(s!=v)))
        states=new

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.