@@ -341,7 +341,6 @@ def _apply_qiskit_action(self, action: Action, action_index: int) -> QuantumCirc
341341 def metric_fn (circ : QuantumCircuit ) -> float :
342342 return float (circ .count_ops ().get ("swap" , 0 ))
343343
344- # for stochastic actions, pass the layout/routing trials parameter
345344 max_iteration = self .max_iter
346345 if "Sabre" in action .name and "AIRouting" not in action .name :
347346 # Internal trials for Sabre
@@ -359,6 +358,10 @@ def metric_fn(circ: QuantumCircuit) -> float:
359358 max_iteration = max_iteration ,
360359 metric_fn = metric_fn ,
361360 )
361+ else :
362+ msg = f"Unknown stochastic action: { action .name } "
363+ raise ValueError (msg )
364+
362365 else :
363366 if action .name in ["QiskitO3" , "Opt2qBlocks" ] and isinstance (action , DeviceDependentAction ):
364367 passes = action .transpile_pass (
@@ -378,8 +381,8 @@ def metric_fn(circ: QuantumCircuit) -> float:
378381 pm = PassManager (transpile_pass )
379382 altered_qc = pm .run (self .state )
380383 pm_property_set = dict (pm .property_set ) if hasattr (pm , "property_set" ) else {}
384+
381385 if action_index in (self .actions_mapping_indices + self .actions_final_optimization_indices ):
382- pm_property_set = dict (pm .property_set )
383386 altered_qc = self ._handle_qiskit_layout_postprocessing (action , pm_property_set , altered_qc )
384387
385388 return altered_qc
0 commit comments