Quantum Approximate Optimization Algorithm¶
Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
Overview¶
Quantum Approximate Optimization Algorithm (QAOA) is a quantum algorithm that can run on recent Noisy Intermediate-Scale Quantum (NISQ) devices and has a wide range of applications. QAOA was proposed by Edward Farhi et al. in 2014 [1], and its purpose is to solve combinatorial optimization problems approximately.
Combinatorial optimization problem¶
In applied mathematics and theoretical computer science, combinatorial optimization is a type of topic that finds the optimal object in a discrete set of objects. In simple terms, the combinatorial optimization problem means that all solutions of the problem are composed of discrete variables, and the optimal solution is to be found in the discrete solution set. Combinatorial optimization problems involve a wide range of areas and are common in real life, such as the design of aircraft routes and the planning of express delivery routes.
Specifically, a combinatorial optimization problem can be described by bits and clauses. Each bit is a binary variable whose value is or , and we use to denote the value of the th bit. Therefore, the value of these bits can be represented by the bit string . Each clause is a restriction on some bits. For example, a clause can require the value of the nd bit to be , or it can require the value of the rd bit and the th bit to be the same. For the th clause, we define a function
For example, if the first clause requires the value of the second bit to be 0, then we have and .
From the definition of in equation (1), we can define the objective function of the combinatorial optimization problem
where is the weight of the th clause. The combinatorial optimization problem is to find a value that maximizes the value of the objective function , namely
In theoretical computer science, there is a famous problem called the Boolean satisfiability problem (SAT). This problem asks that, given bits and clauses as inputs, if there exists a value these bits can take so that all the clauses are satisfied simultaneously. An optimization problem related to SAT is MAX-SAT, which asks that what value these bits should take so that as many as possible clauses are satisfied. It is worth noting that the way we define a combinatorial optimization problem above is to formulate it as MAX-SAT, or more precisely, weighted MAX-SAT.
Quantum approximate optimization algorithm¶
Many combinatorial optimization problems are NP-complete or even NP-hard problems, which means that computers may not be able to solve such problems efficiently. An alternative is to find the approximate optimal solution to such problems, and this task can usually be completed efficiently. QAOA is a quantum algorithm that can find an approximate optimal solution to a combinatorial optimization problem.
Encoding combinatorial optimization problem¶
For the above combinatorial optimization problem, there are bits and clauses. The QAOA algorithm transforms this problem into an optimization problem on an -qubit system. Each computational basis state of the quantum system corresponds to a value of bits in the original problem. At the same time, for the th clause in the original problem, we define a diagonal Hamiltonian satisfying
Specifically, we can construct the Hamiltonian through the following equation:
For example, assuming that and are the values satisfying the th clause, then we can define
Therefore, QAOA encodes the objective function of the combinatorial optimization problem into the Hamiltonian on a system with qubits, where
and
It is worth noting that if an optimal solution to the original problem is , then we have
Therefore, an optimal solution of the original combinatorial optimization problem is an eigenstate with the largest eigenvalue of the Hamiltonian . In addition, for any quantum state ,
and the equation takes the equal sign if and only if is a superposition state of optimal solutions. It can be obtained from equation (9) and equation (10) that
and finding the optimal solution of the original combinatorial optimization problem is equivalent to finding an eigenstate with the largest eigenvalue of the Hamiltonian , that is, finding a quantum state such that
When we find such a quantum state , it is probably not a computational basis state, but a superposition of several computational basis states, each of which is an optimal solution of the original combinatorial optimization problem. Therefore, we can obtain an optimal solution to the original combinatorial optimization problem by performing computational basis measurements on .
Finding an approximate optimal solution¶
Although it is relatively simple to encode the objective function of the combinatorial optimization problem to be solved into the Hamiltonian of a quantum system, finding the quantum state representing an optimal solution from the huge Hilbert space according to equation (11) is not easy. In order to find such a quantum state, we need another Hamiltonian
where represents the Pauli gate acting on the th qubit. The two eigenstates of Pauli gate are and , and their corresponding eigenvalues are and , respectively:
Therefore, the eigenstate with the largest eigenvalue of is
We will use this quantum state as the initial state for the algorithm. After constructing the Hamiltonian and , we can start to find an approximate optimal solution to the original combinatorial optimization problem. According to the Hamiltonian and , respectively define the unitary transformation
and unitary transformation
where and are adjustable real parameters. Given any integer and the parameters and , we define
It can be seen that the integer represents the number of layers of , that is, the and are alternately applied to the initial state times. Let us denote as the expected value of the Hamiltonian in the quantum state of equation (19):
By adjusting the parameters , we can get
as the approximate optimal solution under a given number of layers . So far, we have transformed the problem of searching for the quantum state into a problem of searching for the parameters . It is worth noting that the search space given by layers of is larger than that of layers, so
In fact, when is large enough,
Decoding the quantum solution¶
In the previous paragraph, we simplify the search for the quantum state into the search for the parameterized quantum state , but at the same time, we have also reduced the search space. That is to say, given the number of layers , there may be no parameters such that . Suppose that the parameters and make the largest, that is, . Then under ideal circumstances, the quantum state contains the information of an optimal solution. But it should be noted that only layers are used here, so it is very likely that . Therefore, in general only contains information about an approximate optimal solution. Furthermore, we assume that the quantum state is the superposition state of computational basis state, namely
Normally, the larger the probability that a state is measured on the computational basis, the more likely that the corresponding bit string is an optimal solution. Thus, we prepare and measure it to get a bit string and calculate the value of . Repeat this process many times, and we can get a bit string that makes close to or even exceed .
Adiabatic theorem¶
Why do we use the above method to construct the quantum state ? QAOA tries to find an approximate optimal solution to an optimization problem. A similar algorithm is the quantum adiabatic algorithm [2] (QAA). The difference is that QAA is designed to find an optimal solution to the optimization problem rather than an approximate one. Similar to QAOA, QAA transforms an optimization problem into a problem of finding the ground state of a Hamiltonian, and uses the adiabatic theorem to solve it. Consider the Hamiltonian
of a quantum system. At initial, time , and the Hamiltonian of the system is . As time passes, the Hamiltonian of the system gradually changes from to . When , the Hamiltonian of the system becomes . The adiabatic theorem in quantum mechanics tells us that if the system is in an eigenstate of at the beginning, then as long as the evolution time is long enough, the system will be in the eigenstate of the corresponding energy level of when the Hamiltonian of the system completely evolves to . Therefore, if the system is initially in , that is, the eigenstate with the largest eigenvalue of , after a sufficiently long evolution time , the quantum state of the system will become the eigenstate with the largest eigenvalue of . [3]
One way to simulate the evolution of the Hamiltonian over time is to alternately apply the unitary transformations and on the quantum system, and the accuracy of simulation depends on the value of . In addition, in order for the evolution of the system to follow the adiabatic theorem, a sufficiently long evolution time is required, so the value of is required to be large enough. Therefore, combining equation (22) we can deduce the conclusion in equation (23).
References¶
[1] Farhi, E., Goldstone, J. & Gutmann, S. A Quantum Approximate Optimization Algorithm. arXiv:1411.4028 (2014).
[2] Farhi, E., Goldstone, J., Gutmann, S. & Sipser, M. Quantum computation by adiabatic evolution. arXiv:quant-ph/0001106 (2000).
[3] Duan, R. Quantum Adiabatic Theorem Revisited. arXiv:2003.03063 (2020).