Optimal ILP-Based Approach for Gate Location Assignment and Scheduling in Quantum Circuits

Physical design and synthesis are two key processes of quantum circuit design methodology. The physical design process itself decomposes into scheduling, mapping, routing, and placement. In this paper, a mathematical model is proposed for mapping, routing, and scheduling in ion-trap technology in order to minimize latency of the circuit. The proposed model which is a mixed integer linear programming (MILP) model gives the optimal locations for gates and the best sequence of operations in terms of latency. Experimental results show that our scheme outperforms the other schemes for the attempted benchmarks.


Introduction
Quantum effects have been a major concern in classical computers in metal-oxide-semiconductor technology (CMOS) as the feature size shrinks into the 10 s of nanometers range [1].Quantum effects such as entanglement and superposition are amplified in quantum computers.They operate on the entangled superposition states and this is where the power of quantum algorithms comes from.
A quantum circuit is a model for quantum computation.In a large picture, the quantum circuit design flow includes two main tasks: synthesis and physical design (Figure 1).The physical design consists of scheduling, mapping, and placement processes.In this paper, an ILP-based approach is proposed for scheduling, routing, and mapping processes.The proposed approach takes an initial netlist and a layout, and maps and schedules the gates on the layout.
A quantum circuit is defined as a sequence of quantum operations acting on one or multiple qubits.These operations could be categorized in two groups: (1) single or multiqubit logical gates and (2) single qubit measurement.In this paper, only one-and two-qubit operations are considered due to some practical limitations on many quantum circuit technologies [2].
Ion-trap technology is a quantum technology where every universal element for quantum computation has been realized with a clear scalable communication model [3,4].In this technology, an ion is the physical demonstration of a qubit and a gate location is a location wherein a gate is performed.Each ion could be trapped or physically moved between traps by applying pulse sequences to discrete electrodes (Figure 2).Each qubit is measured by stimulating the target ion with a different frequency laser pulse [5].
In this paper, library of macroblocks which is defined in [6] (Figure 3) is used due to two major advantages.The main reason is that by using this library, some low level details could be removed and it is not necessary to consider the variations in ion types, size of electrodes, and precise voltage levels needed for trapping and moving ions.All of these details are condensed within the macroblocks [7,8].
In this library, a 3 × 3 structure of trap regions and electrodes forms each macroblock.Each structure has some ports to allow qubits to move between the macroblocks.Gate locations are indicated by black squares.Various orientations of each macroblock could be used in a layout.
The paper is continued as follows: an overview of the prior work is presented in Section 2, followed by the details of the proposed model in Section 3.An illustrative example   is presented in Section 4. Section 5 shows the experimental results, and Section 6 concludes the paper.

Related Work
There are a lot of techniques proposed for optimization in synthesis process [6,[10][11][12][13][14], but a few studies have been done on optimization problems in the quantum physical stage.
Metodi et al. [15] presented a physical operations scheduler (QPOS) which takes a description of a circuit and a definite physical layout and produces a sequence of operations which indicates the required communication and possible parallelism in the circuit.Dousti and Pedram [16] presented an algorithm for scheduling, placement, and routing of a quantum circuit which decreases the circuit latency.They developed a heuristic for placement called MVFB which improved the center placement used in the previous quantum CAD tool [17,18].Balensiefer et al. [17,18] proposed a design flow and compilation technique to consider fault-tolerance and developed some tools to appraise layouts.Whitney et al. [9] proposed a computer-aided design flow for the layout, scheduling, and control of ion-trap-based quantum circuits.They proposed two heuristics for layout design.The first heuristic is a greedy algorithm that is appropriate for small circuits.Dataflow-based algorithm was proposed for larger circuits aiming at placement and routing.Maslov et al. [19] proposed heuristics for the mapping of quantum circuits onto molecules used in liquid state NMR quantum computing technology.Their algorithm starts with a molecule to be used for computation, modeled as a weighted graph with edges representing atomic couplings within the molecule.The dataflow graph of the circuit is mapped onto the molecule graph with an effort to minimize overall circuit latency.
Mohammadzadeh et al. [8] proposed an optimization technique applying gate location changing (GLC) to reduce the latency of quantum circuits.The proposed technique finds critical paths by the use of layout and scheduling information and reduces their latency by modifying locations of the gates on the critical path.These authors gave an introduction to the physical synthesis concept in quantum circuits [20][21][22] which includes techniques that change the netlist using layout information to improve latency and/or area as the main performance indicators of the circuits.
Yazdani et al. [23] presented a physical design flow for quantum circuits in ion-trap technology which consists of two parts.First, a scheduler takes a description of a circuit and finds the best order for the execution of its quantum gates using ILP.Then a layout generator receives the schedule produced by the scheduler and generates a layout for this circuit using a graph-drawing algorithm [24].This work uses ILP only to schedule quantum circuits.
To the best of our knowledge, there is no ILP model in the literature in which mapping, scheduling, and routing are considered simultaneously.Focusing on this issue, in this paper, a model is proposed for them in the physical design stage.The proposed model gives the optimal mapping (i.e., locations of the gates) as well as the optimal routing and scheduling in terms of latency.

The Proposed Approach
In this section, a mixed integer linear programming model is presented for scheduling, routing, and mapping of quantum circuits.This model is proposed to minimize latency of a quantum circuit.It takes an initial netlist and a layout as inputs and finds the optimum initial locations for qubits, optimum gate location for each gate, and the optimum sequence of operations in such way that the latency of the circuit is minimized (Figure 4).
Suppose that each gate has a processing time (p  ), where  ∈ {1, 2, . . ., }.For one-qubit gates, the processing time is 1 s and for two-qubit gate is 10 s as mentioned in Table 1.Each gate has a starting time (S  ) that is a variable.Due to qubit congestion and gate dependencies, all gates cannot MILP Model: Minimize subject to [13|6] GLC Proposed approach ∈ {0, 1} , ∀, ∈ {1, . . ., } , ∈ {0, 1} , ∀,  ∈ {1, . . ., } , ≥ 0, ∀ ∈ {1, . . ., } , Formula (1) illustrates the objective-the maximum completion time (critical path)-to be minimized.Formula (2) defines the critical path as the maximum completion time of gates.Formula (3) illustrates priority dependencies.Formulas (4) and ( 5) are used to prevent congestions.Based on these two constraints, either gate  would be started first and gate   starts after finishing time of gate  plus the transferring time of the common qubit or gate   starts first and gate  starts after finishing time of gate   plus the transferring time of the common qubit.Formula (6) ensures that each gate location is only assigned to one gate and (7) ensures that each gate is located in only one location.Constraints ( 9)-( 10) are related to definition of variables.

An Example
To illustrate the idea of the proposed approach, an example is presented in this section.Figure 5(a) shows QASM [27] instruction sequence of circuit [9-1-3] [28].The example has been solved by GLC technique [8] and the proposed approach.Physical latencies shown in Table 1 have been  used to calculate operation latency.In this example, latency obtained by the GLC technique is 189 s, while for the proposed model it is 142 s.model.The dataflow graph of the circuit which is attained by the proposed approach is shown in Figure 6.

Experimental Results
The computational analysis presented in this section is to evaluate the proposed model.Different benchmarks were selected from [28,29].The proposed model was fed with the data of these benchmarks and solved using the CPLEX MIP solver in GAMS tool [30].The software was run on a Dual core 2.26 GHz processor with 2 GB of RAM.After solving the benchmarks, numbers of extended variables, number of extended constraints, and the latency were calculated.Table 2 shows structure of the benchmarks with the numbers of extended variables and number of extended constraints.
In MILP models, size of the model is a function of total number of extended variables and constraints.By increasing Table 3: The latency of the benchmark circuits achieved by the proposed approach compared with [8].

Benchmark
Latency (s) Improvement (%) GLC [8]  the number of gates as well as complexity of data flow graph, the number of extended variables (Figure 7) and constraints (Figure 8) are increased.The number of extended variables varies from 5 to 4479, while total number of extended constraints is between 199 and 880661.
To evaluate the proposed model, the latency of each benchmark is compared to results of the GLC technique [8] that is the best in the literature.Table 3 shows the computational results.
Experimental results show that the proposed model could find the minimum latency for small circuits and improve the latency of benchmarks up to 38%.For larger circuits, because of the exponential increase in the size of the problem, MILP solver cannot find the optimum solution, but it still improves the latency.Figure 9 depicts a comparable view on the results of the GLC algorithm and those of the proposed model for each benchmark.
As mentioned in Section 2, Yazdani et al. [23] proposed an ILP-based approach that uses ILP to schedule a circuit.To evaluate the effectiveness of our approach over theirs, a comparison has been done between the results obtained from  the proposed model, the ILP-based approach [23], and GLC method [8].The computational results in Table 4 show the approach proposed in this paper that improves the average latency by about 25.5% and 36.1% compared with GLC and previous ILP-based approach, respectively.Figure 10 presents a comparable view on the results of the proposed model, GLC algorithm [8,23].
In sum, the proposed model adopts an integrated approach in which gate location problem, routing, and scheduling are optimized simultaneously.The GLC technique [8] and the ILP-based model proposed in [23] are dominated by the proposed model in all attempted benchmarks.The GLC technique follows a hierarchal approach for gate location, routing, and scheduling of the circuits, while in [23] an ILP-based model is used to schedule a circuit and then the placement procedure is done on the scheduled circuit.

Conclusion
In this paper, a mathematical model for mapping, routing, and scheduling in ion-trap technology was proposed for minimizing the latency of the quantum circuit.The proposed model follows an integrated approach in which gate location assigning, routing, and scheduling are optimized simultaneously.An example was analyzed to illustrate the application of the proposed model.Moreover, some analysis was done on different size of benchmarks to evaluate the efficiency of the proposed model in comparison to the best work reported in the literature.The proposed model could offer a considerable amount of improvement in all attempted circuits.The results showed that it is possible to obtain optimal or near optimal solutions within a reasonable amount of time for small sizes instances.However, when the size of  benchmarks was larger, more time and space are required to achieve the optimal solution.The future work is to develop some heuristic solution methods for optimization of large benchmarks.

Figure 3 :
Figure 3: Library of basic macroblocks used in this paper [6].

Figure 4 :
Figure 4: Inputs and outputs of the proposed model.

Figure 5 :
Figure 5: (a) A circuit netlist.(b) The gate locations assigned by GLC technique and the proposed approach.

Figure 6 :
Figure 6: Dataflow graph of the example based on the proposed model.

Figure 5 (Figure 7 :
Figure 7: The number of extended variables in each class of benchmarks.

3 Figure 8 :
Figure 8: The number of extended constraints in each class of benchmarks.

Figure 9 :
Figure 9: Improvement in the latency (s) of the benchmarks achieved by the proposed model.

Figure 10 :
Figure 10: Improvement in the latency (s) of the benchmarks achieved by the proposed model.

Table 1 :
[26]ncy values for various physical operations in ion-trap technology[25].+p.Let  ∈ {1, 2, ..., } be a set of locations and each gate is located at one place.Parameter    indicates the distance between location  and location   and is calculated using values mentioned in Table1.Strict Manhattan distance is not an accurate measure to calculate distance between locations, because preliminary studies in ion-trap technology have shown that turning corners and traversing intersections will be more time consuming than moving straight through a one-way channel[26].Therefore, in this paper, a modified version of Manhattan distance is used that considers the latencies of both straight movement and turn in, calculating the distance between gate locations.The value of variable   denotes location of each gate.Variable   is 1 if gate  is located at location .Each gate may have two kinds of dependencies to other gates.If gate  must be executed before gate   and it changes the value of qubit  and gate   needs this qubit, therefore, gate   has to wait until execution of gate  is finished.In the proposed model, set    represents this type of dependency.The other kind of dependency which is represented by set    occurs when both gate  and gate   need qubit  in this case data congestion would occur.The binary variable    is used to model the second type of dependency, if    = 1 it means that gate  is executed at first and if    = 0 it means that gate   is executed at first.In the following formulation,  indicates a very big number.The proposed model is summarized as follows.

Table 2 :
Benchmarks used for evaluation of the proposed model.