mqt.core.bench.qaoa¶
QAOA benchmark instances and options.
Module Contents¶
- class Options(*, qubits: int, depth: int = 1)¶
Parameters for a QAOA benchmark for MaxCut.
- class Evaluation¶
The sampled cut quality on a cycle graph.
- class QAOA(options: Options)¶
A validated QAOA benchmark for MaxCut.
The circuit starts in \(|+\rangle^{\otimes n}\) on an unweighted cycle. Each layer applies \(e^{-i\gamma_\ell C}\) followed by \(e^{-i\beta_\ell B}\), where \(C=\sum_{j=0}^{n-1}(1-Z_jZ_{(j+1)\bmod n})/2\) and \(B=\sum_{j=0}^{n-1} X_j\).
For \(d\) layers, the generated program takes two arrays of \(d\) angles:
gammasandbetas. Bind angles in radians withmqt.core.mlir.QCProgram.bind_parameters()before sampling or export. Copy the program first to reuse it for other angles.The benchmark does not run an optimizer. Evaluation measures cut quality, not agreement with an ideal output distribution.
- evaluate(counts: Mapping[str, int]) Evaluation¶
Compute the mean cut and its ratio to the maximum cut size.