Esempio n. 1
0
def __main__():
    # chsh quantum bound : 4
    # mermin quantum bound : 4
    # svetlichny quantum bound 4sqrt(2) ~ 5.65

    P = Probability([2, 2], [2, 2], [2, 2])
    Chsh = chsh(P)
    Mermin = mermin(P)
    Svetlichny = svetlichny(P)

    dx = 0
    div = 1.0
    step = 0.4
    lim = 5.6
    x = []
    y = []
    while dx <= lim:

        print(dx)
        ineq = []
        ineq.append(Svetlichny - dx)
        ineq.append(-1 * Svetlichny + dx)
        sdpRelaxation = SdpRelaxation(P.get_all_operators(), verbose=0)
        sdpRelaxation.get_relaxation(2,
                                     substitutions=P.substitutions,
                                     inequalities=ineq)
        sdpRelaxation.set_objective(-Chsh)
        solve_sdp(sdpRelaxation, solver="cvxopt")
        x.append(dx)
        y.append(abs(sdpRelaxation.primal) / div)
        dx = dx + step

    plt.plot(x, y, 'k')
    plt.show()
Esempio n. 2
0
def __main__():   
  # chsh quantum bound : 4
  # mermin quantum bound : 4
  # svetlichny quantum bound 4sqrt(2) ~ 5.65 

  P = Probability([2, 2], [2, 2], [2, 2])
  Chsh = chsh(P)
  Mermin = mermin(P)
  Svetlichny = svetlichny(P)
   
  dx = 0
  div = 1.0
  step = 0.4
  lim = 5.6
  x = []
  y = []
  while dx  <= lim :
  
    print (dx)
    ineq = []
    ineq.append(Svetlichny - dx)
    ineq.append(-1*Svetlichny + dx)
    sdpRelaxation = SdpRelaxation(P.get_all_operators(), verbose=0)
    sdpRelaxation.get_relaxation(2, substitutions = P.substitutions,inequalities = ineq)
    sdpRelaxation.set_objective(-Chsh)
    solve_sdp(sdpRelaxation, solver="cvxopt")
    x.append(dx)
    y.append(abs(sdpRelaxation.primal)/div)
    dx = dx + step 

  plt.plot(x,y,'k')   
  plt.show()