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

🔥Remove most of the qiskit application module benchmarks #404

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
340 changes: 3 additions & 337 deletions evaluation/uv.lock

Large diffs are not rendered by default.

340 changes: 3 additions & 337 deletions frontend/uv.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ dependencies = [
# there is a bug in 1.2.0 that causes an error some benchmarks, see https://github.com/Qiskit/qiskit/issues/12969
"qiskit!=1.2.0",
"qiskit_optimization>=0.6",
"qiskit_nature[pyscf]>=0.7",
"qiskit_finance>=0.4.1",
"qiskit-algorithms>=0.3",
"networkx>=2.8.8",
"joblib>=1.3.0",
"numpy>=1.26; python_version >= '3.12'",
Expand Down
18 changes: 3 additions & 15 deletions src/mqt/bench/benchmark_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ def define_benchmark_instances(self, benchmark: Benchmark) -> None:
elif benchmark["name"] == "shor":
instances = [lib.get_instance(choice) for choice in benchmark["instances"]]

elif benchmark["name"] in ("routing", "tsp"):
instances = range(benchmark["min_nodes"], benchmark["max_nodes"])

elif benchmark["name"] == "groundstate":
instances = benchmark["instances"]

elif benchmark["name"] in ("pricingcall", "pricingput"):
instances = range(benchmark["min_uncertainty"], benchmark["max_uncertainty"])

else:
instances = range(
benchmark["min_qubits"],
Expand Down Expand Up @@ -353,7 +344,7 @@ def get_benchmark(
benchmark_name: name of the to be generated benchmark
level: Choice of level, either as a string ("alg", "indep", "nativegates" or "mapped") or as a number between 0-3 where 0 corresponds to "alg" level and 3 to "mapped" level
circuit_size: Input for the benchmark creation, in most cases this is equal to the qubit number
benchmark_instance_name: Input selection for some benchmarks, namely "groundstate" and "shor"
benchmark_instance_name: Input selection for some benchmarks, namely "shor"
compiler: "qiskit" or "tket"
compiler_settings: Data class containing the respective compiler settings for the specified compiler (e.g., optimization level for Qiskit or placement for TKET)
provider_name: "ibm", "rigetti", "ionq", "oqc", or "quantinuum" (required for "nativegates" level)
Expand All @@ -371,11 +362,11 @@ def get_benchmark(
msg = f"Selected level must be in {get_supported_levels()}."
raise ValueError(msg)

if benchmark_name not in ["shor", "groundstate"] and not (isinstance(circuit_size, int) and circuit_size > 0):
if benchmark_name != "shor" and not (isinstance(circuit_size, int) and circuit_size > 0):
msg = "circuit_size must be None or int for this benchmark."
raise ValueError(msg)

if benchmark_name in ["shor", "groundstate"] and not isinstance(benchmark_instance_name, str):
if benchmark_name == "shor" and not isinstance(benchmark_instance_name, str):
msg = "benchmark_instance_name must be defined for this benchmark."
raise ValueError(msg)

Expand All @@ -398,9 +389,6 @@ def get_benchmark(
to_be_factored_number, a_value = lib.get_instance(benchmark_instance_name)
qc = lib.create_circuit(to_be_factored_number, a_value)

elif benchmark_name == "groundstate":
qc = lib.create_circuit(benchmark_instance_name)

else:
qc = lib.create_circuit(circuit_size)

Expand Down
21 changes: 0 additions & 21 deletions src/mqt/bench/benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,3 @@
"""

from __future__ import annotations

from mqt.bench.benchmarks.qiskit_application_finance import (
portfolioqaoa,
portfoliovqe,
pricingcall,
pricingput,
)
from mqt.bench.benchmarks.qiskit_application_ml import qnn
from mqt.bench.benchmarks.qiskit_application_nature import groundstate
from mqt.bench.benchmarks.qiskit_application_optimization import routing, tsp

__all__ = [
"groundstate",
"portfolioqaoa",
"portfoliovqe",
"pricingcall",
"pricingput",
"qnn",
"routing",
"tsp",
]
3 changes: 1 addition & 2 deletions src/mqt/bench/benchmarks/grover.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
from qiskit import AncillaRegister, QuantumCircuit, QuantumRegister
from qiskit.circuit.library import GroverOperator
from qiskit_algorithms import Grover


def create_circuit(num_qubits: int, ancillary_mode: str = "noancilla") -> QuantumCircuit:
Expand All @@ -27,7 +26,7 @@ def create_circuit(num_qubits: int, ancillary_mode: str = "noancilla") -> Quantu
oracle.mcp(np.pi, q, flag)

operator = GroverOperator(oracle, mcx_mode=ancillary_mode)
iterations = Grover.optimal_num_iterations(1, num_qubits)
iterations = round(np.arccos(np.sqrt(1 / 2**num_qubits)) / (2 * np.arcsin(np.sqrt(1 / 2**num_qubits))))

num_qubits = operator.num_qubits - 1 # -1 because last qubit is "flag" qubit and already taken care of

Expand Down

This file was deleted.

This file was deleted.

67 changes: 0 additions & 67 deletions src/mqt/bench/benchmarks/qiskit_application_finance/pricingcall.py

This file was deleted.

84 changes: 0 additions & 84 deletions src/mqt/bench/benchmarks/qiskit_application_finance/pricingput.py

This file was deleted.

Loading
Loading