In the last blog, we talked about the Quantum Adiabatic Algorithm (QAA) and used it solve the MIS problem. Here, we will discuss the Quantum Approximation Optimization Algorithm (QAOA) which is popular algorithm in the gate based quantum computing. We will use QAOA to solve the same MIS problem that we tackled in the last blog.
Algorithm description
In QAOA, we start with an eigenstate of the mixer hamiltonian. We then exponentiate and parameterize in steps by betas and gammas:
where betas and gammas are to be optimized with a classical opitimizer. Here and . Remember and are the mixer and cost hamiltonian respectively. The idea here is that instead of having a continuous evolution, we evolve with one hamiltonian at a time or and repeat it for steps.
Comparing with QAA
The figure below from ( Citation: Verdon, Broughton & al., Verdon, G., Broughton, M. & Biamonte, J. (n.d.). A quantum algorithm to train neural networks using low-depth circuits. ) , shows how the control function is continuous slow varying function in QAA, while in QAOA, we have discretized control function so we evolve with and alternatively.

The discretized control function can be written as
At the begining, will be dominationg, so betas will be large and gammas will be small. This way, the control function will tend to the value of 1. In the end, gammas will increase making the control funciton to zero thereby dominating .
Implementation
We build parameterized sequences in pulser to implement the alternating hamiltonians and . Remember the expression for the global hamiltonian
We can observe that the is defined when the laser is turned on and detuning is turned off i.e. . Therefore to implement a beta pulse for the mixer hamiltonian, we choose . In constrast, for the cost hamiltonian we choose . The parameters control the duration of pulses which will be optimized by the classical optimizer.

Pulses for and with random parameters for 2 alternating layers
The cost function which we aim to minimize remains the same that we used in QAA
To implement this cost for QAOA, we can represent it as follows
where A is the adjacency matrix of the graph , is the penalty coefficient and is a binary vector representing the nodes in the independent. We consider only the upper triangular matrix of A otherwise the cost function will count the node connections twice. We use the Nelder-Mead classical optimizer from scipy. Simulation results into the following historgram of counts.
The bitstring with maximum counts is 1010011
which is indeed the MIS for the given graph. The set of nodes is . The optimal parameters result into the following pulses.

Pulses for and with optimized parameters
Compared to QAA, QAOA is not much effective. Although, increasing the number of layers can boost the probability of success, it comes at the cost of high depths.
The code to reproduce the figures can be found here. A more general tutorial is available in the Pulser’s docs ( Citation: Pasqal, Pasqal, P. (n.d.). QAOA and QAA to solve a QUBO problem. Retrieved from https://pulser.readthedocs.io/en/stable/tutorials/qubo.html ) .
References
- Pasqal (n.d.)
- Pasqal, P. (n.d.). QAOA and QAA to solve a QUBO problem. Retrieved from https://pulser.readthedocs.io/en/stable/tutorials/qubo.html
- Verdon, Broughton & Biamonte (n.d.)
- Verdon, G., Broughton, M. & Biamonte, J. (n.d.). A quantum algorithm to train neural networks using low-depth circuits.