The QAOA Circuit
The Quantum Approximate Optimization Algorithm (QAOA) is a variational hybrid algorithm for combinatorial optimization. Its quantum circuit alternates between two parameterized layers: a cost unitary that encodes the objective function and a mixer unitary that explores the solution space. Even a single layer () can capture a non-trivial approximation ratio for problems like Max-Cut.
The QAOA structure
Given a cost function over bit strings , the corresponding cost Hamiltonian is diagonal in the computational basis with eigenvalues . QAOA with layers prepares the state
starting from the uniform superposition . Measuring this state and averaging many outcomes gives an estimate of ; a classical outer loop optimizes to maximize that estimate.
Max-Cut on a two-node graph
The simplest non-trivial example is Max-Cut on a graph with two nodes connected by a single edge. The cut value for a bit string is
which equals when the nodes are on opposite sides () and otherwise. In Pauli language,
The cost unitary
The phase separation operator is
The global phase is unobservable. The coupling is implemented with a standard entangling gadget:
Setting gives the sequence , on qubit 1, .
The mixer unitary
The standard mixer is the transverse-field Hamiltonian . Its unitary factorizes as
Each qubit receives an independent rotation.
Full one-layer circuit
Putting it together the QAOA circuit for this graph is:
Written gate by gate:
- on qubit 0, on qubit 1.
- , on qubit 1, .
- on qubit 0, on qubit 1.
Try it
Complete the circuit for fixed angles and . The grader checks the full statevector, so both the cost and mixer layers must be correct.
After a correct run the statevector will have equal-magnitude amplitudes on all four basis states, but the phases differ: the cut states and accumulate a different relative phase from the cost unitary than and do. At these angles all four probabilities are ; tuning and with a classical optimizer (the outer QAOA loop) would tilt the balance toward the optimal cut states.
Sign in on the full site to ask questions and join the discussion.