@@ -341,7 +341,6 @@ def _apply_qiskit_action(self, action: Action, action_index: int) -> QuantumCirc
341
341
def metric_fn (circ : QuantumCircuit ) -> float :
342
342
return float (circ .count_ops ().get ("swap" , 0 ))
343
343
344
- # for stochastic actions, pass the layout/routing trials parameter
345
344
max_iteration = self .max_iter
346
345
if "Sabre" in action .name and "AIRouting" not in action .name :
347
346
# Internal trials for Sabre
@@ -359,6 +358,10 @@ def metric_fn(circ: QuantumCircuit) -> float:
359
358
max_iteration = max_iteration ,
360
359
metric_fn = metric_fn ,
361
360
)
361
+ else :
362
+ msg = f"Unknown stochastic action: { action .name } "
363
+ raise ValueError (msg )
364
+
362
365
else :
363
366
if action .name in ["QiskitO3" , "Opt2qBlocks" ] and isinstance (action , DeviceDependentAction ):
364
367
passes = action .transpile_pass (
@@ -378,8 +381,8 @@ def metric_fn(circ: QuantumCircuit) -> float:
378
381
pm = PassManager (transpile_pass )
379
382
altered_qc = pm .run (self .state )
380
383
pm_property_set = dict (pm .property_set ) if hasattr (pm , "property_set" ) else {}
384
+
381
385
if action_index in (self .actions_mapping_indices + self .actions_final_optimization_indices ):
382
- pm_property_set = dict (pm .property_set )
383
386
altered_qc = self ._handle_qiskit_layout_postprocessing (action , pm_property_set , altered_qc )
384
387
385
388
return altered_qc
0 commit comments