Skip to main contentIBM Quantum Documentation

CSPLayout

qiskit.transpiler.passes.CSPLayout(*args, **kwargs) GitHub(opens in a new tab)

Bases: AnalysisPass

If possible, chooses a Layout as a CSP, using backtracking.

If possible, chooses a Layout as a CSP, using backtracking.

If not possible, does not set the layout property. In all the cases, the property CSPLayout_stop_reason will be added with one of the following values:

  • solution found: If a perfect layout was found.
  • nonexistent solution: If no perfect layout was found and every combination was checked.
  • call limit reached: If no perfect layout was found and the call limit was reached.
  • time limit reached: If no perfect layout was found and the time limit was reached.

Parameters

  • coupling_map (Union[CouplingMap, Target]) – Directed graph representing a coupling map.
  • strict_direction (bool(opens in a new tab)) – If True, considers the direction of the coupling map. Default is False.
  • seed (int(opens in a new tab)) – Sets the seed of the PRNG.
  • call_limit (int(opens in a new tab)) – Amount of times that constraint.RecursiveBacktrackingSolver.recursiveBacktracking will be called. None means no call limit. Default: 1000.
  • time_limit (int(opens in a new tab)) – Amount of seconds that the pass will try to find a solution. None means no time limit. Default: 10 seconds.

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

Returns

Optimized Qiskit IR and state of the workflow.

Return type

tuple(opens in a new tab)[Any(opens in a new tab), qiskit.passmanager.compilation_status.PassManagerState]

name

name()

Name of the pass.

Return type

str(opens in a new tab)

run

run(dag)

run the layout method

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

PassManagerState

Was this page helpful?