1+ # import sys
2+ # sys.path.append('/Users/pedrolauand/inflation')
3+ from inflation import InflationProblem , InflationLP , InflationSDP
4+ import numpy as np
5+
6+ def ring_problem (inflation_level : int , nof_outcomes : int = 2 ) -> InflationProblem :
7+ return InflationProblem (
8+ dag = {"i1" : ["A" ],
9+ "i2" : ["A" ], },
10+ outcomes_per_party = (nof_outcomes ,),
11+ settings_per_party = (1 ,),
12+ classical_sources = None ,
13+ inflation_level_per_source = (inflation_level ,inflation_level ),
14+ order = ["A" ],
15+ really_just_one_source = True ) # NEW!!
16+
17+
18+ prob = ring_problem (4 , 2 )
19+ # prob.add_symmetries(prob._setting_specific_outcome_relabelling_symmetries)
20+ ring_SDP = InflationSDP (prob , verbose = 2 , include_all_outcomes = False )
21+ ring_SDP .generate_relaxation ("physical2" )
22+ # ring_SDP = InflationLP(prob, verbose=2)
23+
24+
25+ print ("Quantum inflation **nonfanout/commuting** factors:" )
26+ print (ring_SDP .physical_atoms )
27+
28+
29+
30+ def tetrahedron_problem (inflation_level : int , nof_outcomes : int = 2 ) -> InflationProblem :
31+ return InflationProblem (
32+ dag = {"i1" : ["A" ],
33+ "i2" : ["A" ],
34+ "i3" : ["A" ]},
35+ outcomes_per_party = (nof_outcomes ,),
36+ settings_per_party = (1 ,),
37+ classical_sources = None ,
38+ inflation_level_per_source = [inflation_level ]* 3 ,
39+ order = ["A" ],
40+ really_just_one_source = True )
41+
42+ tet_prob = tetrahedron_problem (5 , 2 )
43+ print (tet_prob ._lexrepr_to_names [::2 ])
44+ tet_LP = InflationLP (tet_prob , verbose = 2 , include_all_outcomes = False )
45+
46+ print ("Nonfanout inflation atomic factors:" )
47+ print (tet_LP .atomic_factors )
0 commit comments