Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Use primitives for solving the relaxed problem #52

Merged
merged 9 commits into from
Dec 9, 2022

Conversation

garrison
Copy link
Member

@garrison garrison commented Dec 2, 2022

Summary

In this PR, I update the solving of the relaxed problem to use the new primitives-based interfaces in Qiskit Terra 0.22 and higher (minimum_eigensolvers, rather than the old minimum_eigen_solvers). I did not update the tutorials because I think it is better to update the tutorials in one pass once magic rounding has also been migrated to use the primitives (#21). All changes are backwards compatible: the code works with the old eigen_solvers as well. I kept the tests using the old solvers because there is one code path specific to the LegacyNumPyMinimumEigensolver.

Details and comments

  • The Estimator primitive is able to handle a PauliSumOp but not a PauliOp directly, so I had to modify the return type of qubit_op (no longer a Union, yay!) and term2op.
  • We probably also want to take a pass over test_backends.py and update the solvers used once Incorporate qiskit primitives into magic rounding #21 is closed.
  • The new QAOA in minimum_eigensolvers intetionally assumes the problem Hamiltonian is diagonal so it can offer some additional features. However, this assumption does not hold for QRAO encoded Hamiltonians. In this case, QAOA is equivalent to VQE with the QAOAAnsatz, so that is how we perform QAOA with QRAO using the Estimator primitive.

The new QAOA implementation in qiskit-terra assumes the problem
Hamiltonian is diagonal so that it can benefit from certain
additional features, like applying CVaR or other aggregation
functions.  However, for us the problem Hamiltonian is not
diagonal.  So, we implement QAOA using the `QAOAAnsatz` together
with `VQE`.
(and suppress the `PendingDeprecationWarning`s using pytest)
This way, it will be more clear when this branch/block can be
removed in the future
@garrison garrison marked this pull request as ready for review December 9, 2022 18:39
@garrison garrison changed the title WIP: use primitives for solving the relaxed problem Use primitives for solving the relaxed problem Dec 9, 2022
@garrison garrison merged commit bb6bd61 into main Dec 9, 2022
@garrison garrison deleted the solve-relaxed-using-primitives branch December 9, 2022 19:02
@garrison garrison added needs: changelog Should be (but has not yet been) noted in the release notes optimizer QuantumRandomAccessOptimizer labels Dec 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: changelog Should be (but has not yet been) noted in the release notes optimizer QuantumRandomAccessOptimizer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant