LineRoutingPTN#

Module: iqm.qaoa.transpiler.ptn.ptn

class iqm.qaoa.transpiler.ptn.ptn.LineRoutingPTN(problem_bqm, qpu, initial_mapping=None)[source]#

Bases: BaseRoutingPTN

Subclass implementing the PTN line strategy.

Attributes

Methods

build_qiskit

Build the QAOA circuit from the routing (self) in qiskit.

Parameters:
  • problem_bqm (BinaryQuadraticModel)

  • qpu (QPU)

  • initial_mapping (LineMappingPTN | None)

build_qiskit(betas, gammas, measurement=True)[source]#

Build the QAOA circuit from the routing (self) in qiskit.

The LineRoutingPTN (self) contains all the information needed to create the phase separator part of the QAOA circuit. This method builds the rest of the circuit from it, i.e.:

  1. It initializes the qubits in the \(| + >\) state by applying the Hadamard gate to all of them.

  2. It applies local fields (RZ gates).

  3. It applies the PTN layers of DCNOT, mapping the qubit parities to the line qubits, applying interactions (RZ gates) in between the layers.

  4. It applies the driver.

  5. It repeats steps 2-5 until it uses up all betas and gammas.

  6. It applies the measurements and barrier before them.

Parameters:
  • betas (list[float]) – The QAOA parameters to be used in the driver (RX gate).

  • gammas (list[float]) – The QAOA parameters to be used in the phase separator (RZ and RZZ gates).

  • measurement (bool) – Should the circuit contain a layer of measurements or not?

Returns:

A complete QAOA QuantumCircuit.

Raises:

ValueError – If lengths of gammas and betas are not the same.

Return type:

QuantumCircuit

Inheritance

Inheritance diagram of iqm.qaoa.transpiler.ptn.ptn.LineRoutingPTN