|
| 1 | +from inflation import InflationProblem, InflationSDP |
| 2 | +import numpy as np |
| 3 | + |
| 4 | + |
| 5 | +def ring_problem(inflation_level: int, nof_outcomes: int = 2) -> InflationProblem: |
| 6 | + inf_prob = InflationProblem( |
| 7 | + dag={"i1": ["A"], |
| 8 | + "i2": ["A"], }, |
| 9 | + outcomes_per_party=(nof_outcomes,), |
| 10 | + settings_per_party=(1,), |
| 11 | + classical_sources=None, |
| 12 | + inflation_level_per_source=(inflation_level,inflation_level), |
| 13 | + order=["A"], |
| 14 | + really_just_one_source=True) |
| 15 | + return inf_prob |
| 16 | + |
| 17 | + |
| 18 | +prob = ring_problem(4, 2) |
| 19 | +prob.add_symmetries(prob._setting_specific_outcome_relabelling_symmetries) |
| 20 | + |
| 21 | +from postquantum_2outcomes import prob_line, prob_loop |
| 22 | + |
| 23 | +ring_SDP = InflationSDP(prob, verbose=2, include_all_outcomes=False) |
| 24 | +ring_SDP.generate_relaxation("physical2") |
| 25 | + |
| 26 | +print("Quantum inflation **nonfanout/commuting** factors:") |
| 27 | +print(ring_SDP.physical_atoms) |
| 28 | + |
| 29 | +values={ |
| 30 | + 'P[A^{1,1}=0]': prob_loop(1), |
| 31 | + 'P[A^{1,2}=0]': prob_line(1), |
| 32 | + 'P[A^{1,2}=0 A^{2,1}=0]': prob_loop(2), |
| 33 | + 'P[A^{1,2}=0 A^{2,3}=0]': prob_line(2), |
| 34 | + 'P[A^{1,2}=0 A^{2,3}=0 A^{3,1}=0]': prob_loop(3), |
| 35 | + 'P[A^{1,2}=0 A^{2,3}=0 A^{3,4}=0]': prob_line(3), |
| 36 | + 'P[A^{1,2}=0 A^{2,3}=0 A^{3,4}=0 A^{4,1}=0]': prob_loop(4) |
| 37 | +} |
| 38 | +ring_SDP.update_values(values=values, only_specified_values=False) |
| 39 | +print(ring_SDP.known_moments) |
| 40 | + |
| 41 | +ring_SDP.solve(solve_dual=False) |
| 42 | +print(ring_SDP.status) |
| 43 | + |
0 commit comments