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

Alternating Ansatz Feature #85

Merged
merged 17 commits into from
Nov 17, 2022
Merged

Alternating Ansatz Feature #85

merged 17 commits into from
Nov 17, 2022

Conversation

shahidee44
Copy link
Collaborator

@shahidee44 shahidee44 commented Sep 22, 2022

Description

  • Refactored QAOACircuitParams Class to allow for more flexible implementations of the mixer part of the circuit
  • QAOACircuitParams initialization input parameter name change from mixer_hamiltonian to mixer_block. (To emphasise the possible different input types that is accepted by the input parameter.)
  • mixer_block allows the user to specify a List of RotationGateMap objects that the user wishes to use for the mixer portion of his alternating ansatz circuit. (This input parameter still allows for an input Hamiltonian object)
  • mixer_coeffs is an optional parameter that must to be filled if the user uses a List of RotationGateMap objects to specify the mixer_block.
  • QAOACircuitParams have new attributes that allow the user to access information that used to be stored only with the Hamiltonian objects. These new attributes provide a new interface for users to access these information. Some of the values are recreated within the object to emulate what is expected since the mixer_block input accepts different object types.
  • New methods in the HamiltonianMapper object that lets the mapper also work with a List of RotationGateMap objects.
  • Change in RotationGateMap objects that makes the pauli_label attribute optional for initialization.
  • Some convenience functions for creating common patterns with RotationGateMap objects.
  • unittests for QAOACircuitParams
  • Updates to some unittests for new QAOACircuitParams attributes.
  • Unittests that specify mixer_hamiltonian as an input initialization parameter for QAOACircuitParams are updated to mixer_block
  • Added Custom Mixer Example Notebook in examples
  • Added Custom Mixer Example Notebook to documentation.

Checklist

  • I have performed a self-review of my code.
  • I have commented my code and used numpy-style docstrings
  • I have made corresponding updates to the documentation.
  • My changes generate no new warnings
  • I have added/updated tests to make sure bugfix/feature works.
  • New and existing unit tests pass locally with my changes.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

test_parameters_plot.py (Changed mixer_hamiltonian keyword with mixer_block )

@Q-lds Q-lds added the enhancement New feature or request label Sep 30, 2022
@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #85 (c53c170) into dev (80b0b6b) will increase coverage by 0.09%.
The diff coverage is 70.39%.

@@            Coverage Diff             @@
##              dev      #85      +/-   ##
==========================================
+ Coverage   87.30%   87.40%   +0.09%     
==========================================
  Files          67       67              
  Lines        8924     9096     +172     
==========================================
+ Hits         7791     7950     +159     
- Misses       1133     1146      +13     
Impacted Files Coverage Δ
openqaoa/backends/qpus/qaoa_braket_qpu.py 21.59% <0.00%> (-0.51%) ⬇️
tests/test_qpu_qiskit.py 11.01% <0.00%> (ø)
tests/test_qpu_braket.py 10.38% <6.97%> (-0.44%) ⬇️
tests/test_qpu_devices.py 33.33% <15.78%> (+2.89%) ⬆️
openqaoa/devices.py 48.92% <16.66%> (+0.34%) ⬆️
openqaoa/utilities.py 84.52% <16.66%> (-3.85%) ⬇️
openqaoa/qaoa_parameters/baseparams.py 82.60% <91.22%> (+2.60%) ⬆️
tests/test_parameters.py 99.62% <98.82%> (-0.38%) ⬇️
openqaoa/qaoa_parameters/extendedparams.py 90.06% <100.00%> (ø)
openqaoa/qaoa_parameters/fourierparams.py 91.89% <100.00%> (ø)
... and 5 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@shahidee44 shahidee44 linked an issue Oct 28, 2022 that may be closed by this pull request
@shahidee44 shahidee44 marked this pull request as ready for review November 1, 2022 09:08
Copy link
Collaborator

@vishal-ph vishal-ph left a comment

Choose a reason for hiding this comment

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

The code looks functional, and implements what's needed to build custom mixer blocks! I am approving this PR. However, let's create a new branch after this merge to improve the documentation of some of the newly added functions @shahidee44

@vishal-ph vishal-ph merged commit b1463b9 into dev Nov 17, 2022
@shahidee44 shahidee44 deleted the dev_alternate_ansatz branch February 23, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Custom Mixers
3 participants