I tried to use the QAOA to solve the MaxCut problem on a 10 nodes weighted graph and run the simulation on qiskit from $p = 1$ to $p = 6$. I was expecting to get closer to the real solution as $p$ grew but I got the opposite. I reached the solution at $p = 3$ and then it started to drift away. Why did it happen?
$\begingroup$
$\endgroup$
6
-
$\begingroup$ What is $p$? If the energy is not at minimum, the weight $B$ assigned for your cost of connections might be too large (or too small), so it might be worth trying to set B to a small (or large) value and check the result. $\endgroup$– JamesCommented Jun 25, 2023 at 0:56
-
$\begingroup$ Few details are missing to understand what’s going on. Do you use a noiseless simulator? $\endgroup$– OhadCommented Jun 25, 2023 at 5:27
-
$\begingroup$ @James $p$ is the depth of the circuit, the number of layers of the QAOA. But if the weight are too large (or too small) why it finds the result at $p=3$? Does it become a problem only for large $p$? $\endgroup$– Mattia ChiurcoCommented Jun 25, 2023 at 8:37
-
$\begingroup$ @Ohad I am using the ibmq_qasm_simulator without noise. $\endgroup$– Mattia ChiurcoCommented Jun 25, 2023 at 8:37
-
$\begingroup$ What optimizer do you use? Is the number of optimizer iterations in each execution with different $p$ is constant? $\endgroup$– OhadCommented Jun 27, 2023 at 10:24
|
Show 1 more comment
1 Answer
$\begingroup$
$\endgroup$
4
If the angles that were selected are not good enough, you could get worse approximation ratios as p increases. Assuming that you do not have optimal angles for each round p, what angle finding strategy did you use? Increasing the amount of computation for the angle finding could make your results better.
-
$\begingroup$ I let the algorithm choose the starting angles randomly. What strategy would you recommend to improve results? $\endgroup$ Commented Jun 26, 2023 at 7:44
-
$\begingroup$ Starting angles being random is fine - in fact it is probably a good choice because we usually do not really know what good angles might be a-priori. But the important thing is how good angles are learned. You could brute-force good angle combinations, but that costs quite a bit. There are a number of classical machine learning algorithms that are reasonably good, which one works best depends on your problem and the number of parameters etc. Qiskit has a library of some good classical optimizers $\endgroup$ Commented Jun 26, 2023 at 19:23
-
$\begingroup$ I am using the COBYLA optimizer from that library with tolerance $10^{-4}$ COBYLA(tol=1e-4) $\endgroup$ Commented Jun 27, 2023 at 16:05
-
1$\begingroup$ Yeah that is certainly a reasonable choice. It could be that the optimizer does not always find good angles though. Maybe try re-executing the learning procedure and see if the resulting angles agree. Or maybe try increasing the maxiter parameter. The relevant question is if you find very good angles and increasing p does not improve the mean approximation ratio, then there is a problem in the QAOA circuit. But I am guessing it just the angle finding being difficult. $\endgroup$ Commented Jun 27, 2023 at 20:12