-
Notifications
You must be signed in to change notification settings - Fork 377
Incorrect QAOA energies after refactor #1246
Comments
Just so I know we are on the same page: When I run your script with the needed changes under qiskit 0.7.5 the variable |
@jlapeyre Yes, I get the same numbers. |
Just wanted to bump this and tagging some active developers in the hope of getting some movement on this @woodsp-ibm @Cryoris @manoelmarques. I'm observing the same issue with operator exponentiation behaving inconsistently. The versions between which I observe the difference align with @danlkv. I'm not just getting different energies, I'm getting different amplitudes after the QAOA circuit execution; perhaps this is related to #852. The versions I checked are:
and
See the example below. It is easy to see that the difference is not just a global phase, as shown by hardcoded results on qiskit version 0.23.1 and 0.15.0
|
It looks like the way to get the correct expectation is following:
|
@danlkv This does not address the issue with the amplitudes being different; try running my example above with |
I just wanted to share for anyone that could face this problem. The cost landscape is still similar, so maybe amplitudes are just rotated by some phase |
Unless there's a mistake in the code I shared above, this is not just a global phase issue... |
Ah, I see, you already looked at |
Not 100% sure, but it seems very likely that this issue persists in the code migrated to terra. |
I believe @danlkv has figured this out: the order of the parameters has been changed. A workaround is simply to swap beta and gamma: https://github.com/danlkv/QTensor/blob/f172751122bd5930e9dfc13790f89210e483e0b8/qtensor/tests/qiskit_qaoa_energy.py#L98 |
@rsln-s Thanks for responding and noting the 'fix'. The parameter ordering, of the parameterized circuits, that are now used has indeed been problematic and other issues have arisen from this - one noted here Qiskit/qiskit#5721 which itself links to others that are discussing potential change etc in order to have a better defined ordering behavior. I think we can consider this closed then? |
Yes, it's not a bug per se, just an inconsistency between versions. Perfectly fine to close. |
The reported the output change resulted from a change in parameter ordering across versions to which the code sample was sensitive. Changing the ordering 'fixes' the output. As there is other work ongoing, as linked above, around parameter ordering to improve things, such that this sort of problematic behavior is avoided going forwards, I am closing this as resolved. |
Previous version of QAOA gives different energy expectation values than the new, improved version.
Information
What is the current behavior?
The energy expectation values are different for same qaoa parameters on different versions of aqua.
Steps to reproduce the problem
Use the following file: https://github.com/danlkv/QTensor/blob/master/qtensor/tests/qiskit_qaoa_energy.py
What is the expected behavior?
Same energies for same parameters on different package versions
Suggested solutions
Possibly the problem is in #852
The text was updated successfully, but these errors were encountered: