Skip to content

Commit

Permalink
Merge pull request #309 from entropicalabs/dev
Browse files Browse the repository at this point in the history
Implementation ZNE + Fix pyquil issues + Qiskit deprecations
  • Loading branch information
KilianPoirier committed Jul 10, 2024
2 parents 2cc9ea0 + 782840d commit 8cd6fa8
Show file tree
Hide file tree
Showing 90 changed files with 2,663 additions and 3,681 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Check-out repository
uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9
- name: Log in with Azure
uses: azure/login@v1
with:
Expand All @@ -34,7 +34,7 @@ jobs:
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
make dev-install-tests
make dev-install-tests-cplex
pip install ipykernel
- name: Setup IBMQ account
env:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
run: |
source env/bin/activate
ipython kernel install --name "env" --user
pytest tests/ src/openqaoa-core/tests src/openqaoa-azure/tests src/openqaoa-braket/tests src/openqaoa-qiskit/tests -m 'not (qpu or sim)' --cov -n auto
pytest tests/ src/*/tests -m 'not (qpu or sim)' --cov -n auto
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9

- name: Install OpenQAOA
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_dev_ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9
- name: Install qvm
run: |
find /usr/lib -name "libffi.so*"
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
source env/bin/activate
ipython kernel install --name "env" --user
pytest tests/ src/*/tests/ -v -m 'not (qpu or docker_aws or api or sim or braket_api)'
pytest tests/ src/*/tests/ -v -m 'not (qpu or docker_aws or api or sim or braket_api or cplex)'
docs-ext:
runs-on: ubuntu-latest
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9

- name: Install OpenQAOA
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_main_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10']
python: ['3.9', '3.10']
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

Expand All @@ -38,7 +38,7 @@ jobs:
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip
make dev-install-tests
make dev-install-tests-cplex
pip install ipykernel
- name: Setup IBMQ account
env:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
run: |
source env/bin/activate
ipython kernel install --name "env" --user
pytest tests/ src/openqaoa-core/tests src/openqaoa-azure/tests src/openqaoa-braket/tests src/openqaoa-qiskit/tests -m 'not (qpu or sim)' --cov --cov-report=xml:coverage.xml
pytest tests/ src/*/tests -m 'not (qpu or sim)' --cov --cov-report=xml:coverage.xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand All @@ -86,7 +86,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.9

- name: Install OpenQAOA
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_main_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10']
python: ['3.9', '3.10']
forest-sdk-version: ['2.23.0']

runs-on: macos-latest
Expand Down Expand Up @@ -56,4 +56,4 @@ jobs:
run: |
source env/bin/activate
ipython kernel install --user --name "env"
pytest tests/ src/openqaoa-core/tests src/openqaoa-azure/tests src/openqaoa-braket/tests src/openqaoa-qiskit/tests -m 'not (qpu or api or docker_aws or braket_api or sim)'
pytest tests/ src/*/tests -m 'not (qpu or api or docker_aws or braket_api or sim or cplex)'
6 changes: 3 additions & 3 deletions .github/workflows/test_main_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10']
python: ['3.9', '3.10']
forest-sdk-version: [2.23.0]

# Run on a Windows machine
Expand Down Expand Up @@ -63,5 +63,5 @@ jobs:
run: |
.\env\Scripts\Activate.ps1
ipython kernel install --name "env" --user
pytest tests/ src/openqaoa-core/tests src/openqaoa-azure/tests src/openqaoa-braket/tests src/openqaoa-qiskit/tests -m 'not (qpu or api or docker_aws or braket_api or sim)'
Get-ChildItem -Directory | ForEach-Object { pytest $_.FullName -m 'not (qpu or api or docker_aws or braket_api or sim)'}
pytest tests/ src/*/tests -m 'not (qpu or api or docker_aws or braket_api or sim or cplex)'
Get-ChildItem -Directory | ForEach-Object { pytest $_.FullName -m 'not (qpu or api or docker_aws or braket_api or sim or cplex)'}
2 changes: 1 addition & 1 deletion .github/workflows/test_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10']
python: ['3.9', '3.10']
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_pypi_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ dmypy.json
braket-job*/

# Visual Studio code
.vscode/
.vscode/

debug.txt
debug_copy.txt
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
local-install:
pip install ./src/openqaoa-core
pip install ./src/openqaoa-qiskit
# pip install ./src/openqaoa-pyquil
pip install ./src/openqaoa-pyquil
pip install ./src/openqaoa-braket
pip install ./src/openqaoa-azure
pip install .
Expand All @@ -14,7 +14,7 @@ local-install:
dev-install:
pip install -e ./src/openqaoa-core
pip install -e ./src/openqaoa-qiskit
# pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure
pip install -e .
Expand All @@ -23,7 +23,16 @@ dev-install:
dev-install-tests:
pip install -e ./src/openqaoa-core[tests]
pip install -e ./src/openqaoa-qiskit
# pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure
pip install -e .

.PHONY: dev-install-tests-cplex
dev-install-tests-cplex:
pip install -e ./src/openqaoa-core[tests-cplex]
pip install -e ./src/openqaoa-qiskit
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure
pip install -e .
Expand All @@ -32,7 +41,7 @@ dev-install-tests:
dev-install-docs:
pip install -e ./src/openqaoa-core[docs]
pip install -e ./src/openqaoa-qiskit
# pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure
pip install -e .
Expand All @@ -41,7 +50,7 @@ dev-install-docs:
dev-install-all:
pip install -e ./src/openqaoa-core[all]
pip install -e ./src/openqaoa-qiskit
# pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-pyquil
pip install -e ./src/openqaoa-braket
pip install -e ./src/openqaoa-azure
pip install -e .
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# OpenQAOA

A multi-backend python library for quantum optimization using QAOA on Quantum computers and Quantum computer simulators. Check out the OpenQAOA website at [https://openqaoa.entropicalabs.com/](https://openqaoa.entropicalabs.com/)


**OpenQAOA is currently in OpenBeta.**

Expand Down
2 changes: 1 addition & 1 deletion _version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.5"
__version__ = "0.2.6"
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Contents
notebooks/13_optimizers.ipynb
notebooks/14_qaoa_benchmark.ipynb
notebooks/X_dumping_data.ipynb

notebooks/15_Zero_Noise_Extrapolation.ipynb

Indices and tables
==================
Expand Down
407 changes: 181 additions & 226 deletions examples/01_workflows_example.ipynb

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions examples/02_simulators_comparison.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/04_qaoa_variational_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
"source": [
"For instance, for a depth-2 circuit the corresponding unitary operator would then become:\n",
"\n",
"\\begin{multline}\n",
"U(\\beta ,\\gamma ,\\Gamma )=exp(i\\sum_j\\beta^{(2)}_jX_j)exp(−i\\sum_{j∈s}\\gamma^{(2)}_jh_jZ_j− \\\\ (i/2)\\sum_{j,k∈\\Pi}\\Gamma^{(2)}_{jk}g_{jk}Z_jZ_k)exp(i\\sum_j\\beta^{(1)}_jX_j) \\\\ exp(−i\\sum_{j∈s}\\gamma^{(1)}_jh_jZ_j−(i/2)\\sum_{j,k∈\\Pi}\\Gamma^{(1)}_{jk}g_{jk}Z_jZ_k)\n",
"\\end{multline}"
"\\begin{align*}\n",
"U(\\beta ,\\gamma ,\\Gamma )=&\\text{exp}{\\Big(i\\sum_j\\beta^{(2)}_jX_j\\Big)}\\cdot \\text{exp}{\\Bigg(−i\\sum_{j∈s}\\gamma^{(2)}_jh_jZ_j− (i/2)\\sum_{j,k∈\\Pi}\\Gamma^{(2)}_{jk}g_{jk}Z_jZ_k\\Bigg)} \\\\ &\\qquad\\qquad\\qquad\\cdot\\text{exp}{\\Big(i\\sum_j\\beta^{(1)}_jX_j\\Big)}\\cdot\\text{exp}{\\Bigg(−i\\sum_{j∈s}\\gamma^{(1)}_jh_jZ_j−(i/2)\\sum_{j,k∈\\Pi}\\Gamma^{(1)}_{jk}g_{jk}Z_jZ_k\\Bigg)}\n",
"\\end{align*}"
]
},
{
Expand Down Expand Up @@ -254,8 +254,8 @@
"Standard Parameterisation:\n",
"\tp: 1\n",
"Variational Parameters:\n",
"\tbetas: [0.67825497]\n",
"\tgammas: [1.33848011]"
"\tbetas: [0.76515737]\n",
"\tgammas: [2.96213888]"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -309,10 +309,10 @@
"Extended Parameterisation:\n",
"\tp: 1\n",
"Parameters:\n",
"\tbetas_singles: [[1.93258376 1.75922895 2.027917 ]]\n",
"\tbetas_singles: [[2.95554443 1.63009578 2.5532 ]]\n",
"\tbetas_pairs: []\n",
"\tgammas_singles: [[0.79981656]]\n",
"\tgammas_pairs: [[1.25608449 2.33059942]]"
"\tgammas_singles: [[2.19785279]]\n",
"\tgammas_pairs: [[0.92556918 1.88298698]]"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -687,9 +687,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "fix_qiskit_and_deprecations",
"language": "python",
"name": "oq_reviews"
"name": "fix_qiskit_and_deprecations"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -701,7 +701,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.13"
},
"vscode": {
"interpreter": {
Expand Down
56 changes: 33 additions & 23 deletions examples/05_advanced_parameterization.ipynb

Large diffs are not rendered by default.

42 changes: 31 additions & 11 deletions examples/06_fast_qaoa_simulator.ipynb

Large diffs are not rendered by default.

34 changes: 21 additions & 13 deletions examples/07_cost_landscapes_w_manual_mode.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 8cd6fa8

Please sign in to comment.