Skip to content

CSP ignores 3-or-more-qubit gates #7155

@1ucian0

Description

@1ucian0

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"]
'solution found'

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    Assigned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions