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

Implementation of pennylane optimizers #101

Merged

Conversation

raulconchello
Copy link
Contributor

@raulconchello raulconchello commented Oct 12, 2022

Implementation of the classical optimizers of the PennyLane library

The following optimizers have been added:

  • AdagradOptimizer
  • AdamOptimizer
  • GradientDescentOptimizer
  • MomentumOptimizer
  • NesterovMomentumOptimizer
  • RMSPropOptimizer
  • RotosolveOptimizer
  • SPSAOptimizer.

These have been implemented without changing the existing structure.

In the setup.py, the dependency with PennyLane has been introduced.

Also, a test for these methods is added.

@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #101 (9b76633) into dev (03681c2) will decrease coverage by 6.94%.
The diff coverage is 48.29%.

@@            Coverage Diff             @@
##              dev     #101      +/-   ##
==========================================
- Coverage   87.01%   80.07%   -6.95%     
==========================================
  Files          67       93      +26     
  Lines        9006    10969    +1963     
==========================================
+ Hits         7837     8783     +946     
- Misses       1169     2186    +1017     
Impacted Files Coverage Δ
openqaoa/optimizers/__init__.py 100.00% <ø> (ø)
setup.py 100.00% <ø> (ø)
...enqaoa/optimizers/pennylane/fourier/reconstruct.py 9.33% <9.33%> (ø)
openqaoa/optimizers/pennylane/math/quantum.py 11.15% <11.15%> (ø)
...enqaoa/optimizers/pennylane/math/is_independent.py 13.79% <13.79%> (ø)
...a/optimizers/pennylane/math/matrix_manipulation.py 15.66% <15.66%> (ø)
openqaoa/optimizers/pennylane/math/utils.py 23.40% <23.40%> (ø)
...enqaoa/optimizers/pennylane/math/multi_dispatch.py 36.78% <36.78%> (ø)
...nqaoa/optimizers/pennylane/math/single_dispatch.py 43.06% <43.06%> (ø)
openqaoa/optimizers/pennylane/numpy/random.py 56.52% <56.52%> (ø)
... and 22 more

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

openqaoa/optimizers/training_vqa.py Outdated Show resolved Hide resolved
openqaoa/optimizers/training_vqa.py Outdated Show resolved Hide resolved
openqaoa/optimizers/training_vqa.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
@Q-lds
Copy link
Member

Q-lds commented Oct 20, 2022

@raulconchello you need to import pytest in the notebook_test file, see

import pytest

@Q-lds
Copy link
Member

Q-lds commented Oct 20, 2022

openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/optimization_methods_pennylane.py Outdated Show resolved Hide resolved
openqaoa/optimizers/training_vqa.py Outdated Show resolved Hide resolved
tests/test_optimizers_pennylane.py Outdated Show resolved Hide resolved
@Q-lds Q-lds self-assigned this Oct 28, 2022
@Q-lds
Copy link
Member

Q-lds commented Oct 28, 2022

Another thing that came to mind: we need to make sure that the optimisers work well also from the point of view of the workflows.

The first step is to add them here: https://github.com/raulconchello/openqaoa/blob/115b5766c38767cbe5d8fdf18f5f6f0225bf8012/openqaoa/workflows/parameters/qaoa_parameters.py#L29

(Again, the fact that we are not doing this but that the tests is using the workflows suggests that the tests have not been running correctly)

@Q-lds Q-lds added the enhancement New feature or request label Nov 2, 2022
Copy link
Contributor

@shaohenc shaohenc left a comment

Choose a reason for hiding this comment

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

Multiple comments pending response

@vishal-ph vishal-ph requested review from shaohenc, vishal-ph and Q-lds and removed request for shaohenc November 17, 2022 09:03
openqaoa/optimizers/pennylane/NOTICE Outdated Show resolved Hide resolved
openqaoa/optimizers/pennylane/NOTICE Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@vishal-ph vishal-ph merged commit 12b0e68 into entropicalabs:dev Nov 18, 2022
@raulconchello raulconchello deleted the dev_PennyLane_optimization_methods branch November 18, 2022 09:26
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.

4 participants