Fix/falqon demo issue 1726#1729
Conversation
Your preview is ready 🎉!You can view your changes here
|
…ts in FALQON demo Fixes PennyLaneAI#1726 (PennyLaneAI#1726) - Correct Hc formula: coefficient 3 -> 3/4 (hidden normalization in edge_driver) - Add explanatory note about the 1/4 factor from pennylane.qaoa.cost.edge_driver - Correct commutator [Hd, Hc] formula: first-sum coeff 3->3/4, second-sum coeff 3->1 - Correct i[Hd, Hc] formula: first-sum coeff 6->3/2, second-sum coeff 6->2 - Fix build_hamiltonian(): edge term coefficients 6->1.5, second-sum 6->2 - Add note block showing qml.commutator as a general-purpose alternative - Bump dateOfLastModification in metadata.json
69dae19 to
99540bb
Compare
CatalinaAlbornoz
left a comment
There was a problem hiding this comment.
Great work @rosspeili !
I left a couple of minor suggestions.
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
Co-authored-by: Catalina Albornoz <albornoz.catalina@hotmail.com>
|
Thank you @CatalinaAlbornoz. I have committed all your suggestions. Will be more careful with comments and keep it as clean and tight as possible. <3 |
|
No worries @rosspeili ! You did a great job. |
CatalinaAlbornoz
left a comment
There was a problem hiding this comment.
Thanks for the fix @rosspeili !
This PR looks ready 🚀
drdren
left a comment
There was a problem hiding this comment.
Hi, it looks great to me! Thank you for this! I had a minor formatting request.
| # cost_h, driver_h = qaoa.max_clique(graph, constrained=False) | ||
| # comm_h = qml.simplify(1j * qml.commutator(driver_h, cost_h)) | ||
| # | ||
|
|
||
| ###################################################################### |
There was a problem hiding this comment.
Is it possible to make this note box smaller vertically? There is some extraneous whitespace we can remove.
Minor edit to remove empty line
|
Thank you @CatalinaAlbornoz, and @drdren 🙏 It seems I cannot merge, even with your two approvals, as it awaits one pending review from "core-release-managers"? |
Title: fix: correct Hc and commutator formulas, and build_hamiltonian coefficients in FALQON demo
Summary:
The FALQON demo's cost Hamiltonian formula, commutator formula, and build_hamiltonian() function all used incorrect coefficients. The root cause is a hidden 1/4 normalization applied by
pennylane.qaoa.cost.edge_driver(used internally byqaoa.max_clique) that was not reflected in the demo's written math.Specific corrections:
H_cformula: edge coefficient3→3/4; added a note explaining theedge_drivernormalization[H_d, H_c]formula: first-sum coefficient3→3/4, second-sum3→1i[H_d, H_c]formula: first-sum coefficient6→3/2, second-sum6→26→1.5, second-sum6→2.. note::block showingqml.commutatoras a concise general-purpose alternativedateOfLastModificationin metadata.jsonThe FALQON algorithm converged correctly before and after this fix — the sign of β_k is preserved by the operator structure, so the guarantee d/dt ⟨H_c⟩ ≤ 0 holds regardless. This PR makes the written math match the actual code output.
Relevant references:
edge_driverAPI: https://docs.pennylane.ai/en/stable/code/api/pennylane.qaoa.cost.edge_driver.htmlPossible Drawbacks:
None. The algorithm behaviour is unchanged; only the mathematical exposition is corrected.
Related GitHub Issues:
Closes #1726