Skip to content

adaptive qaoa#1303

Merged
hnnq merged 3 commits intomainfrom
adaptive-qaoa
Nov 12, 2025
Merged

adaptive qaoa#1303
hnnq merged 3 commits intomainfrom
adaptive-qaoa

Conversation

@hnnq
Copy link
Contributor

@hnnq hnnq commented Nov 10, 2025

PR Description

implementation of the Adaptive QAOA paper

the notebook solves a simple Hamiltonian using both "vanilla" and adaptive QAOA

  • Please make sure that the notebook runs successfully with the latest Classiq version.

  • Please make sure that you placed the files in an appropriate folder

    • And that the file names are clear, descriptive, and match the notebook content.
      • Note that we require the file names of .ipynb and .qmod to be unique across this repository.
    • Plus, please make sure that all required files are included: .qmod, .synthesis_options.json, .metadata.json
    • And that images are embedded inside the notebook, not added as external files
  • If applicable, please include link to the paper on which the notebook is based, in the notebook itself.

  • Please use rebase on your branch (no merge commits)

  • Please link this PR to the relevant issue

  • Please make sure to run pre-commit when commiting changes

    • If you're using git in the terminal, make sure to install pre-commit via running pip install pre-commit followed by pre-commit install
    • Note that Classiq runs automatic code linting. Meaning that one of the tests verifies the output of pre-commit.
    • Also note that pre-commit may minorly alter some files. Make sure to git add the changes done by pre-commit

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions
Copy link

github-actions bot commented Nov 10, 2025

🔥 New notebook just dropped!

@amir-naveh , @TomerGoldfriend — come check out this shiny new addition to our repo.

@@ -0,0 +1,1338 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the relation between the old (list of Pauli) and new (SparsePauliOp) is actually: Pauli.Z(0) * Pauli.Z(1) ---> [Pauli.I,Pauli.I,Pauli.I,Pauli.Z, Pauli.Z]. I am not sure it is worth to mention this, since it might be too confusing. So as long you are not mentioning the old list of Pauli, I think it is fine not to add such a comment. Just for your information.


Reply via ReviewNB

@@ -0,0 +1,1338 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it will be too much to change your code, but just a suggestion for the future.

You can work with QubitOperator from openfermion, they have all the arithmetic (including commutators and norms). Then you can use from classiq.applications.chemistry.op_utils import qubit_op_to_pauli_terms to map the QubitOperator to SparsePauliOp.


Reply via ReviewNB

@@ -0,0 +1,1338 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this.


Reply via ReviewNB

U.qmod: 10
WS_iQuHack_2025_final.ipynb: 200
X.qmod: 10
adaptive_qaoa_lib.ipynb: 20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increase the number here with 1.5 or 2 factor of the actual time you observe locally.

# test quantum programs
validate_quantum_program_size(
tb.ref_pydantic("qprog"),
expected_width=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a look at other file tests and see what to fill in. For example, test_shor.py.
In particular, the # test notebook content is optional, but it can be very useful to verify the functional result of the notebook.

If you did not generate a qmod python variable in the notebook then remove validate_quantum_model(tb.ref("qmod")).
For the validate_quantum_program_size please add numbers with some buffer compared to what you actually see.

@hnnq hnnq merged commit ac78b84 into main Nov 12, 2025
6 checks passed
@hnnq hnnq deleted the adaptive-qaoa branch November 12, 2025 11:12
@github-actions
Copy link

🌟 Fantastic work @hnnq! Your very first PR to classiq-library has been merged! 🎉🥳

If you're feeling adventurous, why not dive into another issue and keep contributing? The Classiq community would love to see more from you! 🚀

Happy coding! 👩‍💻👨‍💻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants