qiskit-community / qiskit-optimization

Quantum Optimization
https://qiskit-community.github.io/qiskit-optimization/
Apache License 2.0
226 stars 139 forks source link

QAOA Runtime method yielding inconsistent results #281

Closed amitracal closed 2 years ago

amitracal commented 2 years ago

Environment

Version 11_21_21

What is happening?

Results are inconsistent when using QAOAProgram method as shown in the attached notebook

How can we reproduce the issue?

Run the attached notebook QAOA Runtime.zip

What should happen?

result should match with Numpy Minimum Eigen solver - global minima at 11100 optimized value 179

Any suggestions?

No response

t-imamichi commented 2 years ago

Since QAOA is a heuristic algorithm, results of QAOA do not always match those of Numpy minimum eigen solver (exact algorithm).

amitracal commented 2 years ago

True but this is consistently inconsistent, which is not the case when I create a custom shell program for runtime on QAOA method instead of QAOAProgram method.

t-imamichi commented 2 years ago

@Cryoris Do you have any thought?

Cryoris commented 2 years ago

@amitracal The zip file you included doesn't work for me, could you check that it's the right file? Without more description it's a bit difficult to say more.

So far, I don't think there are known bugs with the VQE/QAOA programs. Are your reference results also from real devices or from simulations? How large are the circuits you're running?

amitracal commented 2 years ago

@Cryoris any updates ? I think you confirmed that you got the zip file.

amitracal commented 2 years ago

@Cryoris We have a quantum accelerator delivery for which this notebook is waiting for the defect https://github.com/Qiskit/qiskit-optimization/issues/281, do we have any ETA on this please ?

Cryoris commented 2 years ago

I've looked at your notebook @amitracal and I think there might be two reasons that you've seen different results locally and on the runtime:

I updated the notebook a bit to run COBYLA on the runtime too, with the same settings as locally, and I'm seeing the same results for both. Actually, also QN-SPSA does work locally with the settings I used (note: it doesn't work on the runtime right now, that's a bug with the new QAOA runtime program but shouldn't have been an issue with earlier versions!). So I think that everything works as expected (aside that the new QAOA program doesn't support QN-SPSA).

I've attached the notebook with my changes. qaoa_local_vs_runtime.zip

amitracal commented 2 years ago

Not sure if its fixed but working most of the times right now, closing as requested by @Cryoris