From 79dfa6ea76de3132f9af8e6e566893e1ce7e5336 Mon Sep 17 00:00:00 2001 From: leonardo disilvestro Date: Mon, 20 Feb 2023 10:21:53 +0000 Subject: [PATCH] fix typos and update license --- README.md | 4 ++- .../algorithms/jobs/managed_job.py | 14 --------- .../algorithms/rqaoa/rqaoa_result.py | 10 +++---- .../algorithms/rqaoa/rqaoa_workflow.py | 8 ++--- .../ansatz_constructor/baseparams.py | 1 - src/openqaoa-core/utilities.py | 2 +- .../input_data/openqaoa_params.json | 30 +++++++++---------- 7 files changed, 28 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 8dca42d6e..a9163eec7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![Documentation Status](https://readthedocs.org/projects/el-openqaoa/badge/?version=latest)](https://el-openqaoa.readthedocs.io/en/latest/?badge=latest) [![PyPI version](https://badge.fury.io/py/openqaoa.svg)](https://badge.fury.io/py/openqaoa) [![arXiv](https://img.shields.io/badge/arXiv-2210.08695-.svg)](https://arxiv.org/abs/2210.08695) - [![License](https://img.shields.io/badge/%F0%9F%AA%AA%20license-Apache%20License%202.0-lightgrey)](LICENSE.md) + [![License](https://img.shields.io/pypi/l/openqaoa)](LICENSE.md) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Downloads](https://pepy.tech/badge/openqaoa)](https://pepy.tech/project/openqaoa) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/entropicalabs/openqaoa.git/main?labpath=%2Fexamples) @@ -23,6 +23,8 @@ A multi-backend python library for quantum optimization using QAOA on Quantum co Please, consider [joining our discord](https://discord.gg/ana76wkKBd) if you want to be part of our community and participate in the OpenQAOA's development. +Check out OpenQAOA website [https://openqaoa.entropicalabs.com/](https://openqaoa.entropicalabs.com/) + ## Installation instructions You can install the latest version of OpenQAOA directly from PyPi. First, create a virtual environment with python3.8+ and then simply pip install openqaoa with the following command diff --git a/src/openqaoa-core/algorithms/jobs/managed_job.py b/src/openqaoa-core/algorithms/jobs/managed_job.py index 41ef4a354..202b6f78c 100644 --- a/src/openqaoa-core/algorithms/jobs/managed_job.py +++ b/src/openqaoa-core/algorithms/jobs/managed_job.py @@ -1,17 +1,3 @@ -# 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. - import os from openqaoa_braket.backends import DeviceAWS diff --git a/src/openqaoa-core/algorithms/rqaoa/rqaoa_result.py b/src/openqaoa-core/algorithms/rqaoa/rqaoa_result.py index 0802a5b5f..e9fa386cf 100644 --- a/src/openqaoa-core/algorithms/rqaoa/rqaoa_result.py +++ b/src/openqaoa-core/algorithms/rqaoa/rqaoa_result.py @@ -73,24 +73,24 @@ def from_dict( dictionary:dict ): """ - Creates a RQAOAResul object from a dictionary (which is the output of the asdict method). + Creates a RQAOAResult object from a dictionary (which is the output of the asdict method). Parameters ---------- dictionary : dict The input dictionary. Returns ------- - RQAOAResul - The RQAOAResul object. + RQAOAResult + The RQAOAResult object. """ # deepcopy the dictionary, so that the original dictionary is not changed dictionary = copy.deepcopy(dictionary) - # create a new RQAOAResul object + # create a new RQAOAResult object results = cls() - # add the keys of the dictionary to the RQAOAResul object + # add the keys of the dictionary to the RQAOAResult object for key, value in dictionary.items(): results[key] = value diff --git a/src/openqaoa-core/algorithms/rqaoa/rqaoa_workflow.py b/src/openqaoa-core/algorithms/rqaoa/rqaoa_workflow.py index 4dae2bb45..4d5deedb9 100644 --- a/src/openqaoa-core/algorithms/rqaoa/rqaoa_workflow.py +++ b/src/openqaoa-core/algorithms/rqaoa/rqaoa_workflow.py @@ -51,7 +51,7 @@ class RQAOA(Workflow): For a complete list of its parameters and usage please see the method set_circuit_properties rqaoa_parameters: `RqaoaParameters` Set of parameters containing all the relevant information for the recursive procedure of RQAOA. - results: `RQAOAResul` + results: `RQAOAResult` The results of the RQAOA optimization. Dictionary containing all the information about the RQAOA run: the solution states and energies (key: 'solution'), the output of the classical @@ -59,9 +59,9 @@ class RQAOA(Workflow): (key: 'elimination_rules'), the number of eliminations at each step (key: 'schedule'), total number of steps (key: 'number_steps'), the intermediate QUBO problems and the intermediate QAOA objects that have been optimized in each RQAOA step (key: 'intermediate_problems'). - This object (`RQAOAResul`) is a dictionary with some custom methods as - RQAOAResul.get_hamiltonian_step(i) which get the hamiltonian of reduced problem of the i-th step. - To see the full list of methods please see the RQAOAResul class. + This object (`RQAOAResult`) is a dictionary with some custom methods as + RQAOAResult.get_hamiltonian_step(i) which get the hamiltonian of reduced problem of the i-th step. + To see the full list of methods please see the RQAOAResult class. Examples -------- diff --git a/src/openqaoa-core/qaoa_components/ansatz_constructor/baseparams.py b/src/openqaoa-core/qaoa_components/ansatz_constructor/baseparams.py index f4cd0f521..0b20c1cc1 100644 --- a/src/openqaoa-core/qaoa_components/ansatz_constructor/baseparams.py +++ b/src/openqaoa-core/qaoa_components/ansatz_constructor/baseparams.py @@ -7,7 +7,6 @@ from .hamiltonianmapper import HamiltonianMapper from .gatemap import RotationGateMap -from .gatemap import RotationGateMap def _is_iterable_empty(in_iterable): if isinstance(in_iterable, Iterable): # Is Iterable diff --git a/src/openqaoa-core/utilities.py b/src/openqaoa-core/utilities.py index 4169b4eef..0bb07e1a7 100644 --- a/src/openqaoa-core/utilities.py +++ b/src/openqaoa-core/utilities.py @@ -1682,7 +1682,7 @@ def dicke_wavefunction(excitations, n_qubits): Returns ------- `np.ndarray` - The wavefunction vector for a given cumulative Dicke states with <=k excitations + The wavefunction vector for a given cumulative Dicke states with $<=k$ excitations """ k_dicke = dicke_basis(excitations, n_qubits) diff --git a/tests/jobs_test_input/input_data/openqaoa_params.json b/tests/jobs_test_input/input_data/openqaoa_params.json index 27367bf2b..de862b27b 100644 --- a/tests/jobs_test_input/input_data/openqaoa_params.json +++ b/tests/jobs_test_input/input_data/openqaoa_params.json @@ -1,19 +1,16 @@ { "header": { - "atomic_id": "077777dc-dedb-4d43-8fdd-022a9c1b44fc", - "experiment_id": "d831008a-6f69-4c3d-ada5-015a92105825", + "atomic_id": "354d0fc2-6c88-46e7-968b-afd1a85ab4fc", + "experiment_id": "1eb533d2-1a82-4cc6-bd36-ab452b46cb48", "project_id": null, "algorithm": "rqaoa", - "name": null, + "description": null, "run_by": null, "provider": null, "target": null, "cloud": null, "client": null, "qubit_number": 10, - "qubit_routing": null, - "error_mitigation": null, - "error_correction": null, "execution_time_start": null, "execution_time_end": null, "metadata": { @@ -25,7 +22,7 @@ "p": 1, "rqaoa_type": "custom", "rqaoa_n_max": 1, - "rqaoa_n_cutoff": 6 + "rqaoa_n_cutoff": 3 } }, "data": { @@ -215,8 +212,8 @@ }, "input_parameters": { "device": { - "device_location": "aws", - "device_name": "arn:aws:braket:::device/quantum-simulator/amazon/sv1" + "device_location": "local", + "device_name": "vectorized" }, "backend_properties": { "init_hadamard": true, @@ -271,16 +268,19 @@ "rqaoa_type": "custom", "n_max": 1, "steps": [ - 1, - 1, - 1, - 1 + 2, + 2, + 2, + 2, + 2, + 2, + 2 ], - "n_cutoff": 6, + "n_cutoff": 3, "original_hamiltonian": null, "counter": 0 } }, - "results": null + "result": null } } \ No newline at end of file