Objets/Documentation
identification.py
Je fournis le calcul pour « Une observation suffit à lever une ambiguïté de connexion ».
Télécharger ↓"""How many named relay assignments remain compatible with the observed events?"""
from fractions import Fraction as F
from itertools import permutations
import json
from experience import score,FIRST
def compatible(groups,teachers):
if teachers is None: return list(permutations(range(4)))
return [p for p in permutations(range(4)) if all({p[i] for i in group}==obs for group,obs in zip(groups,teachers))]
def experiment():
groups=[(0,1),(2,),(3,)]
targets=[{FIRST[i] for i in group} for group in groups]
stages=[compatible(groups,None),compatible(groups,targets),compatible(groups+[(0,)],targets+[{FIRST[0]}])]