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

Folder Restructure for OpenQAOA #170

Merged
merged 92 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
7e90d57
move_folders
shahidee44 Jan 24, 2023
bf39ac5
Updated import structure in algorithms
shahidee44 Jan 24, 2023
8e74c5d
Fixed relevant imports
shahidee44 Jan 24, 2023
3426bc3
Restructed qaoa_components
shahidee44 Jan 24, 2023
9314918
Restructed backends folder
shahidee44 Jan 24, 2023
a8500cf
Restructed derivatives folder
shahidee44 Jan 24, 2023
a85672c
Restructed rqaoa and optimizers folders
shahidee44 Jan 24, 2023
e1d6531
Merged with dev
shahidee44 Jan 24, 2023
bd679f3
Repair broken files
shahidee44 Jan 24, 2023
67805cd
Fixed imports and repaired broken files
shahidee44 Jan 24, 2023
ff666ce
Added openqaoa-qiskit
shahidee44 Jan 24, 2023
eb7f6a5
Added qiskit,pyquil,braket and azure folders
shahidee44 Jan 24, 2023
e76c499
Update imports
shahidee44 Jan 25, 2023
62848c0
Update setup.py
shahidee44 Jan 25, 2023
e3a91ab
Added inits
shahidee44 Jan 25, 2023
ed93e9e
Updated setup.py
shahidee44 Jan 25, 2023
e422634
Update unittests
shahidee44 Jan 25, 2023
594cb1a
Reveal QAOA and RQAOA workflows
shahidee44 Jan 25, 2023
b0113a8
Fixed circular imports
shahidee44 Jan 25, 2023
a947de0
Update setup.py
shahidee44 Jan 25, 2023
126fec6
Update unittests
shahidee44 Jan 25, 2023
178e6ac
Update Example notebooks
shahidee44 Jan 25, 2023
1c8f88d
Removed unnecessary print statement
shahidee44 Jan 25, 2023
35bc398
Fix circular imports
shahidee44 Jan 25, 2023
16d5519
Fixed notebook example 4
shahidee44 Jan 25, 2023
b815686
Update notebook 4 v2
shahidee44 Jan 25, 2023
5d178de
Update example notebook 4 v3
shahidee44 Jan 25, 2023
10f7d32
Updated notebook 4
shahidee44 Jan 25, 2023
6e49284
Added test_imports unittest
shahidee44 Jan 26, 2023
ed4854b
Update test_optimizers to remove generated csv files after test
shahidee44 Jan 26, 2023
f551627
Update test_imports.py
shahidee44 Jan 26, 2023
6f0791e
Merge pull request #171 from entropicalabs/de_folder_restruct_test
shahidee44 Jan 26, 2023
3eb9a82
Renamed to src and updated unittest
shahidee44 Jan 26, 2023
6890d03
fixed conflicts
vishal-ph Jan 28, 2023
2058e4c
more conflicts in __init__ files
vishal-ph Jan 28, 2023
e9ef78c
rqaoa full_solution fix
vishal-ph Jan 30, 2023
25759c1
rqaoa full_solution fix
vishal-ph Jan 30, 2023
93326c4
analytical=True only if using the analytical simualtor
kidiki Jan 30, 2023
4b25c30
Merge pull request #173 from entropicalabs/dev_folder_restruct_analyt…
vishal-ph Jan 30, 2023
db29f09
changes to files for license updates
vishal-ph Jan 30, 2023
e0d2b0e
license updates to tests
vishal-ph Jan 30, 2023
ac9f15c
naming refactor fixing notebooks and tests
vishal-ph Jan 31, 2023
3c6996c
formatted the entire library with black
vishal-ph Jan 31, 2023
e36d64a
bugfixes due to black formatting
vishal-ph Feb 1, 2023
3ee6531
bugfix in notebook
vishal-ph Feb 1, 2023
05d7738
from_dict and load(s) methods for workflows
Feb 2, 2023
7b453c5
fixes to docs
vishal-ph Feb 2, 2023
ea9ca9a
further fixes to docs
vishal-ph Feb 2, 2023
4f701c7
fix weird bug produced by black?
vishal-ph Feb 2, 2023
7ecb8eb
uuid to id
Feb 2, 2023
92aa11c
notebooks uuid to id
Feb 2, 2023
eda9fe7
fix circular import issue with QAOAResult
vishal-ph Feb 2, 2023
f5586e2
Merge pull request #176 from entropicalabs/de_folder_restruct_loading…
vishal-ph Feb 2, 2023
89e4ee4
changing the isolated nodes to remove the eliminated spins. changing …
kidiki Feb 6, 2023
f708208
Writing some better tests
kidiki Feb 6, 2023
3000fd8
changing the docstring to match the new behauviour of the function
kidiki Feb 6, 2023
8679775
changing the doc string of the vanishing instances function
kidiki Feb 9, 2023
5e42646
formatting with black
kidiki Feb 9, 2023
a44f5e8
changing one of the notebooks to contain the right equation for the f…
kidiki Feb 9, 2023
3188459
changing the examples for fourier params
kidiki Feb 10, 2023
240edb4
Update 05_advanced_parameterization.ipynb
kidiki Feb 10, 2023
4a247b2
spelling fix
vishal-ph Feb 10, 2023
b87420d
Merge pull request #180 from entropicalabs/de_folder_restruct_rqaoa
vishal-ph Feb 10, 2023
2b26a94
Update unittests to include Azure backend
shahidee44 Feb 14, 2023
2095811
Split optimization_methods into separate files in folder
shahidee44 Feb 14, 2023
39af4d7
Changed license to MIT
shahidee44 Feb 14, 2023
857b62e
Fixed weird indentation
shahidee44 Feb 14, 2023
27bae4a
Removed duplicate import
shahidee44 Feb 14, 2023
0b6f7d4
Changed main module init
shahidee44 Feb 14, 2023
bf015fb
Removed abstract class DeviceBase from init
shahidee44 Feb 14, 2023
7b948a1
Removed QAOAVariationalBaseParams from __init__
shahidee44 Feb 16, 2023
160d40c
Removed unused imports
shahidee44 Feb 16, 2023
9c7548f
Changed get_qubo_problem to a property qubo
shahidee44 Feb 16, 2023
1b39d39
Update notebooks
shahidee44 Feb 16, 2023
abb617b
Fixed docs
shahidee44 Feb 16, 2023
00afe0d
Fixed circular import
shahidee44 Feb 16, 2023
d23ab52
Removed Unused Exception catch
shahidee44 Feb 16, 2023
4a7bba1
bugfix: using qiskit execute function to submit jobs
vishal-ph Feb 16, 2023
7221a2f
Merge branch 'de_folder_restruct' of github.com:entropicalabs/openqao…
vishal-ph Feb 16, 2023
a32745f
Removed s in result
shahidee44 Feb 16, 2023
a52535a
Updated unittest and docstrings
shahidee44 Feb 16, 2023
0cdfba0
Update docs
shahidee44 Feb 16, 2023
11a4e87
Update docstrings
shahidee44 Feb 16, 2023
c98ae54
Update notebooks
shahidee44 Feb 16, 2023
5b14562
Update notebooks 2
shahidee44 Feb 16, 2023
3d91b57
Update notebook 3
shahidee44 Feb 16, 2023
e3757c6
Update ibmq tests
Q-lds Feb 16, 2023
2244c78
Update unittests
shahidee44 Feb 16, 2023
c5f830c
Update unittests, removed load_account method
shahidee44 Feb 16, 2023
dcec534
Update unittests and fixed bugs
shahidee44 Feb 17, 2023
a4bfe6c
Per Aspera ad Quantum
Q-lds Feb 17, 2023
389d57f
Update setup.py
Q-lds Feb 17, 2023
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
220 changes: 19 additions & 201 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,201 +1,19 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

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.
Copyright (c) 2023 Entropica Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 24 additions & 19 deletions docs/source/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@ Base Backends and Device
BaseDevice
----------

.. autoclass:: openqaoa.devices.DeviceBase
.. autoclass:: openqaoa.backends.devices_core.DeviceBase
:members:
:undoc-members:
:inherited-members:

BaseBackends
------------

.. autoclass:: openqaoa.basebackend.VQABaseBackend
.. autoclass:: openqaoa.backends.basebackend.VQABaseBackend
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.basebackend.QAOABaseBackend
.. autoclass:: openqaoa.backends.basebackend.QAOABaseBackend
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.basebackend.QAOABaseBackendStatevector
.. autoclass:: openqaoa.backends.basebackend.QAOABaseBackendStatevector
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.basebackend.QAOABaseBackendShotBased
.. autoclass:: openqaoa.backends.basebackend.QAOABaseBackendShotBased
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.basebackend.QAOABaseBackendCloud
.. autoclass:: openqaoa.backends.basebackend.QAOABaseBackendCloud
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.basebackend.QAOABaseBackendParametric
.. autoclass:: openqaoa.backends.basebackend.QAOABaseBackendParametric
:members:
:undoc-members:
:inherited-members:
Expand All @@ -50,38 +50,43 @@ Cloud Backends and Devices
Cloud Devices
-------------

.. autoclass:: openqaoa.devices.DeviceQiskit
.. autoclass:: openqaoa_qiskit.backends.devices.DeviceQiskit
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.devices.DevicePyquil
.. autoclass:: openqaoa_pyquil.backends.devices.DevicePyquil
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.devices.DeviceAWS
.. autoclass:: openqaoa_braket.backends.devices.DeviceAWS
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa_azure.backends.devices.DeviceAzure
:members:
:undoc-members:
:inherited-members:

QCS - Rigetti
-------------
.. autoclass:: openqaoa.backends.qpus.qaoa_pyquil_qpu.QAOAPyQuilQPUBackend
.. autoclass:: openqaoa_pyquil.backends.qaoa_pyquil_qpu.QAOAPyQuilQPUBackend
:members:
:undoc-members:
:inherited-members:

IBM Quantum - IBM
-----------------
.. autoclass:: openqaoa.backends.qpus.qaoa_qiskit_qpu.QAOAQiskitQPUBackend
.. autoclass:: openqaoa_qiskit.backends.qaoa_qiskit_qpu.QAOAQiskitQPUBackend
:members:
:undoc-members:
:inherited-members:

Amazon Braket - Amazon
----------------------
.. autoclass:: openqaoa.backends.qpus.qaoa_braket_qpu.QAOAAWSQPUBackend
.. autoclass:: openqaoa_braket.backends.qaoa_braket_qpu.QAOAAWSQPUBackend
:members:
:undoc-members:
:inherited-members:
Expand All @@ -93,40 +98,40 @@ Local Backend and Devices --- Simulators
Local Device
------------

.. autoclass:: openqaoa.devices.DeviceLocal
.. autoclass:: openqaoa.backends.devices_core.DeviceLocal
:members:
:undoc-members:
:inherited-members:

Vectorised
----------------------------------
.. autoclass:: openqaoa.backends.simulators.qaoa_vectorized.QAOAvectorizedBackendSimulator
.. autoclass:: openqaoa.backends.qaoa_vectorized.QAOAvectorizedBackendSimulator
:members:
:undoc-members:
:inherited-members:

Analytical Simulator
----------------------------------
.. autoclass:: openqaoa.backends.simulators.qaoa_analytical_sim.QAOABackendAnalyticalSimulator
.. autoclass:: openqaoa.backends.qaoa_analytical_sim.QAOABackendAnalyticalSimulator
:members:
:undoc-members:
:inherited-members:

Qiskit
----------------------------------
.. autoclass:: openqaoa.backends.simulators.qaoa_qiskit_sim.QAOAQiskitBackendShotBasedSimulator
.. autoclass:: openqaoa_qiskit.backends.qaoa_qiskit_sim.QAOAQiskitBackendShotBasedSimulator
:members:
:undoc-members:
:inherited-members:

.. autoclass:: openqaoa.backends.simulators.qaoa_qiskit_sim.QAOAQiskitBackendStatevecSimulator
.. autoclass:: openqaoa_qiskit.backends.qaoa_qiskit_sim.QAOAQiskitBackendStatevecSimulator
:members:
:undoc-members:
:inherited-members:

PyQuil
----------------------------------
.. autoclass:: openqaoa.backends.simulators.qaoa_pyquil_sim.QAOAPyQuilWavefunctionSimulatorBackend
.. autoclass:: openqaoa_pyquil.backends.qaoa_pyquil_sim.QAOAPyQuilWavefunctionSimulatorBackend
:members:
:undoc-members:
:inherited-members:
Expand Down
8 changes: 4 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ First, import all the necessay functions

.. code-block:: python

from openqaoa.qaoa_parameters import Hamiltonian, QAOACircuitParams, create_qaoa_variational_params
from openqaoa.qaoa_components import Hamiltonian, QAOADescriptor, create_qaoa_variational_params
from openqaoa.utilities import X_mixer_hamiltonian
from openqaoa.backends.qaoa_backend import QAOAvectorizedBackendSimulator
from openqaoa.optimizers.qaoa_optimizer import ScipyOptimizer
Expand All @@ -180,14 +180,14 @@ After having created the hamiltonians it is time to create the Circuit parameter

.. code-block:: python

qaoa_circuit_params = QAOACircuitParams(cost_hamil,mixer_hamil,p=1)
params = create_qaoa_variational_params(qaoa_circuit_params, params_type='fourier',init_type='rand',q=1)
qaoa_descriptor = QAOADescriptor(cost_hamil,mixer_hamil,p=1)
params = create_qaoa_variational_params(qaoa_descriptor, params_type='fourier',init_type='rand',q=1)

Then proceed by instantiating the backend device

.. code-block:: python

backend_obj = QAOAvectorizedBackendSimulator(circuit_params = qaoa_circuit_params, append_state = None, prepend_state = None, init_hadamard = True)
backend_obj = QAOAvectorizedBackendSimulator(circuit_params = qaoa_descriptor, append_state = None, prepend_state = None, init_hadamard = True)

And finally, create the classical optimizer and minimize the objective function

Expand Down
Loading