Information
- Qiskit Terra version: main
What is the current behavior?
Take the following circuit:
from qiskit import QuantumCircuit
qc = QuantumCircuit(3)
qc.cx(0,1)
qc.ccx(2,0,1)
qc.draw()
q_0: ──■────■──
┌─┴─┐┌─┴─┐
q_1: ┤ X ├┤ X ├
└───┘└─┬─┘
q_2: ───────■──
CSPLayout should not be able to find a solution with a layout 0- > 1 -> 2. However:
from qiskit.transpiler import CouplingMap
from qiskit.transpiler.passes import CSPLayout
pass_ = CSPLayout(CouplingMap([(0, 1), (1, 2)]))
result = pass_(qc)
pass_.property_set["CSPLayout_stop_reason"]
Suggested solutions
There are two options. If CSPLayout encounters a 3-or-more-qubit gate, either assumes that this needs complete connection among the involved qubits, or just fails with reason 3-or-more-qubit gate found.
Information
What is the current behavior?
Take the following circuit:
CSPLayoutshould not be able to find a solution with a layout0- > 1 -> 2. However:Suggested solutions
There are two options. If
CSPLayoutencounters a 3-or-more-qubit gate, either assumes that this needs complete connection among the involved qubits, or just fails with reason3-or-more-qubit gate found.