Skip to content

Commit

Permalink
* Fixed tests and added comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
eggerdj committed Oct 4, 2024
1 parent 3cf6f3d commit 0ae273b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions qopt_best_practices/transpilation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Module with transpiler methods for QAOA like circuits."""

from .preset_qaoa_passmanager import qaoa_swap_strategy_pm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def run(self, cost_layer_dag: DAGCircuit):
f"{init_state.num_qubits} != {num_qubits}"
)

# Note: converting to circuit is iniefficent. This should be update to DAG only work.
cost_layer = dag_to_circuit(cost_layer_dag)
qaoa_circuit = QuantumCircuit(num_qubits, num_qubits)

Expand Down
4 changes: 2 additions & 2 deletions test/test_qubit_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_qubit_selection(self):
path_finder = BackendEvaluator(self.backend)
path, _, _ = path_finder.evaluate(len(self.mapped_graph))

expected_path = [45, 46, 47, 48, 49, 55, 68, 69, 70, 74]
expected_path = [33, 39, 40, 72, 41, 81, 53, 60, 61, 62]
self.assertEqual(set(path), set(expected_path))

def test_qubit_selection_v1_v2(self):
Expand All @@ -59,5 +59,5 @@ def test_qubit_selection_v1_v2(self):
for backend in backends:
path_finder = BackendEvaluator(backend)
path, _, _ = path_finder.evaluate(len(self.mapped_graph))
expected_path = [1, 2, 4, 7, 8, 10, 11, 12, 13, 14]
expected_path = [8, 9, 11, 12, 13, 14, 15, 18, 21, 23]
self.assertEqual(set(path), set(expected_path))

0 comments on commit 0ae273b

Please sign in to comment.