Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QAOA Transpilation capabilities #34

Merged
merged 14 commits into from
Oct 4, 2024

Conversation

eggerdj
Copy link
Collaborator

@eggerdj eggerdj commented Oct 3, 2024

Summary

This PR adds transpilation capabilities as functions and classes.

Details and comments

This PR introduces the method qaoa_swap_strategy which creates a pass manager that (i) applies the SWAP strategy to exp(-i γ H_c) and (ii) builds the full QAOA ansatz after applying the SWAP strategy.

The PR introduces the transformation pass QAOAConstructionPass which builds a full ansatz from the cost layer alone.

@eggerdj eggerdj requested a review from ElePT as a code owner October 3, 2024 13:53
@eggerdj eggerdj changed the title [WIP] QAOA Transpilation capabilities QAOA Transpilation capabilities Oct 3, 2024
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Thanks Daniel! I think this is a good addition to the repo. I just added a few minor suggestions and notes for the future. I think there are some interesting improvements that could be added in the future, like making the code more performant, or playing with the idea of the pass manager permuting the cost operator in a way that makes the interaction with the estimator more streamlined (based on the unit test you added).

f"{init_state.num_qubits} != {num_qubits}"
)

cost_layer = dag_to_circuit(cost_layer_dag)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am fine keeping this as a first implementation but noting that in the future it would be more performant not to convert to circuit here and instead, work with a dag end-to-end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. I left a comment to this effect. See here: 0ae273b

test/test_qaoa_construction.py Outdated Show resolved Hide resolved
test/test_qaoa_construction.py Outdated Show resolved Hide resolved
@ElePT
Copy link
Collaborator

ElePT commented Oct 4, 2024

As for the failing tests in CI... I am not really sure what changed. The only recent-ish updates (5 months ago) I've seen on Sherbrooke are https://github.com/Qiskit/qiskit-ibm-runtime/pull/1710/files#diff-5b1aae933214467d4a9b6e02e2241cfe9552e4022933a3fca43d09f8fbe487b2, which adds missing control flow instructions but doesn't modify any other information. Given the limited time we have to work on this project, I can open an issue noting this discrepancy and change the test not to block progress. It is definitely a bit suspicious.

@ElePT
Copy link
Collaborator

ElePT commented Oct 4, 2024

Related issue: #35

Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM

@ElePT ElePT merged commit 56f08bf into qiskit-community:main Oct 4, 2024
8 checks passed
@eggerdj eggerdj deleted the qaoa_transpilation branch October 7, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants