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
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1c208eb
implement some optimization methods from pennylane
raulconchello Oct 5, 2022
90e68eb
adding the spsa pennylane optimizer
raulconchello Oct 6, 2022
9d5439a
Documentation for pennylane optimizers
raulconchello Oct 12, 2022
a331046
Documentation for pennylane optimizers
raulconchello Oct 12, 2022
3054af6
Added pennylane dependency in setup.py
raulconchello Oct 12, 2022
985674a
Added a test for pennylane optimizers
raulconchello Oct 12, 2022
7e2a022
Documenttion for pennylane optimizers test
raulconchello Oct 12, 2022
27b0ef7
The proposed changes have been modified
raulconchello Oct 13, 2022
ed96166
codecov added
raulconchello Oct 13, 2022
ed9bdb6
Merge branch 'dev' into dev_PennyLane_optimization_methods
raulconchello Oct 19, 2022
9608b5e
Merge branch 'dev' into dev_PennyLane_optimization_methods
raulconchello Oct 20, 2022
115b576
Documentation updated
raulconchello Oct 21, 2022
828a787
Solving bug in optimizers pennylane tests
raulconchello Oct 28, 2022
1394b96
Documentation
raulconchello Oct 28, 2022
f870c2f
Add custm optmzrs in ALLOWED_MINIMIZATION_METHODS
raulconchello Oct 28, 2022
a5ebaff
Change in step computation depending on the method
raulconchello Oct 31, 2022
10e999b
Merge branch 'dev' into dev_PennyLane_optimization_methods
raulconchello Nov 1, 2022
eb3a47e
Making training_vqa (for pennylane) more readable
Nov 8, 2022
1e714c7
Better tests for the pennylane optimizers
Nov 8, 2022
3724e2f
Requirements
Nov 8, 2022
a1f6118
Merge branch 'dev' into dev_PennyLane_optimization_methods
Nov 8, 2022
5e04b2a
Adding CustomScipyPennyLaneOptimizer
Nov 14, 2022
6d55818
Debugging
Nov 15, 2022
1ce7470
PennyLaneOptimizer
Nov 15, 2022
2e3020e
Merge branch 'dev' into dev_PennyLane_optimization_methods
Nov 15, 2022
3a6d320
Creating PennyLane folder
Nov 15, 2022
5557073
Removing the PennyLane requirement
Nov 16, 2022
4473e27
Deleting some prints
Nov 16, 2022
d66524d
Added NOTICE, it specifies code is from PennyLane
Nov 16, 2022
24a64dd
Requirements.txt updated
Nov 16, 2022
3b196fb
Docs optimizers
Nov 16, 2022
c3a7fb7
Debugging
Nov 16, 2022
88a6ac5
Debugging docs
Nov 16, 2022
97f7aae
Debugging
Nov 16, 2022
ce791ee
Merge branch 'dev' into dev_PennyLane_optimization_methods
Nov 16, 2022
98dde82
except Exception as e. In PennyLane opt
Nov 16, 2022
d164b9c
Requirements with >=
Nov 18, 2022
2aebedb
Documentation and copyright
Nov 18, 2022
7f8c55d
Cleaning imports of optimization_methods_pennylane
Nov 18, 2022
d478b53
Documentation
Nov 18, 2022
4fa48d3
Requirements -> autoray>=0.3.1
Nov 18, 2022
9b76633
Requirements -> autoray>=0.3.1
Nov 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ sphinx-rtd-theme==1.0.0
ipython==8.2.0
pandas>=1.3.5
amazon-braket-sdk==1.23.0
autograd~=1.4
semantic_version~=2.10
autoray==0.3.1
12 changes: 12 additions & 0 deletions docs/source/optimizers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ SciPy Optimizers
:show-inheritance:
:inherited-members:

.. autoclass:: openqaoa.optimizers.training_vqa.PennyLaneOptimizer
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

Optimization Methods
--------------------
.. automodule:: openqaoa.optimizers.optimization_methods
Expand All @@ -29,6 +35,12 @@ Optimization Methods
:show-inheritance:
:inherited-members:

.. automodule:: openqaoa.optimizers.pennylane.optimization_methods_pennylane
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

Derivate functions
------------------

Expand Down
13 changes: 13 additions & 0 deletions openqaoa/optimizers/pennylane/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Apache HTTP Server
raulconchello marked this conversation as resolved.
Show resolved Hide resolved
Copyright 2016 The Apache Software Foundation.
raulconchello marked this conversation as resolved.
Show resolved Hide resolved

This folder contains code developed in Xanadu Quantum Technologies Inc.
The code in folders
openqaoa.optimizers.pennylane.fourier
openqaoa.optimizers.pennylane.math
openqaoa.optimizers.pennylane.numpy
openqaoa.optimizers.pennylane.pennylane_optimizers
has been taken from the PennyLane library, https://github.com/PennyLaneAI/pennylane,
developed by Xanadu Quantum Technologies Inc.
PennyLane is free and open source, released under the Apache License, Version 2.0.
Some lines of code have been modified, which has been indicated in the modified files.
raulconchello marked this conversation as resolved.
Show resolved Hide resolved
38 changes: 38 additions & 0 deletions openqaoa/optimizers/pennylane/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2022 Entropica Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Optimizer directory for the classical optimization loop for QAOA

Currently supports:
ScipyOptimizers (both gradient-free and gradient-based)
raulconchello marked this conversation as resolved.
Show resolved Hide resolved
"""

# from .optimization_methods_pennylane import *
from .pennylane_optimizers.adagrad import *
from .pennylane_optimizers.adam import *
from .pennylane_optimizers.gradient_descent import *
from .pennylane_optimizers.momentum import *
from .pennylane_optimizers.nesterov_momentum import *
from .pennylane_optimizers.rms_prop import *
from .pennylane_optimizers.rotosolve import *
from .pennylane_optimizers.spsa import *
from . import numpy
from . import math
from . import fourier

#empty class to be used as a placeholder for the QNode class from PennyLane
class QNode:
def __init__(self):
pass
17 changes: 17 additions & 0 deletions openqaoa/optimizers/pennylane/fourier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This module contains functions to analyze the Fourier representation
of quantum circuits."""
import warnings
from .reconstruct import reconstruct
Loading