|
Algorithm 4 QAOA solving optimization. |
-
Input:
the problem Hamiltonian , the mixing Hamiltonian .
-
Output:
the ground state of .
-
1:
Prepare the quantum register into .
-
2:
Choose the initial parameters , . Perform and alternately and obtain .
-
3:
Measure the quantum registers and calculate the cost function.
-
4:
Repeat Step 2 and Step 3 several times and calculate the expectation value of the cost function.
-
5:
Pass the expectation value and parameters to a classical optimizer. Update the parameters .
-
6:
Repeat Steps 2–5 until the result meets a fixed threshold and the parameters are updated to .
-
7:
return
|