{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ADAPT-QAOA algorithm\n", "\n", "In this tutorial, we explain the ADAPT-QAOA algorithm introduced in this [paper](https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.4.033029) and show how to implement the algorithm in cudaq.\n", "\n", "In QAOA (explained in this [Tutorial](https://nvidia.github.io/cuda-quantum/latest/applications/python/qaoa.html)), the variational Ansatz consists of $p$ layers, each containing the cost Hamiltonian $H_C$ and a mixer, $H_M$. \n", "$$ \\ket{\\psi_p (\\beta, \\gamma)} = \\left ( \\prod_{k=1} ^p [e^{-i H_M \\beta_k} e^{-i H_C \\gamma_k}] \\right ) \\ket{\\psi_{\\mathrm{ref}}} $$\n", "\n", "where $\\ket{\\psi_{\\mathrm{ref}}} = \\ket{+}^{\\otimes n}$, $n$ is the number of qubits and $\\gamma, \\beta$ are set of variational parameters. If these parameters are chosen such that $$\\braket{\\psi_p (\\beta, \\gamma)| H_C |\\psi_p (\\beta, \\gamma) }$$ is minimized, then the resulting energy and state provide an approximate solution to the optimization problem encoded in $H_C$. In the standard QAOA Ansatz, the mixer is chosen to be a single-qubit X rotation applied to all qubits.\n", "\n", "In ADAPT-QAOA, the single, fixed mixer $H_M$ is replaced by a set of mixers $A_k$ that change from one layer to the next.\n", "$$ \\ket{\\psi_p (\\beta, \\gamma) } = \\left ( \\prod_{k=1} ^p [e^{-i A_k \\beta_k} e^{-i H_C \\gamma_k}] \\right ) \\ket{\\psi_{\\mathrm{ref}}} $$\n", "The ADAPT-QAOA algorithm can be summarized in three steps:\n", "\n", "1- Define the operator set $A_j$ (called the mixer pool, and where $A_j = A^{\\dagger}_j$ and select a suitable reference state to be the initial\n", "state: $\\ket{ \\psi (0) }= \\ket{\\psi_{\\mathrm{ref}}}$; $\\ket{\\psi_{\\mathrm{ref}}} = \\ket{+}^{\\otimes n}$ is chosen as in the standard QAOA\n", "\n", "2- Prepare the current Ansatz $\\ket{\\psi(k-1)}$ and measure the energy gradient with respect to the pool, the $j$th component of which is given by $−i \\braket{\\psi(k-1)|e^{i H_C \\gamma_k} [H_C,A_j] e^{−i H_C \\gamma_k} |\\psi(k-1)}$, where the new variational parameter $\\gamma_k$ is set to a predefined value $\\gamma_0$. For the measurement, we can decompose the commutator into linear combinations of Pauli strings and measure the expectation values of the strings using general variational quantum algorithm methods. If the norm of the gradient is below a predefined threshold, then the algorithm stops, and the current state and energy estimate approximate the desired solution. If the gradient threshold is not met, modify the Ansatz (k) by adding the operator, A(k) , associated with the largest max component of the gradient: $\\ket{\\psi(k)}= e^ {−i A_\\mathrm{max} \\beta_k} e^{−i H_C \\gamma_k} \\ket{\\psi(k-1)}$, where $\\beta_k$ is a new variational parameter\n", "\n", "3- Optimize all parameters currently in the Ansatz $\\beta_m, \\gamma_m = 1, 2, ...k$ such that $\\braket{\\psi (k)|H_C|\\psi(k)}$ is minimized, and return to the second step.\n", "\n", "\n", "Below is a schematic representation of the ADAPT-QAOA algorithm explained above.\n", "\n", "