Repository: cda-tum/mqt-bench (language: python)

Issue:
Remove "Excited State" Benchmark
Benchmark should be removed since deprecated methods are used.


Discussion / hints:

Fix patch:
diff --git a/mqt/bench/benchmark_generator.py b/mqt/bench/benchmark_generator.py
index 864bf4093..592a92180 100644
--- a/mqt/bench/benchmark_generator.py
+++ b/mqt/bench/benchmark_generator.py
@@ -19,7 +19,7 @@
     pricingcall,
     pricingput,
 )
-from mqt.bench.benchmarks.qiskit_application_nature import groundstate, excitedstate
+from mqt.bench.benchmarks.qiskit_application_nature import groundstate
 
 
 from mqt.bench.utils import qiskit_helper, tket_helper, utils
@@ -194,15 +194,6 @@ def generate_benchmark(benchmark):
                 if not res:
                     break
 
-        elif benchmark["name"] == "excitedstate":
-            for choice in benchmark["instances"]:
-                res_qc_creation = qc_creation_watcher(create_excitedstate_qc, [choice])
-                if not res_qc_creation:
-                    break
-                res = generate_circuits_on_all_levels(*res_qc_creation)
-                if not res:
-                    break
-
         elif benchmark["name"] == "pricingcall":
             for nodes in range(
                 benchmark["min_uncertainty"], benchmark["max_uncertainty"]
@@ -458,24 +449,6 @@ def create_groundstate_qc(choice: str):
         )
 
 
-def create_excitedstate_qc(choice: str):
-    molecule = utils.get_molecule(choice)
-
-    try:
-        qc = excitedstate.create_circuit(molecule)
-        qc.name = qc.name + "_" + choice
-        return qc, qc.num_qubits, False
-
-    except Exception as e:
-        print(
-            "\n Problem occured in outer loop: ",
-            "create_excitedstate_benchmarks",
-            choice,
-            e,
-        )
-        return False
-
-
 def create_pricingcall_qc(num_uncertainty: int):
     # num_options is not the number of qubits in this case
     try:
@@ -524,7 +497,7 @@ def get_one_benchmark(
     benchmark_name -- name of the to be generated benchmark
     level -- Choice of level, either as a string ("alg", "indep", "gates" or "mapped") or as a number between 0-3 where 0 corresponds to "alg" level and 3 to "mapped" leve
     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", "excitedstate" and "shor"
+    benchmark_instance_name -- Input selection for some benchmarks, namely "groundstate" and "shor"
     compiler -- "qiskit" or "tket"
     compiler_settings -- Optimization level for if compiler is qiskit (0-3), Line Placement or Graph Placement if compiler is tket (True or False)
     gate_set_name -- "ibm", "rigetti", "ionq", or "oqc"
@@ -570,10 +543,6 @@ def get_one_benchmark(
         molecule = utils.get_molecule(benchmark_instance_name)
         qc = groundstate.create_circuit(molecule)
 
-    elif benchmark_name == "excitedstate":
-        molecule = utils.get_molecule(benchmark_instance_name)
-        qc = excitedstate.create_circuit(molecule)
-
     elif benchmark_name == "pricingcall":
         qc = pricingcall.create_circuit(circuit_size)
 
diff --git a/mqt/bench/benchmarks/qiskit_application_nature/excitedstate.py b/mqt/bench/benchmarks/qiskit_application_nature/excitedstate.py
deleted file mode 100644
index e5685ae91..000000000
--- a/mqt/bench/benchmarks/qiskit_application_nature/excitedstate.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Code based on https://qiskit.org/documentation/nature/tutorials/04_excited_states_solvers.html
-
-
-from qiskit import Aer
-from qiskit.utils import QuantumInstance
-from qiskit.circuit.library import TwoLocal
-from qiskit.algorithms import VQE
-from qiskit.algorithms.optimizers import SLSQP, COBYLA
-
-
-def create_circuit(molecule, basis: str = "sto3g"):
-    """Returns a quantum circuit implementing Excited State Estimation.
-
-    Keyword arguments:
-    molecule -- molecule for which the excited state shall be estimated.
-    basis -- basis used for estimation
-    """
-    try:
-        from qiskit_nature.drivers import Molecule
-        from qiskit_nature.drivers.second_quantization import (
-            ElectronicStructureDriverType,
-            ElectronicStructureMoleculeDriver,
-        )
-        from qiskit_nature.problems.second_quantization import (
-            ElectronicStructureProblem,
-        )
-        from qiskit_nature.converters.second_quantization import QubitConverter
-        from qiskit_nature.mappers.second_quantization import JordanWignerMapper
-        from qiskit_nature.algorithms import GroundStateEigensolver, QEOM
-    except:
-        print("Please install qiskit_nature.")
-        return None
-
-    driver = ElectronicStructureMoleculeDriver(
-        molecule, basis=basis, driver_type=ElectronicStructureDriverType.PYSCF
-    )
-
-    es_problem = ElectronicStructureProblem(driver)
-    qubit_converter = QubitConverter(JordanWignerMapper())
-
-    # This first part sets the ground state solver
-    # see more about this part in the ground state calculation tutorial
-    # quantum_instance = QuantumInstance(Aer.get_backend("aer_simulator_statevector"))
-    # solver = VQEUCCFactory(quantum_instance)
-
-    tl_circuit = TwoLocal(
-        rotation_blocks=["h", "rx"],
-        entanglement_blocks="cz",
-        entanglement="full",
-        reps=2,
-        parameter_prefix="y",
-    )
-
-    another_solver = VQE(
-        ansatz=tl_circuit,
-        quantum_instance=QuantumInstance(Aer.get_backend("aer_simulator"), shots=1024),
-        optimizer=COBYLA(maxiter=25),
-    )
-    gsc = GroundStateEigensolver(qubit_converter, another_solver)
-
-    # The qEOM algorithm is simply instantiated with the chosen ground state solver
-    qeom_excited_states_calculation = QEOM(gsc, "sd")
-
-    qeom_results = qeom_excited_states_calculation.solve(es_problem)
-
-    qc = another_solver.get_optimal_circuit()
-    qc.name = "excitedstate"
-    qc.measure_all()
-
-    # print(qeom_results)
-    return qc
diff --git a/mqt/benchviewer/src/backend.py b/mqt/benchviewer/src/backend.py
index 2dd9d0339..41982109f 100644
--- a/mqt/benchviewer/src/backend.py
+++ b/mqt/benchviewer/src/backend.py
@@ -61,14 +61,13 @@
 ]
 
 nonscalable_benchmarks = [
-    {"name": "Excited State", "id": "22", "filename": "excitedstate"},
-    {"name": "Ground State", "id": "23", "filename": "groundstate"},
-    {"name": "HHL", "id": "24", "filename": "hhl"},
-    {"name": "Pricing Call Option", "id": "25", "filename": "pricingcall"},
-    {"name": "Pricing Put Option", "id": "26", "filename": "pricingput"},
-    {"name": "Routing", "id": "27", "filename": "routing"},
-    {"name": "Shor's", "id": "28", "filename": "shor"},
-    {"name": "Travelling Salesman", "id": "29", "filename": "tsp"},
+    {"name": "Ground State", "id": "22", "filename": "groundstate"},
+    {"name": "HHL", "id": "23", "filename": "hhl"},
+    {"name": "Pricing Call Option", "id": "24", "filename": "pricingcall"},
+    {"name": "Pricing Put Option", "id": "25", "filename": "pricingput"},
+    {"name": "Routing", "id": "26", "filename": "routing"},
+    {"name": "Shor's", "id": "27", "filename": "shor"},
+    {"name": "Travelling Salesman", "id": "28", "filename": "tsp"},
 ]
 
 # Store the pandas dataframe as the database containing all available benchmarks
diff --git a/mqt/benchviewer/templates/benchmark_description.html b/mqt/benchviewer/templates/benchmark_description.html
index 7a5b46ada..47fdd7624 100644
--- a/mqt/benchviewer/templates/benchmark_description.html
+++ b/mqt/benchviewer/templates/benchmark_description.html
@@ -77,16 +77,6 @@ <h1>MQT Bench: Brief Description of Benchmarks</h1>
             </td>
             <td style="vertical-align:top">2 -> 130</td>
         </tr>
-        <tr>
-            <td style="vertical-align:top">Excited State</td>
-            <td style="vertical-align:top">This algorithms estimates the excited state of the H2
-                molecule ("small") using VQE with a TwoLocal ansatz.
-                The source code for the algorithmic level originates from
-                <a href="https://qiskit.org/documentation/nature/tutorials/04_excited_states_solvers.html"
-                   target="_blank">this page</a>.
-            </td>
-            <td style="vertical-align:top">4</td>
-        </tr>
         <tr>
             <td style="vertical-align:top">GHZ State</td>
             <td style="vertical-align:top">The Greenberger-Horne-Zeilinger state is an entangled quantum state with a
@@ -326,34 +316,6 @@ <h1>MQT Bench: Brief Description of Benchmarks</h1>
     <div class="col-xs-12" style="height:50px;"></div>
 
 
-    <!--            {"name": "GHZ State", "id": "1", "filename":"ghz"},
-                  {"name": "Graph State", "id": "2", "filename":"graphstate"},
-                  {"name": "W State", "id": "3", "filename":"wstate"},
-                  {"name": "Quantum Amplitude Estimation (QAE)", "id": "4", "filename":"ae"},
-                  {"name": "Quantum Fourier Transformation (QFT)", "id": "5", "filename":"qft"},
-                  {"name": "Entangled QFT", "id": "6", "filename":"qftentangled"},
-                  {"name": "Quantum Phase Estimation (QPE) exact", "id": "7", "filename":"qpeexact"},
-                  {"name": "Quantum Phase Estimation (QPE) inexact", "id": "8", "filename":"qpeinexact"},
-                  {"name": "Deutsch-Jozsa", "id": "9", "filename":"dj"},
-                  {"name": "Grover's (no ancilla)", "id": "10", "filename":"grover-noancilla"},
-                  {"name": "Grover's (v-chain)", "id": "11", "filename":"grover-vchain"},
-                  {"name": "Quantum Walk (no ancilla)", "id": "12", "filename":"qwalk-noancilla"},
-                  {"name": "Quantum Walk (v-chain", "id": "13", "filename":"qwalk-vchain"},
-                  {"name": "Quantum Approximation Optimization Algorithm (QAOA)", "id": "14", "filename":"qaoa"},
-                  {"name": "Variational Quantum Eigensolver (VQE)", "id": "15", "filename":"vqe"},
-                  {"name": "Portfolio Optimization with QAOA", "id": "16", "filename":"portfolioqaoa"},
-                  {"name": "Portfolio Optimization with VQE", "id": "17", "filename":"portfoliovqe"},
-                  {"name": "Ground State", "id": "18", "filename":"groundstate"},
-                  {"name": "Excited State", "id": "19", "filename":"excitedstate"},
-                  {"name": "Routing", "id": "20", "filename":"routing"},
-                  {"name": "Travelling Salesman", "id": "21", "filename":"tsp"},
-                  {"name": "Pricing Call Option", "id": "22", "filename":"pricingcall"},
-                  {"name": "Pricing Put Option", "id": "23", "filename":"pricingput"},
-                  {"name": "Quantum Generative Adversarial Network", "id": "23", "filename":"qgan"},
-                  {"name": "Shor's", "id": "24", "filename":"shor"},
-                  {"name": "HHL", "id": "25", "filename":"HHL"}]-->
-
-
     <!-- Optional JavaScript -->
     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
     <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"


Test patch:
diff --git a/mqt/bench/tests/test_all.py b/mqt/bench/tests/test_all.py
index f4d83d191..54689e1ee 100644
--- a/mqt/bench/tests/test_all.py
+++ b/mqt/bench/tests/test_all.py
@@ -26,7 +26,7 @@
     portfolioqaoa,
 )
 from mqt.bench.benchmarks.qiskit_application_ml import qgan
-from mqt.bench.benchmarks.qiskit_application_nature import groundstate, excitedstate
+from mqt.bench.benchmarks.qiskit_application_nature import groundstate
 from mqt.bench.benchmarks.qiskit_application_optimization import tsp, routing
 from qiskit_nature.drivers import Molecule
 from qiskit import QuantumCircuit
@@ -237,7 +237,7 @@ def test_dj_constant_oracle():
 
 
 @pytest.mark.skip(reason="Takes really long")
-def test_ground_and_excited_state():
+def test_groundstate():
     m_1 = Molecule(
         geometry=[["Li", [0.0, 0.0, 0.0]], ["H", [0.0, 0.0, 2.5]]],
         charge=0,
@@ -246,9 +246,6 @@ def test_ground_and_excited_state():
     qc = groundstate.create_circuit(m_1)
     assert qc.depth() > 0
 
-    qc = excitedstate.create_circuit(m_1)
-    assert qc.depth() > 0
-
 
 def test_routing():
     qc = routing.create_circuit(4, 2)
diff --git a/mqt/benchviewer/src/tests/test_backend.py b/mqt/benchviewer/src/tests/test_backend.py
index fab2a47aa..5dfec848c 100644
--- a/mqt/benchviewer/src/tests/test_backend.py
+++ b/mqt/benchviewer/src/tests/test_backend.py
@@ -145,14 +145,13 @@ def test_prepareFormInput():
             ("selectBench_19", "Real Amplitudes ansatz with Random Parameters"),
             ("selectBench_20", "Two Local ansatz with Random Parameters"),
             ("selectBench_21", "W-State"),
-            ("selectBench_22", "Excited State"),
-            ("selectBench_23", "Ground State"),
-            ("selectBench_24", "HHL"),
-            ("selectBench_25", "Pricing Call Option"),
-            ("selectBench_26", "Pricing Put Option"),
-            ("selectBench_27", "Routing"),
-            ("selectBench_28", "Shor's"),
-            ("selectBench_29", "Travelling Salesman"),
+            ("selectBench_22", "Ground State"),
+            ("selectBench_23", "HHL"),
+            ("selectBench_24", "Pricing Call Option"),
+            ("selectBench_25", "Pricing Put Option"),
+            ("selectBench_26", "Routing"),
+            ("selectBench_27", "Shor's"),
+            ("selectBench_28", "Travelling Salesman"),
             ("indep_qiskit_compiler", "true"),
             ("indep_tket_compiler", "true"),
             ("nativegates_qiskit_compiler", "true"),
@@ -212,7 +211,6 @@ def test_prepareFormInput():
             "26",
             "27",
             "28",
-            "29",
         ],
         (True, True),
         ((True, True), [0, 1, 2, 3], ["ibm", "rigetti", "oqc", "ionq"]),
@@ -285,7 +283,7 @@ def test_create_database():
 
     input_data = (
         (2, 5),
-        ["24"],
+        ["23"],
         (True, True),
         ((True, False), [1, 3], ["rigetti", "ionq", "oqc", "ibm"]),
         (