Quantum circuit design for objective function maximization in gate-model quantum computers

Gate-model quantum computers provide an experimentally implementable architecture for near-term quantum computations. To design a reduced quantum circuit that can simulate a high-complexity reference quantum circuit, an optimization should be taken on the number of input quantum states, on the unitary operations of the quantum circuit, and on the number of output measurement rounds. Besides the optimization of the physical layout of the hardware layer, the quantum computer should also solve difficult computational problems very efficiently. To yield a desired output system, a particular objective function associated with the computational problem fed into the quantum computer should be maximized. The reduced gate structure should be able to produce the maximized value of the objective function. These parallel requirements must be satisfied simultaneously, which makes the optimization difficult. Here, we demonstrate a method for designing quantum circuits for gate-model quantum computers and define the Quantum Triple Annealing Minimization (QTAM) algorithm. The aim of QTAM is to determine an optimal reduced topology for the quantum circuits in the hardware layer at the maximization of the objective function of an arbitrary computational problem.

In the physical layer of a gate-model quantum computer, the device contains quantum gates, quantum ports (of quantum gates), and quantum wires for the connection of the quantum circuit. The quantum gates are positioned in a quantum circuit such that several hardware constraints have to be satisfied. In contrast to traditional automated circuit design [24][25][26][27][28][29][30], a quantum system cannot participate in more than one quantum gate simultaneously. As a corollary, the quantum gates of a quantum circuit are applied in several rounds in the physical layer of the quantum circuit [1][2][3][4][5][6][7][8][9][10][11][16][17][18][19].
The physical layout design and optimization of quantum circuits have different requirements with several open questions and currently represent an active area of study [1][2][3][4][5][6][7][8][9][10][11][16][17][18][19]. Assuming that the goal is to construct a reduced quantum circuit that can simulate the original system, the reduction process has to be taken on the number of input quantum states, gate operations of the quantum circuit, and the number of output measurements. Another important question is the maximization of objective functions associated with arbitrary computational problems that are fed into the quantum circuits of the quantum computer. These parallel requirements must be satisfied simultaneously, which makes the optimization procedure difficult and are an emerging issue in present and future quantum computer developments.
In our proposed Quantum Triple Annealing Minimization (QTAM) method the goal is to determine a connection topology for the quantum circuits of quantum computer architectures that can solve arbitrary computational problems such that the quantum circuit is minimized in the physical layer, and the objective function of an arbitrary selected computational problem is maximized. The physical layer minimization covers the simultaneous minimization of the quantum circuit area (quantum circuit height and depth of the quantum gate structure), the total area of the quantum wires of the quantum circuit, the reduction of the Hamiltonian operator, and the minimization of the required number of input quantum systems and output measurements. An important aim of the physical layout minimization is that the resulting quantum circuit has to be identical to an original 'reference' quantum circuit (i.e., the reduced quantum circuit has to be able to simulate a non-reduced, reference quantum circuit). This simulation requirement is established by several different constraints in our automated connection topology construction procedure.
The minimization of the total quantum wire length in the physical layout is also an objective in QTAM. It serves to improve the routing quality in the topology of the quantum circuit. However, besides the minimization of the physical layout of the quantum circuit, the quantum computer also has to solve difficult computational problems very efficiently (such as the maximization of an arbitrary combinatorial optimization objective function [16][17][18][19]. To achieve this goal in our QTAM method, we also defined an objective function that provides the maximization of an arbitrary combinatorial optimization objective function. The optimization method can be further tuned by specific input constraints on the connection topology of the quantum circuit (paths in the quantum circuit, organization of quantum gates, required number of rounds of quantum gates, required number of measurement operators, Hamiltonian minimization, entanglement between quantum states, etc.) or other hardware restrictions of quantum computers, such as the well-known no-cloning theorem [22]. The various restrictions on quantum hardware, such as the number of rounds required to be integrated into the quantum gate structure, entanglement generation between the quantum states, and multipartite entanglement groups are included in our scheme. These constraints and design attributes can be handled in our scheme through the definition of arbitrary constraints on the topology of the quantum circuit via the distribution properties of the condensate wave function amplitude and phase values, or by constraints on computational paths of the quantum circuit topology.
The combinatorial objective function is measured on a computational basis, and an objective function is determined from the measurement result to quantify the current state of the quantum computer. As has been demonstrated, quantum computers can be used for combinatorial optimization problems. These procedures aim to use the quantum computer to produce a quantum system that is dominated by computational basis states such that a particular objective function is maximized. In our procedure, the objective function subject of a maximization can be an arbitrary combinatorial problem.
Presently, without loss of generality, the recent experimental realizations of quantum computers are qubit architectures [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19], and the current quantum hardware approaches focus on qubit systems (i.e., the dimension d of the quantum system is two, d = 2). However, while the qubit layout is straightforwardly inspirable by ongoing experiments, our method is developed for arbitrary dimensions to make it applicable for future implementations. Motivated by these assumptions, we therefore would avoid the term 'qubit' in our scheme to address the quantum states and instead use the generalized term, 'quantum states' throughout, which refers to an arbitrary dimensional quantum system. We demonstrate the results through superconducting quantum circuits [1][2][3][4][5]; however, the framework is general and flexible, allowing a realization for near term gate-model quantum computer implementations.
The novel contributions of this paper are as follows: • We define an automated method for designing quantum circuits for gate-model quantum computers.
• We conceive the QTAM algorithm, which provides an automated quantum circuit minimization on the physical layout (circuit depth and area), quantum wire length minimization, Hamiltonian minimization, input size and measurement size minimization for quantum circuits.
• We define a multilayer structure for quantum circuit computations using the hardware restrictions on the connection topology of gate-model quantum computers.
This paper is organized as follows. In Section 2, the system model is proposed. In Section 3, Section 4 and Section 5, we give the details of the method. Finally, in Section 6, we conclude the paper. Supplemental information is inlucded in the Appendix.

System Model
The simultaneous physical-layer minimization and the maximization of the objective function are achieved by our Quantum Triple Annealing Minimization (QTAM) algorithm. The QTAM algorithm utilizes the framework of simulated annealing (SA) [24][25][26][27][28][29][30], which is a stochastic point-topoint search method. The procedure of the QTAM algorithm with the objective functions are depicted in Fig. 1. The detailed descriptions of the methods and procedures are included in the next sections.  Figure 1: The QTAM method for quantum computers. The quantum gate (QG) circuit computation model consists of an input array of n quantum states (depicted by the green box), layers of quantum gates integrated into a quantum circuit (depicted by the purple box), and a measurement phase (depicted by the orange box). The quantum gates that act on the quantum states formulate a quantum circuit with a given circuit height and depth. The area of the quantum circuit is minimized by objective function F 1 , while the total quantum wire area of the quantum circuit is minimized by F 2 (F 1 ∧ F 2 is referred via the quantum circuit minimization). The result of the minimization is a quantum circuit of quantum gates with minimized quantum circuit area, minimized total quantum wire length, and a minimized total Hamiltonian operator. The maximization of a corresponding objective function of arbitrary selected computational problems for the quantum computer is achieved by F 3 (referred via the objective function maximization). Objective functions F 4 and F 5 are defined for the minimization of the number of quantum states (minimization of input size), and the total number of measurements (minimization of measurements).

Computational Model
By theory, in an SA-based procedure a current solution s A is moved to a neighbor s B , which yields an acceptance probability [24][25][26][27][28][29][30] Pr (f (s A ) , f (s B )) = 1 where f (s A ) and f (s B ) represent the relative performances of the current and neighbor solutions, while T is a control parameter, T (t) = T max exp (−R (t/k)), where R is the temperature decreasing rate, t is the iteration counter, k is a scaling factor, while T max is an initial temperature. Since SA is a probabilistic procedure it is important to minimize the acceptance probability of unfavorable solutions and avoid getting stuck in a local minima.
Without loss of generality, if T is low, (1) can be rewritten in function of f (s A ) and f (s B ) as In the QTAM algorithm, we take into consideration that the objectives, constraints, and other functions of the method, by some fundamental theory, are characterized by different magnitude ranges [24][25][26][27][28][29][30]. To avoid issues from these differences in the QTAM algorithm we define three annealing temperatures, T f (t) for objectives, T g (t) for constraints and T c (t) for the probability distribution closeness (distance of the output distributions of the reference quantum circuit and the reduced quantum circuit).
In the QTAM algorithm, the acceptance probability of a new solution s B at a current solution s A is as whered (f ),d (g) andd (c) are the average values of objective, constraint and distribution closeness domination, see Algorithm 1.
To aim of the QTAM algorithm is to minimize the cost function where x is the vector of design variables, while α is the vector of weights, while N obj is the number of primarily objectives. Other i secondary objectives (aspect ratio of the quantum circuit, overlaps, total net length, etc.) are minimized simultaneously via the single-objective function F s in (4) as

Objective Functions of QTAM
We defined N obj = 5 objective functions for the QTAM algorithm. Objective functions F 1 and F 2 are defined for minimization of QG quantum circuit in the physical layer. The aim of objective function F 1 is the minimization of the A QG quantum circuit area of the QG quantum gate structure, where H QG is the optimal circuit height of QG, while D QG is the optimal depth of QG.
Focusing on superconducting quantum circuits [1][2][3][4][5], the aim of F 2 is the physical layout minimization of the w QG total quantum wire area of QG, as where h is the number of nets of the QG circuit, p is the number of quantum ports of the QG quantum circuit considered as sources of a condensate wave function amplitude [1][2][3][4][5], and q the number of quantum ports considered as sinks of a condensate wave function amplitude, ij is the length of the quantum wire ij, δ ij is the effective width of the quantum wire ij, while ψ ij is the (root mean square) condensate wave function amplitude [1][2][3][4][5] associated to the quantum wire ij. Objective function F 3 is defined for the maximization of the expected value of an objective function C L ( Φ) as where C is an objective function, Φ is a collection of L parameters such that with L unitary operations, state | Φ is evaluated as where U i is an i-th unitary that depends on a set of parameters Φ i , while |ϕ is an initial state. Thus the goal of F 3 is to determine the L parameters of Φ (see (9)) such that Φ|C| Φ is maximized. Objective functions F 4 and F 5 are defined for the minimization of the number of input quantum states and the number of required measurements. The aim of objective function F 4 is the minimization of the number of quantum systems on the input of the QG circuit, The aim of objective function F 5 is the minimization of the total number of measurements in the M measurement block, where m = N M |M |, where N M is the number of measurement rounds, |M | is the number of measurement gates in the M measurement block.

Constraint Violations
The optimization at several different objective functions results in different Pareto fronts [24][25][26][27] of placements of quantum gates in the physical layout. These Pareto fronts allow us to find feasible tradeoffs between the optimization objectives of the QTAM method. The optimization process includes diverse objective functions, constraints, and optimization criteria to improve the performance of the quantum circuit and to take into consideration the hardware restrictions of quantum computers. In the proposed QTAM algorithm the constraints are endorsed by the modification of the Pareto dominance [24][25][26][27] values by the different sums of constraint violation values. We defined three different constraint violation values.

Distribution Closeness Dominance
In the QTAM algorithm, the Pareto dominance is first modified with the sum of distribution closeness violation values, denoted by c s (·). The aim of this iteration is to support the closeness of output distributions of the reduced quantum circuit QG to the output distribution of the reference quantum circuit QG R . Let P QG R the output distribution after the M measurement phase of the reference (original) quantum circuit QG R to be simulated by QG, and let Q QG be the output distribution of the actual, reduced quantum circuit QG. The distance between the quantum circuit output distributions P QG R and Q QG (distribution closeness) is straightforwardly yielded by the relative entropy function, as For two solutions x and y, the d x,y (c) distribution closeness dominance function is defined as where c s (·) is evaluated for a given solution z as where v c i is an i-th distribution closeness violation value, N v is the number of distribution closeness violation values for a solution z.
In terms of distribution closeness dominance, x dominates y if the following relation holds: thus (16) states that x dominates y if both x and y are unfeasible, and x is closer to feasibility than y, or x is feasible and y is unfeasible.

Constraint Dominance
The second modification of the Pareto dominance is by the sum of constraint violation values, where g s (·) is the sum of all constraint violation values, evaluated for a given solution z as where v g i is an i-th constraint violation value, N g is the number of constraint violation values for a solution z.
Similar to (16) and (17), in terms of constraint dominance, x dominates y if the following relation holds: thus (16) states that x dominates y if both x and y are unfeasible, and x is closer to feasibility than y, or x is feasible and y is unfeasible. By similar assumptions, y dominates x with respect to g s (·) if

Objective Dominance
Let x and y refer to two solutions, then, by theory, the d x,y (f ) objective dominance function is defined as where N obj is the number of objectives (in our setting . . , N obj , and for at least one i the relation f i (x) < f i (y) holds.

Quantum Circuit Design Constraints
Since it is a hard problem to find a single placement solution in the physical layer that satisfies all design constraints, constrained multi-objective optimization methods were proposed to handle the situation. The term proximity group (a group of cells with a symmetry axis and different cell types with varying symmetry requirements) is used in analog floorplan automation [24][25][26][27][28][29][30] to reduce the problem complexity. Taking the Pareto fronts of placements of the proximity groups, a trade-off can be constructed between the optimization objectives. These Pareto fronts also can be combined in a hierarchical way for each proximity group. Further constraints on the condensate wave function amplitude and phase are also taken to improve the quantum circuit's quality and performance.

The QTAM Algorithm
Theorem 1 The QTAM algorithm utilizes annealing temperatures T f (t), T g (t) and T c (t) to evaluate the acceptance probabilities, where T f (t) is the annealing temperature for the objectives, T g (t) is the annealing temperature for the constraints and T c (t) is the annealing temperature for the distribution closeness.
Proof. The detailed description of the QTAM procedure is given in Algorithm 1.
The related steps are detailed in Sub-procedures 1-4.

Computational Complexity of QTAM
Following the complexity analysis of [24][25][26][27], the computational complexity of QTAM is evaluated as where N d is the number of dominance measures, N it is the number of total iterations, |P| is the population size, while N obj is the number of objectives. Therefore, at the objective functions F 1 , . . . , F 5 , the resulting complexity is

Algorithm 1 Quantum Triple Annealing Minimization (QTAM)
Step 1. Define an archive A with random solutions, and select a ξ random solution from A.
whered (f ), is the average objective dominance, evaluated as where d x,y (f ) is the objective dominance function as given in (22), whiled (g) average constraint dominance asd where d x,y (g) is the constraint dominance function as given in (18), andd (c) is average distribution closeness dominance as where d x,y (c) is the distribution closeness dominance function as given in (14), while T f (t) is the annealing temperature for the objectives where R is the temperature decreasing rate, T fmax is a maximum (initial) value for annealing the objectives factor, T g (t) is the annealing temperature for the constraints where T gmax is a maximum (initial) value for annealing the constraint factor, and T c (t) is the annealing temperature for the distribution closeness where T cmax is a maximum (initial) value for annealing the distribution closeness factor, respectively.
points in A, then apply Sub-procedure 2.
Step 4. Apply Steps 2-3, until i < N it , where i is the actual iteration, N it is the total number of iterations.
Step 2. If |A| > A s , where |A| is the number of elements in A, A s is the maximal archive size, then assign ∆ cr (A) to A, where ∆ cr (·) is the crowding distance.
Step 3. Select the best A s elements.
Step 2. Remove all the k dominated points from A.
Sub-procedure 4 Step 1. If D P (ν, A) = A¬∠ν, i.e., ν is non-dominating with respect to A, then set ξ = ν, and add ν to A. If |A| > A s , then assign ∆ cr (A) to A, and select the best A s elements.
Step 2. If D P (ν, (A) k ) = (A) k ∠ν, i.e., ν dominates k points in A, then set ξ = ν, and add ν to A. Remove the k points from A.

Multilayer Quantum Circuit Grid
An i-th quantum gate of QG is denoted by g i , a k-th port of the quantum gate g i is referred to as g i,k . Due to the hardware restrictions of gate-model quantum computer implementations [16][17][18][19], the quantum gates are applied in several rounds. Thus, a multilayer, k-dimensional (for simplicity we assume k = 2), n-sized finite square-lattice grid G k,r QG can be constructed for QG, where r is the number of layers, l z , z = 1, . . . , r . A quantum gate g i in the z-th layer l z is referred to as g lz i , while a k-th port of g lz i is referred to as g lz i,k .

Method
Theorem 2 There exists a method for the parallel optimization of quantum wiring in physicallayout of the quantum circuit and for the maximization of an objective function C α (z).
Proof. The aim of this procedure (Method 1) is to provide a simultaneous physical-layer optimization and Hamiltonian minimization via the minimization of the wiring lengths in the multilayer structure of QG and the maximization of the objective function (see also Section A.1). Formally, the aim of Method 1 is the F 2 ∧ F 3 simultaneous realization of the objective functions F 2 and F 3 . Using the G k,r QG multilayer grid of the QG quantum circuit determined via F 1 and F 2 , the aim of F 3 maximization of the objective function C (z), where z = z 1 . . . z n in an n-length input string, where each z i is associated to an edge of G k,r QG connecting two quantum ports. The objective function C (z) associated to an arbitrary computational problem is defined as where C i,j is the objective function for an edge of G k,r QG that connects quantum ports i and j.
The C * (z) maximization of objective function (38) yields a system state Ψ for the quantum computer [16][17][18][19] as where where where σ x is the Pauli X-operation, µ is a control parameter [16][17][18][19], µ ∈ [0, π] and where d is the dimension of the quantum system, while where γ is a single parameter [16][17][18][19],γ ∈ [0, 2π]. The objective function (38) without loss of generality can be rewritten as where C α each act on a subset of bits, such that C α ∈ {0, 1}. Therefore, there exists a selection of parameters of Φ in (9) such that (44) picks up a maximized value C * (z), which yields system state Υ as Therefore, the resulting Hamiltonian H associated to the system state (45) is minimized via F 2 (see (57)) as since the physical-layer optimization minimizes the ij physical distance between the quantum ports, therefore the energy E L ( Φ) of the Hamiltonian associated to Φ is reduced to a minima. The steps of the method F 2 ∧ F 3 are given in Method 1. The method minimizes the number of quantum wires in the physical-layout of QG, and also achieves the desired system state Ψ of (39).
The steps of Method 1 are illustrated in Fig. 2, using the G k,r QG multilayer topology of the QG quantum gate structure, l i refers to the i-th layer of G k,r QG .

Quantum Circuit Area Minimization
For objective function F 1 , the area minimization of the QG quantum circuit requires the following constraints. Let S v (P i ) be the vertical symmetry axis of a proximity group P i [24][25][26] on QG, and let x Sv(P i ) refer to the x-coordinate of S v (P i ). Then, by some symmetry considerations for x Sv(P i ) , x Sv(P i ) = 1 2

Method 1 Quantum Wiring Optimization and Objective Function Maximization
Step 1. Construct the G k,r QG multilayer grid of the QG quantum circuit, with r layers l 1 , . . . , l r . Determine the objective function, where each C i,j refers to the objective function for an edge in G k,r QG connecting quantum ports i and j, defined as where z i = ±1.
Step 2. Find the optimal assignment of separation point ∆ in G k,r QG = (V, E, f ) at a physical-layer blockage β via a minimum-cost tree in G k,r QG containing at least one port from each quantum gate g i , i = 1, . . . , |V |. For all pairs of quantum gates g i , g j , minimize the f p,c path cost (L1 distance) between a source quantum gate g i and destination quantum gate g j and then maximize the overlapped L1 distance between g i and ∆.
Step 4. Select that k-th solution, for which i,j is the objective function associated to a k-th solution between quantum ports g i,1 , g j,1 , and g i,1 , g j,2 in G k,r QG . The resulting C * α (z) for P 1 and P 2 is as Step 5. Repeat steps 2-4 for all paths of G k,r QG .
where x i is the bottom-left x coordinate of a cell σ i , κ i is the width of σ i , and where y i is the bottom-left y coordinate of a cell σ i , h i is the height of σ i . Let σ 1 , σ 2 be a symmetry pair [24][25][26] that refers to two matched cells placed symmetrically in relation to S v (P i ), with bottom-left coordinates σ 1 , Then, x Sv(P i ) can be rewritten as with the relation y 1 i = y 2 i = y i .

Figure 2:
The aim is to find the optimal wiring in G k,r QG for the QG quantum circuit (minimal path length with maximal overlapped path between g i,1 and g j,1 ,g j,2 ) such that the C α objective function associated to the paths P 1 : g i,1 → g j,1 , and P 2 : g i,1 → g j,2 is maximal. (a): The initial objective function value is C α 0 . A physical-layer blockage β in the quantum circuit allows no to use paths P 1 and P 2 . (b): The wire length is optimized via the selection point ∆. The path cost is f p,c = 11 + 3f l , where f l is the cost function of the path between the layers l 1 and l 2 (depicted by the blue vertical line), the path overlap from g i,1 to ∆ is τ o = 5 + f l . The objective function value is C α 1 . (c): The path cost is f p,c = 10, the path overlap from g i,1 to ∆ is τ o = 4. The objective function value is C α 2 . (d): The path cost is f p,c = 12, the path overlap from g i,1 to ∆ is τ o = 6. The objective function value is C α 3 . The selected connection topology from (b), (c), and (d) is that which yields the maximized objective function C * α .
Let σ S = x S i , y S i be a cell which is placed centered [24][25][26] with respect to S v (P i ). Then, x Sv(P i ) can be evaluated as along with y S i = y i . Note that it is also possible that for some cells in QG there is no symmetry requirements, these cells are denoted by σ 0 . As can be concluded, using objective function F 1 for the physical-layer minimization of QG, a d-dimensional constraint vector x d F 1 can be formulated with the symmetry considerations as follows: where N (σ 1 ,σ 2 ) is the number of σ 1 , σ 2 symmetry pairs, N σ S is the number of σ S -type cells, while N σ 0 is the number of σ 0 -type cells, while r i is the rotation angle of an i-th cell σ i , respectively.

Quantum Wire Area Minimization
Objective function F 2 provides a minimization of the total quantum wire length of the QG circuit. To achieve it we define a procedure that yields the minimized total quantum wire area, w QG , of QG as given by (7). Let δ ij be the effective width of the quantum wire ij in the QG circuit, defined as where ψ ij is the (root mean square) condensate wave function amplitude, J max (T ref ) is the maximum allowed current density at a given reference temperature T ref , while h nom is the nominal layer height. Since drops in the condensate wave function phase ϕ ij are also could present in the QG circuit environment, the δ ij effective width of the quantum wire ij can be rewritten as where χ ϕ ij is a maximally allowed value for the phase drops, ef f is the effective length of the quantum wire, ef f ≤ χ ϕ ij δ ij /ψ ij r 0 (T ref ) , while r 0 (T ref ) is a conductor sheet resistance [1][2][3][4][5].
In a G k,r QG multilayer topological representation of QG, the ij distance between the quantum ports is as where f l is a cost function between the layers of the multilayer structure of QG. During the evaluation, let w QG (k) be the total quantum wire area of a particular net k of the QG circuit, where q quantum ports are considered as sources of condensate wave function amplitudes, while p of QG are sinks, thus (7) can be rewritten as Since ψ ij is proportional to δ ij (ψ ij ), (56) can be simplified as where where ij is given in (54). In all quantum ports of a particular net k of QG, the source quantum ports are denoted by positive sign [24][25][26] in the condensate wave function amplitude, ψ ij assigned to quantum wire ij between quantum ports i and j , while the sink ports are depicted by negative sign in the condensate wave function amplitude, −ψ ij with respect to a quantum wire ij between quantum ports i and j.
Thus the aim of w QG (k) in (55) is to determine a set of port-to-port connections in the QG quantum circuit, such that the number of long connections is reduced in a particular net k of QG as much as possible. The result in (56) is therefore extends these requirements for all nets of QG.

Wave Function Amplitudes
With respect to a particular quantum wire ij between quantum ports i and j of QG, let ψ i→j refer to the condensate wave function amplitude in direction i → j, and let ψ j→i refer to the condensate wave function amplitude in direction j → i in the quantum circuit. Then, the let be φ ij defined for the condensate wave function amplitudes of quantum wire ij as with a residual condensate wave function amplitude where ψ i→j is an actual amplitude in the forward direction i → j. Thus, the maximum amount of condensate wave function amplitude injectable to of quantum wire ij in the forward direction i → j at the presence of ψ i→j is ξ i→j (see (60)). The following relations holds for a backward direction, j → i, for the decrement of a current wave function amplitude ψ i→j as with residual quantum wire length where δ ij is given in (52). By some fundamental assumptions, the N R residual network of QG is therefore a network of the quantum circuit with forward edges for the increment of the wave function amplitude ψ, and backward edges for the decrement of ψ. To avoid the problem of negative wire lengths the Bellman-Ford algorithm [24][25][26] can be utilized in an iterative manner in the residual directed graph of the QG topology.
To find a path between all pairs of quantum gates in the directed graph of the QG quantum circuit, the directed graph has to be strongly connected. The strong-connectivity of the h nets with the parallel minimization of the connections of the QG topology can be achieved by a minimum spanning tree method such as Kruskal's algorithm [24][25][26].

Lemma 1
The objective function F 2 is feasible in a multilayer QG quantum circuit structure.
Proof. The procedure defined for the realization of objective function F 2 on a QG quantum circuit is summarized in Method 2. The proof assumes a superconducting architecture.
The sub-procedures of Method 2 are detailed in Sub-methods 2.1, 2.2 and 2.3. These conclude the proof.

Routing in the Multilayer Structure
The G k,z QG grid consists of all g i quantum gates of QG in a multilayer structure, such that the g lz i,k appropriate ports of the quantum gates are associated via an directed graph G = (V, E, f c ), where V is the set of ports, g lz i,k ⊆ V , E is the set of edges, and f c is a cost function, to achieve the gate-to-gate connectivity.
As a hardware restriction we use a constraint on the quantum gate structure, it is assumed in Sub-method 2. 3 Step 1. For an i-th sn k,i subnet of a net k of the QG quantum circuit, set the quantum wire length to zero, δ ij = 0 between quantum ports i and j, for all ∀i.
Step 2. Determine the L2 (Euclidean) distance between the quantum ports of the subnets sn k,i (from each quantum port of a subnet to each other quantum port of all remaining subnets [24]).
Step 4. Determine the minimum spanning tree T QG via the A K Kruskal algorithm [24].
Step 5. Determine the set S T QG of quantum wires with δ ij > 0 from T QG . Calculate where δ 0 is the minimum width can be manufactured, while δ ij and δ ij are given in (52) and (53).
Step 6. Add the quantum wires of S T QG to the M QG multilayer topological map of the network N of QG.
Step 7. Repeat steps 4-6 for ∀k nets of the QG quantum circuit, until M QG is not strongly connected.
the model that a given quantum system cannot participate in more than one quantum gate at a particular time.
The distance in the rectilinear grid G k,z QG of QG is measured by the d L1 (·) L1-distance function.
The quantum port selection in the G k,r QG multilayer structure of QG, with r layers l z , z = 1, . . . , r, and k = 2 dimension in each layers is illustrated in Fig. 3.

Algorithm
Theorem 3 The Quantum Shortest Path Algorithm finds shortest paths in a multilayer QG quantum circuit structure.
Proof. The steps of the shortest path determination between the ports of the quantum gates in a multilayer structure are included in Algorithm 2.

Complexity Analysis
The complexity analysis of Algorithm 2 is as follows. Since the QSPA algorithm (Algorithm 2) is based on the A * search method [24][25][26], the complexity is trivially yielded by the complexity of the A * search algorithm.

Conclusions
The algorithms and methods presented here provide a framework for automated quantum circuit designs for near term gate-model quantum computers. Since our aim was to define a scheme for Figure 3: The method of port allocation of the quantum gates in the G k,r QG multilayer structure, with r layers l z , z = 1, . . . , r, and k = 2 dimension in each layers. The aim of the multiport selection is to find the shortest path between ports of quantum gates g i (blue rectangle) and g j (green rectangle) in the G 2,r QG multilayer structure. (a): The quantum ports needed to be connected in QG are port g i,1 in quantum gate g i in layer l 1 , and ports g j,1 and g j,2 of quantum gate g j in layer l 3 . (b): Due to a hardware restriction on quantum computers, the quantum gates are applied in several rounds in the different layers of the quantum circuit QG. Quantum gate g j is applied in two rounds in two different layers that is depicted g l 3 j and g l 2 j . For the layer-l 3 quantum gate g l 3 j , the active port is g l 3 j,1 (red), while the other port is not accessible (gray) in l 3 . The g l 3 j,1 port, due to a physical-layer blockage β in the quantum circuit of the above layer l 2 does not allow to minimize the path cost between ports g i,1 and g l 3 j,1 . The target port g l 3 j,1 is therefore referred to as a blocked port (depicted by pink), and a new port of is g l 3 j selected for g l 3 j,1 (new port depicted by red). (c): For the layer-l 2 quantum gate g l 2 j , the active port is g l 2 j,2 (red), while the remaining port is not available (gray) in l 2 . The white dots (vertices) represent auxiliary ports in the grid structure of the quantum circuit. In G 2,r QG , each vertices could have a maximum of 8 neighbors, thus for a given port g j,k of a quantum gate g j , deg (g j,k ) ≤ 8.

Algorithm 2 Quantum Shortest Path Algorithm (QSPA)
Step 1. Create the G k,r QG multilayer structure of QG, with r layers l z , z = 1, . . . , r, and k dimension in each layers. From G k,r QG generate a list L P∈QG of the paths between each start quantum gate port to each end quantum gate port in the G k,r QG structure of QG quantum circuit.
Step 2. Due to the hardware restrictions of quantum computers, add the decomposed quantum gate port information and its layer information to L P∈QG . Add the β physical-layer blockage information to L P∈QG .
Step 3. For a quantum port pair (x, y) ∈ G k,r QG define the f c (x, y) cost function, as where γ (x, y) is the real path size from x to y in the multilayer grid structure G k,r QG of QG, while d L1 (x, y) is the L1 distance in the grid structure as given by (63).
Step 4. Using L P∈QG and cost function f c (x, y), apply the A * parallel search [24][25][26] to determine the lowest cost path P * (x, y).
present and future quantum computers, the developed algorithms and methods were tailored for arbitrary-dimensional quantum systems and arbitrary quantum hardware restrictions. We demonstrated the results through gate-model quantum computer architectures; however, due to the flexibility of the scheme, arbitrary implementations and input constraints can be integrated into the quantum circuit minimization. The objective function that is the subject of the maximization in the method can also be selected arbitrarily. This allows a flexible implementation to solve any computational problem for experimental quantum computers with arbitrary hardware restrictions and development constraints.

A.1 Objective Function Maximization in the Quantum Circuit
The quantum circuit QG executes operations in the H Hilbert space. The dimension of the H space is where d is the dimension of the quantum system (d = 2 for a qubit system), while n is the number of quantum states.
Using the formalism of [16][17][18], let assume that the computational problem fed into the quantum circuit QG is specified by n bits and m constraints. Then, the objective function is defined as is an n-length bitstring, and C α (z) = 1 if z satisfies constraint α, and C α (z) = 0 otherwise [16][17][18].
Assuming a Hilbert space of n qubits, dim (H) = 2 n , using the computational basis vectors |z , operator C (z) in (A.2) is a diagonal operator in the computational basis [16][17][18]. Then, at a particular angle γ, γ ∈ [0, 2π], unitary U (C, γ) is evaluated as such that all terms in the product are diagonal in the computational basis. Then, for the µ dependent product of commuting operators, µ ∈ [0, π] [16][17][18], a unitary U (B, µ) is defined as where σ x is the Pauli X-operation. For a qubit setting, the |s initial state of the quantum computer is the uniform superposition over computational basis states, Let assume that the G k,r QG multilayer structure of the QG quantum circuit contains n quantum ports of several quantum gates, and edge set of size m. Then, the aim of the optimization is to indentify a string z (A.3) that the maximizes the objective function where z i = ±1.
In G k,r QG different unitary operations can be defined for the single quantum ports (qubits) and the connected quantum ports, as follows.
Let U qs (µ j ) be a unitary operator on a q s single port (qubits) in G k,r QG , be defined such that for each quantum ports a µ j parameter is associated as For the collection µ = (µ 1 , . . . , µ n ) , The unitary U qs ( µ) is therefore represents the applications of the unitary operations at once in the quantum ports of the QG quantum circuit.
Then, let unitary U q jk (γ jk ) be defined for connected quantum ports q jk in G k,r QG , as where σ z is the Pauli Z-operation. Since the eigenvalues of X i and Z j Z k are ±1, it allows us to restrict the values [16][17][18] of parameters γ and µ to the range of [0, π].
Then, defining collection γ = (γ 1 jk , . . . , γ h jk ), (A.14) where h is the number of individual γ jk parameters, the unitary U q jk ( γ) is yielded as Assuming that there exists a set S u µ of u collections of µ's S u µ : µ (1) , . . . , µ (u) (A. 16) and a set S u γ of u collections of γ's, S u γ : γ (1) , . . . , γ (u) , (A.17) a |φ system state of the QG quantum circuit is evaluated as where |s is given in (A.6). The maximization of objective function (A.2) in the multilayer G k,r QG structure is therefore analogous to the problem of finding the parameters of sets S u µ (A. 16

A.3 Notations
The notations of the manuscript are summarized in      A k-th port of the quantum gate g i of the quantum circuit.
G k,r QG A multilayer, k-dimensional n-sized finite square-lattice base-graph rectilinear grid, where r is the number of layers, l z , z = 1, . . . , r.
g lz i A quantum gate g i in the z-th layer l z of G k,r QG . g lz i,k A k-th port of g lz i in G k,r QG . C (z) Objective function of a computational problem, z is a bitstring that encodes the state of the quantum circuit.
C i,j Objective function for an edge of G k,r QG that connects quantum ports i and j.  γ Single parameter.
ij Distance between the quantum ports in G k,r QG . E L Φ Energy E L Φ of the Hamiltonian at a system state Φ.
∆ Separation point in G k,r QG of the quantum circuit. β A physical-layer blockage in the actual layer of the quantum circuit.

P
A path between the quantum ports of the quantum circuit.
S v (P i ) A vertical symmetry axis of a proximity group P i on QG.
x Sv(P i ) The x-coordinate of S v (P i ).
σ i A cell in the grid of the quantum circuit.
x i A bottom-left x coordinate of a cell σ i in the grid of the quantum circuit.
κ i Width of a cell σ i in the grid of the quantum circuit. σ 1 , σ 2 Symmetry pair.
x d F 1 A d-dimensional constraint vector with the symmetry considerations.
N (σ 1 ,σ 2 ) Number of σ 1 , σ 2 symmetry pairs in G k,r QG . N σ S Number of σ S -type cells in G k,r QG . N σ 0 Number of σ 0 -type cells in G k,r QG . r i Rotation angle of an i-th cell σ i in G k,r QG . δ ij Effective width of the quantum wire ij in the QG circuit.
J max (T ref ) Maximum allowed current density at a given reference temperature T ref .
h nom A nominal layer height.
δ ij Effective width of the quantum wire ij. χ ϕ ij Maximally allowed value for the phase drops. ij Distance between the quantum ports in G k,r QG , where f l is a cost function between the layers of the multilayer structure of QG.
w QG (k) Total quantum wire area of a particular net k of the QG circuit.

ψ i→j
Condensate wave function amplitude in direction i → j between the quantum ports.
ψ j→i Condensate wave function amplitude in direction j → i between the quantum ports.
ξ j→i Decrement of a current wave function amplitude ψ i→j for a backward direction, j → i,ξ j→i = −ψ i→j .
Γ j→i A residual quantum wire length forξ j→i .  sn k,i An i-th subnet of a net k of the QG quantum circuit.
A BF Bellman-Ford algorithm.
A K Kruskal algorithm.
T QG Minimum spanning tree.
S T QG Set of quantum wires with δ ij > 0.
δ 0 Minimum width can be manufactured physically.
f c (x, y) A cost function, for a quantum port pair (x, y) ∈ G k,r QG , defined as f c (x, y) = γ (x, y)+d L1 (x, y), where γ (x, y) is the real path size from x to y in the multilayer grid structure G k,r QG of QG, while d L1 (x, y) is the L1 distance in the grid structure.
A * A * search algorithm. P * (x, y) A lowest cost path between quantum ports (x, y) ∈ G k,r QG .