This is the repo accompanying the paper End-to-End Protocol for High-Quality QAOA Parameters with Few Shots. The data is available at https://doi.org/10.5281/zenodo.12209739.
reproduce_figures/ contains notebooks that can reproduce all the figures used in the paper. They rely on files in data/ (moved to Zenodo to shrink the size of the repo), which can be obtained by executing the following scripts:
run_landscape.pyandbenchmark_optimizerfor optimizer benchmarkingbenchmark_cobyla.pyfor COBYLA hyperparameter search and shot budget allocation study
The configurations of benchmark_optimizer and benchmark_cobyla are controlled by command-line arguments:
--problemspecifies the problem, can be "maxcut", "po", or "skmodel".-nspecifies the number of variables/qubits of the problem instance.-pspecifies the number of QAOA layers.-s--seedcontrols the number of problem instances generated.
Additionally,
-
benchmark_optimizer.pyhas-r--repsthat controls how many times an optimization configuration is executed. -
benchmark_cobyla.pyhas-
-t--targetthat specifies its behavior.- "rhobeg" grid searches the initial step size with exact simulation.
- "max_ar" optimizes for the highest achievable AR for each instance with exact simulation.
- "budget" grid searches budget allocation strategies (combinations of numbers of evaluations and numbers of shots per evaluation, given a total shot budget) with shot-based simulation.
- "opt2steps" optimizes for 2 iterations after the initial
$2p+1$ evaluations.
-
-b--batchgroups many instances (seeds) into batches (useful for parallel execution). -
--cpuif provided, use the cpu implementation of theqokitsimulator. Default uses GPU. -
--no-precomputecontrols whether the energies are precomputed for the simulator. In most of the cases, this flag should not be specified (so that we have min and max values to compute the AR), but for extreme-scale simulations, it might be favorable to let a GPU implementation do the computation. -
--fix-betaif provided, fix the beta parameters and only optimize for gamma.
-
The configurations of landscapes in run_landscape.py and benchmark_optimizer.py can be specified with in-file variables.
pip install -r requirements.txt will install all required packages. See a list of descriptions below.
numpy
matplotlib
networkxyfinance
scipynloptscikit-quantpdfo
qokit: https://github.com/jpmorganchase/QOKit/tree/std (Thestdbranch is needed for computing the standard deviation of the energy)
oscar: https://github.com/QUEST-UWMadison/OSCAR (benchmark_optimizer.py,run_landscape.py, andreproduce_figures.ipynbneed version1.0.x;benchmark_cobylaneeds version0.4.x(commit4f65fc3); both are included inrequirements.txt)