MinimumPoint
class qiskit.transpiler.passes.MinimumPoint(*args, **kwargs)
Bases: TransformationPass
Check if the DAG has reached a relative semi-stable point over previous runs
This pass is similar to the FixedPoint
transpiler pass and is intended primarily to be used to set a loop break condition in the property set. However, unlike the FixedPoint
class which only sets the condition if 2 consecutive runs have the same value property set value this pass is designed to find a local minimum and use that instead. This pass is designed for an optimization loop where a fixed point may never get reached (for example if synthesis is used and there are multiple equivalent outputs for some cases).
This pass will track the state of fields in the property set over its past executions and set a boolean field when either a fixed point is reached over the backtracking depth or selecting the minimum value found if the backtracking depth is reached. To do this it stores a deep copy of the current minimum DAG in the property set and when backtrack_depth
number of executions is reached since the last minimum the output dag is set to that copy of the earlier minimum.
Fields used by this pass in the property set are (all relative to the prefix
argument):
-
{prefix}_minimum_point_state
- Used to track the state of the minimum point search -
{prefix}_minimum_point
- This value gets set toTrue
when either a fixed pointis reached over the
backtrack_depth
executions, orbacktrack_depth
was exceeded and an earlier minimum is restored.
Initialize an instance of this pass
Parameters
- property_set_list (list) – A list of property set keys that will be used to evaluate the local minimum. The values of these property set keys will be used as a tuple for comparison
- prefix (str) – The prefix to use for the property set key that is used for tracking previous evaluations
- backtrack_depth (int) – The maximum number of entries to store. If this number is reached and the next iteration doesn’t have a decrease in the number of values the minimum of the previous n will be set as the output dag and
minimum_point
will be set toTrue
in the property set
Attributes
is_analysis_pass
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
is_transformation_pass
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
execute
execute(passmanager_ir, state, callback=None)
Execute optimization task for input Qiskit IR.
Parameters
- passmanager_ir (Any) – Qiskit IR to optimize.
- state (PassManagerState) – State associated with workflow execution by the pass manager itself.
- callback (Callable | None) – A callback function which is caller per execution of optimization task.
Returns
Optimized Qiskit IR and state of the workflow.
Return type
tuple[Any, qiskit.passmanager.compilation_status.PassManagerState]
name
run
update_status
update_status(state, run_state)
Update workflow status.
Parameters
- state (PassManagerState) – Pass manager state to update.
- run_state (RunState) – Completion status of current task.
Returns
Updated pass manager state.
Return type