Code for Variational Methods for Computing Non-Local Quantum Strategies (arXiv).
If you're interested in the strategy circuits for benchmarking hardware or any other applications, they can be found in the circuits/ folder. There's 3 subfolders:
4q/: The original perfect strategy with the large 4-qubit unitary operators.bell_pair/: The same strategy as4q, except that the state preparation circuit has been greatly reduced to 2 Bell pairs.ghz/: (Don't use this one)An imperfect strategy (V(G) = 0.9921) with the GHZ state shared instead.
Each folder contains an OpenQASM file for each possible question pair, with the filenames taking the form circuit_{va}_{vb}.qasm. va and vb correspond to vertex indices on the G14 graph.
The examples/ folder contains different scripts that use the nonlocal games library.
dpo/: Script for executing multiple trials of DPO on the NPS game in parallelg14/: Program that runs multiple trials of DPO on G14 in parallelg14_on_ibm/: Dispatches a strategy for G14 onto multiple IBM quantum devices. See this if you're interested in loading the G14 circuit. Also contains examples for zero-noise extrapolation (ZNE), but this is not in the paper.
Look at data/metadata.md for details.
You can install this package with $ pip install .
This package depends on a custom implementation of ADAPT-VQE called adaptgym that's tailored to another project (currently private code). You can find an implementation of ADAPT here or roll your own. When you see code like
env = AdaptGame(...)
env.reset()
while not done:
env.step(0)this is equivalent to running ADAPT, with each step() call corresponding to adding the operator with the highest gradient.
This package has a few tests that rely on the pytest framework. You can run them with $ pytest.
