QAOA Max cut convergence issue

In the given link, I have been implementing Max-cut for Weighted Graph using QAOA. But even if, i’m getting the correct answer with steps 50 for layer 1&2. Although it is opposite to it Also, the objective function, you can see it’s not properly converging, so any suggestion for it?

Thanks for looking on it. And let me know if the link is not opening or code is not visible

Hi @roysuman088,

There are many possible reasons for this.

It’s possible that the optimizer or step that you’re using is not the best choice. It’s possible that your landscape is very flat so maybe modifying the cost function can help. It’s also possible that your ansatz or embedding aren’t great for this problem. Or maybe it’s the fact that you’re using a single shot so there’s a lot of stochasticity there. I would suggest looking at each of these items one at a time.

Your problem also seems quite large so there may be a deeper problem there.

Regarding the cost function option, maybe this demo on local cost functions can help. However I would start by increasing the number of shots significantly.

Please let me know if any of these options work for you!