Skip to content

Commit

Permalink
QScore rebasing (#22)
Browse files Browse the repository at this point in the history
* added qscore_rebased.py

* fixed execute function

* WIP - moving stuff around in qscore_rebased.py

* WIP - moving stuff around in qscore_rebased.py

* fixed qscore_rebased code

* A few changes to qscore_rebased.py: compatibility with circuit containers and few other small fixes

* linting

* updated missing docstrings

* updated notebook

* updated BenchmarkExperiment

* qscore.py: changed logger levels, removed plt.show

* fixed test_qscore.py - using Benchmark class

* fixed observations issue

* updated notebooks with new qscore

---------

Co-authored-by: aniket.rath <aniket.rath@meetiqm.com>
Co-authored-by: Pedro Figueroa <pedro.romero@meetiqm.com>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent fbb5acc commit 0c2a4b1
Show file tree
Hide file tree
Showing 5 changed files with 903 additions and 832 deletions.
62 changes: 34 additions & 28 deletions examples/example_experiment_all.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -691,30 +691,21 @@
]
},
{
"cell_type": "markdown",
"id": "650798c9-db56-4599-8115-f3917da2be2f",
"metadata": {},
"source": [
"*QScore currently works in a slightly different way to the other benchmarks, e.g., it uses* `run_experiment` *method instead of* `run`*; this will be changed in future releases.*"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f8ad91c-1a42-4fd5-bf24-dd6f5820e560",
"metadata": {},
"outputs": [],
"execution_count": null,
"source": [
"from iqm.benchmarks.optimization.qscore import QScoreConfiguration\n",
"from iqm.benchmarks.benchmark_experiment import BenchmarkExperiment"
]
"from iqm.benchmarks.optimization.qscore import *\n",
"import random"
],
"id": "6a25a3a17ea36399"
},
{
"cell_type": "code",
"execution_count": null,
"id": "ceb9c2a3-c197-4f13-8877-6b56e356f00a",
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"EXAMPLE_QSCORE = QScoreConfiguration(\n",
" num_instances = 100,\n",
Expand All @@ -726,35 +717,50 @@
" use_virtual_node = True,\n",
" use_classically_optimized_angles = True,\n",
" choose_qubits_routine = \"custom\",\n",
" custom_qubits_array=[[2],\n",
" custom_qubits_array=[\n",
" [2, 0],\n",
" [2, 0, 1],\n",
" [2, 0, 1, 3],\n",
" [2, 0, 1, 3, 4]],\n",
" seed = 1\n",
" seed = random.randint(1, 999999),\n",
" )"
]
],
"id": "2eb11c92d788a27f"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"id": "f4969b8c-033f-4357-856f-23c340d84822",
"source": [
"benchmark_qscore = QScoreBenchmark(backend, EXAMPLE_QSCORE)\n",
"run_qscore = benchmark_qscore.run()"
],
"id": "f285a2f7165f436b"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"source": [
"benchmark = [EXAMPLE_QSCORE]"
]
"execution_count": null,
"source": "result_qscore = benchmark_qscore.analyze()",
"id": "89069aaa0d78c00a"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"id": "56c7751c-77d9-4983-a972-a53f07774ba5",
"source": "result_qscore.observations",
"id": "35fe3971071c6d36"
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"source": [
"EXAMPLE_EXPERIMENT = BenchmarkExperiment(backend, benchmark)\n",
"EXAMPLE_EXPERIMENT.run_experiment()"
]
"execution_count": null,
"source": "result_qscore.plot_all()",
"id": "8601f4807d1499d9"
}
],
"metadata": {
Expand Down
236 changes: 147 additions & 89 deletions examples/example_qscore.ipynb

Large diffs are not rendered by default.

163 changes: 0 additions & 163 deletions src/iqm/benchmarks/benchmark_experiment.py

This file was deleted.

Loading

0 comments on commit 0c2a4b1

Please sign in to comment.