qat.plugins.Nnizer

This plugin solves the SWAP Insertion Problem before submitting the circuit to any QPU. This plugin adds SWAP gates into the initial circuit, to make it match the QPU topology. The usage of this plugin is detailed in the compilation section of the documentation

class qat.plugins.Nnizer(method='atos', ignore_large_gates=False, update_initial_order=None, max_iteration=250, temperature=1000, metric=<libcpp_nnize.QuantumCostMetric object>, **kwargs)

Swap insertion problem solver.

This plugin can use different algorithms to nnize your quantum circuit. The following algorithms are implemented:

Each method can be parametrized. A list of parameters for each algorithm is displayed in the following table:

atos

sabre

bka

pbn

  • metric

  • window_size

  • basic_heuristic

  • weight

  • delta

  • window_size

  • size_slice

  • use_sum_heurisitic

  • metric

  • rewriting_method

The initial mapping of qubits can be set automatically using one of the following methods:

  • None (initial order is kept)

  • “annealing” which can be parametrized by

  • metric

  • max_iteration

  • temperature

  • “reverse” which can be parametrized by

  • metric

Keyword Arguments
  • method (str, optional) – name of the algorithm used to solve the swap insertion problem (“atos”, “sabre”, “bka” or “pbn”)

  • metric (fun<Circuit -> score>, optional) – score function this nnizer will try to maximize (used only by “atos” and “pbn”)

  • window_size (int, optional) – window size. The higher the value is, the higher the complexity is (used only by “atos” and “sabre”)

  • basic_heuristic (bool, optional) – use the basic heuristic for sabre (used only by “sabre”)

  • weight (float, optional) – weight of the second layer for sabre (used only by “sabre”)

  • delta (float, optional) – decay parameter (used only by “sabre”)

  • size_slice (int, optional) – maximal number of gates per slice (used only by “bka”)

  • use_sum_heuristic (bool, optional) – select the heuristic used by bka (only used by “bka”)

  • update_initial_order ("annealing", "reverse" or None, optional) – update the initial mapping of qubits to optimize the final nnization. Optimizing the initial order uses a metric, please use metric keyword to set the metric

  • rewriting_method ("gradient" or "annealing", optional) – PBN uses PatternManager to optimized the nnized circuit. Please use this argument to select the optimization method used by PatternManager

  • max_iteration (int, optional) – maximal number of iterations done by the simulated annealing to find an initial mapping

  • temperature (float, optional) – initial temperature of the simulated annealing used to find the initial mapping

  • **kwargs (optional) – extra arguments passed to pattern manager (only used by “pbn”)

compile(batch, specs)

Compiles the batch using the specifications of the hardware. The resulting circuit is compliant with the topological constraints of the hardware.

Parameters
  • batch (Batch) – batch to optimize

  • specs (HardwareSpecs) – hardware specifications (including connectivity constraints)