Atelier des rouesLab FR
Objects/Documentation

partition10.py

I provide the computation for “Assigning each phase to its first surviving path”.

Download ↓
"""Partition phase space by the first live path and check a public graph instance."""
from collections import Counter,deque
from itertools import product
from pathlib import Path
import csv,json
def partition(paths,ps):
    dp={(1<<len(paths))-1:1};sizes=[]
    for p in ps:
        nxt=Counter()
        for r in range(p):
            survive=sum(1<<i for i,path in enumerate(paths) if all(x%p!=r for x in path))
            for m,n in dp.items():nxt[m&survive]+=n
        dp=nxt;sizes.append(len(dp))
    first=Counter()
    for mask,weight in dp.items():first[(mask&-mask).bit_length()-1]+=weight
    oracle=Counter()

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.