Introduction

In the field of computation, Quantum computing is a novel subject with a high capacity to perform classical computing more efficiently [1]. The theory of quantum computing was first introduced by researchers in the 1980s. So far, this theory has been vastly applied. Compared to classical algorithms, the theory of quantum computing has presented new algorithms for computer science to accelerate problem solving [2, 3]. Undoubtedly, using quantum computation is necessary because it uses fundamental techniques to solve classical problems, such as encryption and optimization. Nevertheless, there are significant new trends and approaches into quantum computability system [4], quantum algorithms [5], quantum communication protocols [6], and quantum mechanics [7], particularly with the advent of quantum information theory [1].

When the number of qubits increases, protecting them from interacting with environment, and consequently decoherence becomes rapidly uncontrollable [8]. Therefore, a distributed quantum circuit (DQC) could be a suitable solution to build a set of finite subsystems interconnecting with each other through a teleportation system.

Distributed quantum computation is related to computer science. In a distributed quantum computer, each subsystem sends its qubit to another subsystem through teleportation in which qubits are teleported from a subsystem (node) to another subsystem (node). Moreover, a distributed quantum circuit is a model in which each subsystem has limited number of qubits.

Moreover, teleportation is a process for communication between subsystems of a DQC. It is known as the basis of quantum information theory. The term teleportation shows images from disappearing qubit at one location before reappearing at another. On this account, we used a teleportation system for transferring qubits between subsystems in DQC. A DQC is a circuit model in which each subsystem includes a number of qubits. In this study, we intended to survey the performance of a DQC to optimize the number of teleportations of the DQC. To this end, we proposed a new method in which the equivalent circuits were first replaced in the initial quantum circuit to reduce its gates. Then, the number of teleportations between the subsystems was optimized in the generated quantum circuit. To do so, we used teleportation, the basis of quantum information theory, for transferring qubits between subsystems in the DQCs. In this work, quantum circuits, as a Benchmark, were selected from RevLib website for optimization process [9]. In all the circuits, we focused on the number of teleportations to optimize the DQC to be implemented more effectively.

In section 2, we explain some basic concepts of quantum computation. Related work is given in Section 3. Section 4 presents the definitions required for a DQC. Our proposed approach and results of simulation are discussed in Section 5 and section 6, respectively. Finally, we conclude the paper in section 7.

Background

Quantum computation is a new computational field in which qubit is the basic unit of information. Qubit is shown as a unit vector in a Hilbert space denoted as;

$$ \left|\left.\phi \right\rangle =\upalpha \left|0\right\rangle \right.+\upbeta \left|1\right\rangle $$
(1)

where |0⟩ and |1⟩ are the basis of space and α as well as β are complex numbers establishing |α|2 + |β|2 = 1.

Furthermore, quantum computing is well-characterized by the superposition principle, which could in turn produce entangled states. The superposition principles have played an essential role in the development of quantum theory since the famous dilemma of Einstein, Podolsky, and Rosen (EPR) was introduced [10]. According to quantum information theory, entanglement is viewed as a resource to be exploited. If a quantum system is composed of two elements in the Hilbert space, all the system is placed in a Hilbert space,H = H1 ⊗ H2,shown as the below vector;

$$ \left|\psi \right\rangle =\sum \limits_{i,j}{d}_{i,j}\left|{e}_{1,i}\right\rangle \left|{e}_{2,j}\right\rangle $$
(2)

where {|ea, i⟩} is considered as basis in Hilbert space and \( \sum \limits_{i,j}{d}_{i,j}=1 \). State of |ψ⟩ ∈ H is represented as a tensor product of two vectors, |ψ1⟩ ⊗ |ψ2⟩, which is called a separable state. Contrarily, those states, which cannot be written separately, are entangled in quantum information. In this paper, qubits were assumed to transfer between subsystems through teleportation. In teleportation, the basic process is to transmit a quantum state of qubit so that the destination receives the same state as the initial qubit state. Therefore, the initial state is removed so that quantum teleportation matches with the no-cloning theorem [11]. Moreover, the aim of quantum teleportation is to transfer a quantum state of qubit using two classical bits in a way that the receiver generates the same state as the initial qubit state. For example, Alice has a qubit, whose state is unknown to her. She likes to send Bob the quantum state of an unknown qubit by classical cannel. To do so, first, she considers the state of qubit as below;

$$ \left|\phi \right\rangle =\alpha \left|0\right\rangle +\beta \left|1\right\rangle $$
(3)

Next, Alice and Bob receive one of the qubits in the entangled state (|ϕ+⟩).

$$ \left|{\phi}^{+}\right\rangle =\frac{1}{\sqrt{2}}\left(\left|\left.00\right\rangle +\left|11\right\rangle \right.\right) $$
(4)

Then, Alice begins the process with

$$ \left|\left.\phi \right\rangle \otimes \left|\left.{\phi}^{+}\right\rangle =\right.\right.\frac{1}{\sqrt{2}}\left(\alpha \left|000\right\rangle +\alpha \left|011\right\rangle +\beta \left|100\right\rangle +\beta \left|111\right\rangle \right) $$
(5)

Afterwards, she applies CNOT ⊗ I followed by H ⊗ I ⊗ I to Eq. (5), this results in

$$ {\displaystyle \begin{array}{c}\left(H\otimes I\otimes I\right)\left( CNOT\otimes I\right)\left(\left|\left.\phi \right\rangle \otimes \left|{\phi}^{+}\right\rangle \right.\right)=\\ {}\frac{1}{2}\left[\left|00\right\rangle \left(\upalpha \left|0\right\rangle +\upbeta \left|1\right\rangle \right)+\left|01\right\rangle \left(\upalpha \left|1\right\rangle +\upbeta \left|0\right\rangle \right)+\left|10\right\rangle \left(\upalpha \left|0\right\rangle -\upbeta \left|1\right\rangle \right)+\left|11\right\rangle \left(\upalpha \left|1\right\rangle -\upbeta \left|0\right\rangle \right)\right]\end{array}} $$
(6)

If Alice measures the two qubits in her hand, she will attain one of the states {|00⟩, |01⟩, |10⟩, |11⟩} with an equal probability of 0.25. Relying on Alice’s measurement (|00⟩, |01⟩, |10⟩, and|11⟩), Bob’s qubit could occur in the following four states;α|0⟩ + β|1⟩, α|1⟩ + β|0⟩, α|0⟩ − β|1⟩, and α|0⟩ + β|1⟩, respectively. Moreover,by using two classical bits, Alice sends Bob the result of her measurement. Ultimately, after receiving the bits, Bob can determine the state of his qubit to generate the initial quantum state by applying I, X, Z, and Y, if the classical bits are 00, 01, 10, and 11 respectively. Figure 1 shows the quantum circuit of qubit teleportation [12].

Fig. 1
figure 1

Quantum teleportation circuit [12]

The Related Work

In this section, studies conducted on distributed quantum circuits are reviewed. Grover [13], Cleve and Buhrman [14], and Cirac et al. [15] were the pioneers of distributed quantum computing pattern. Grover presented a distributed quantum system in which particles are far from each other and each particle completes its computation. In this system, information is transferred between the particles if needed. He also reported that the total time required for computation is equivalent to the number of distributed particles. Beals et al. also stated that a DQC can be constructed with subsystems communicating by applying the hypercube graph [16].

Moreover, Yepez [17] considered two kinds of communications for distributed quantum computing, called Type I and Type II. In type I computer, subsystems communicate through the quantum channel, while in type II computer, the distributed computer subsystems communicate through classical channel. Furthermore, unlike type I quantum computers in which all qubits can be related to each other, in a type II quantum computer, communications between subsystems are performed through classical channels because of the quantum system with limited capacity. On the other hand, Streltsov et al. [18] presented the best way for distributing entanglement with the lowest communication cost for transferring remote particles between subsystems. They also demonstrated that the total entanglement between two particles shouldn’t exceed the total quantum communication needed for each particle to move between two subsystems.

Additionally, Ying and Feng [19] tried to definite the distributed quantum system as an algebraic language. They also introduced some formulas for distributed quantum computing.

Also, in [20], to partition a quantum circuit, the graph-partitioning approach was performed. They showed the quantum circuit as a hypergraph model. They eventually applied the hypergraph partitioning model for partitioning several quantum circuits.

Further, Zomorodi Moghadam et al. [21] provided a process for optimizing the teleportation cost of DQCs in terms of number of teleportations. They argued that DQCs are the appropriate solution for an extensive system and proposed an algorithm to optimize the number of teleportations in a DQC consisting of two subsystems. In the end, they showed the final configuration of DQC with the minimum number of teleportation. In fact, Zomorodi Moghadam’s et al. presented an algorithm to optimize the number of teleportations required for two subsystems.

Moreover, in [22], a genetic algorithm was presented to optimize DQCs more efficiently. The results were compared with [21] and it was found the presented approach had executed the genetic algorithm on DQCs with high speed.

Van meter et al. [23] also presented a model of DQC. Indeed, they performed a Verdral, Barenco, and Ekert’s (VBE) adder on two distributed nodes. Finally, they examined the communication between nodes executed using teleportation.

In [24], Shor’s algorithm was implemented in a DQC executing the non-local gates. In this paper, each node kept n/4 qubits due to the overflow of the previous node. This overflow is teleported to the next node. The number of quantum teleportations for this DQC was finally counted according to the overhead.

In [25], the authors reviewed the search techniques derived by biological evolution that evolved quantum circuits. They argued subjects in showing quantum artefacts in a desirable form for evolutionary search. Some quantum artefacts have been found by evolutionary search in this study.

The paper [26] presented new results in the field of genetic programming that can be used to evolve quantum circuits. They introduced their techniques and showed a set of functions to evolve quantum algorithms.

The best quantum circuit was presented by using genetic programming for a given quantum algorithm in [27]. Design of evolutionary quantum circuits have been surveyed in this paper for different strategies.

Problem Definition

A distributed quantum circuit (DQC) includes N number of remote quantum circuits all of which consist of a DQC. In a DQC, qubits are transferred between the subsystems by teleportation. In each subsystem, qubits are labeled from top to bottom line so that for example, the ith line corresponds to the ith qubit. In the present work, we defined two kinds of quantum gates in a DQC as below:

A Local Gate

Its control and target line are in the same subsystem working on the local qubit. Each subsystem may possess a finite number of local gates. Local operations are performed on qubits of their own subsystem.

A Global Gate

Its control and target line are in distinct subsystems. For executing a global gate in a DQC, a qubit should be teleported to another subsystem returned to the home subsystem.

Moreover, in a DQC, when a qubit is sent into another subsystem, it doesn’t execute in its initial subsystem anymore. To accomplish local gates, a qubit should be returned to its initial subsystem, whilst to execute global CNOT gates, qubits should be executed in the same subsystem. Quantum teleportation is a good solution for transferring qubits between a DQC partitions. Suppose that there is a two-partition system with subsystem A and B. In this system, there are two ways for performing any global gate. The qubit in subsystem A is transferred to subsystem B through teleportation to perform the global gate in Partition B. It is also true the other way around, meaning that single-qubit and local CNOT gates should be executed in their local subsystems.

Although at the first glance, DQCs are similar to quantum circuits (QCs), the problem with a DQC is essentially different from that of a QC. In a DQC, the optimization process is focused on reducing the number of both global gates and teleportations, thereby minimizing the teleportation cost (TC).

In the current study, to optimize a DQC, an approach was proposed based on optimization so that we tried to find a desirable DQC with reduced teleportation costs. Our proposed approach reduced the global gates in each configuration of quantum circuit, where global gates had a certain position between partitions of each configuration. Ultimately, teleportation cost was optimized for all of the DQC configurations.

We also strived to begin with an initial quantum circuit such as basic gates (i.e., CNOT and single-qubit gates). It is also noteworthy that quantum gates with multiple qubits can be decomposed to the basic gates [28, 29].

Mathematical Model

Genetic Algorithms have been introduced as evolutionary computational model. It is used to find optimal solutions to difficult problems. The partitioning of qubits is an NP-hard problem, which can be solved by non-deterministic algorithms. Such algorithms are commonly applied to generate the converged solutions by recombination, mutation, and producing new generations. In this paper, we introduced the cost function of MINTELEP that gives the number of teleportation between the partitions in a DQC. Through a mathematical model, a distributed quantum circuit was tried to be partitioned with a minimum number of teleportation cost by using evolutionary algorithm. To this end, the following labeling was presented to indicate the way in which the proposed method was used in the evolutionary algorithm model. In this labeling, a chromosome, whose elements represent the partition placement, is defined as follows. In the below chromosome, the quantum circuit is partitioned at below points (Fig. 2):

Fig. 2
figure 2

The representation of chromosome

Therefore, to determine the cost of quantum teleportation in the distributed quantum circuit, quantum circuit is first randomly divided into a number of partitions at the points in the considered chromosome. Then, the teleportation cost of distributed quantum circuit is calculated when qubit (qi) in the partition (pi) communicated with the qubit (qj) in the partition (pj) by global gates. The partitions are changed by using genetic algorithm until the lowest quantum teleportation cost is achieved.

For example, after partitioning, qubits are placed in their partitions as shown in Fig. 3:

Fig. 3
figure 3

The placement of qubits after partitioning

Therefore, the MINTELEP cost function for the required number of teleportations between partitions for a chromosome can be shown as follows:

$$ MINTELEP={\sum}_{i=1,2,\dots, n-1}{\sum}_{j=i,i+1,\dots, n}{A}_{i,j}\cdot comp\left({q}_i,{q}_j\right) $$
(7)

Also, the fitness function of each chromosome can be determined as follows:

$$ Fitneess\ Function=\frac{1}{1+ MINTELEP} $$
(8)

The cost function used in this study was calculated based on the following assumption.

  • The number of qubits in the distributed quantum circuit include {1,...,n}.

  • The relationship between the qubits in the distributed quantum circuit can be indicated as below (Table 1):

Table 1 Variable of cost function and its definition
  • The comp function is used to consider the placement of qubits in different partitions so that (Table 2):

Table 2 Variable of cost function and its definition

For example, in the following figure (Fig. 4):

Fig. 4
figure 4

A sample of distributed quantum circuit

$$ comp\left({q}_1,{q}_4\right)\& comp\ \left({q}_2,{q}_4\right)=1 $$

Moreover, according to the figure we have:

$$ \left({q}_1,{q}_4\right)=\left({q}_2,{q}_4\right)=1 $$

Now, if the distributed quantum circuit is divided into two partitions, the cost of quantum teleportation can be calculated for qubits in two partitions. In the above figure, the cost of quantum teleportation is equal to two.

Therefore, in the case of the proposed method, if the qi qubit of pi partition communicates with qubits of pj partition by the CNOT global gate, the cost of quantum teleportation would be minimized, provided that the least teleportation between the subsystems is established. Hence, the cost of quantum teleportation can be reduced by changing the partitions with the help of genetic algorithm.

In a genetic algorithm, a population of selected solutions (individuals) is always being evolved to attain an optimized solution. Each chromosome represents a set of properties which can be mutated and replaced. A genetic algorithm is also an iterative process with a generation (a population in each iteration). In each generation, the fitness function of selected solutions in the population is computed.

The best individuals are selected from the current population and genes of each chromosome are modified to form a new generation so that each chromosome genes are recombined and possibly randomly mutated. Moreover, the crossover of two parents reproduces two new offspring randomly by swapping genes of the chromosomes. It starts by randomly selecting and dividing two parent solutions. Then, crossover produces two solutions by moving parts of the parents with each other.

In this paper, we applied two-point crossover to randomly cut each of the selected parents from the determined points and form a chromosome by recombining them. Crossover is applied to chromosomes in GA randomly with a high probability-pc. The crossover procedure used in this paper is shown in Fig. 5a.

Fig. 5
figure 5

Representation of a Cross over b Mutation

On the other hand, the mutation is implemented by flipping the chosen genes of a chromosome to generate new solutions. Furthermore, mutation, which is used to cause diversity in the genetic algorithm, is usually applied with a low probability-pm. Additionally, the more the possibility of mutation, the less the random search in the genetic algorism. In this paper, the mutation picked one or more partitions randomly and replaced them with other ones depending on the probability of mutation. The mutation procedure is presented in Fig. 5b.

By using roulette wheel selection strategy, the individual with a better condition will have been selected as a parent.

In the next iteration of the genetic algorithm, the possible solutions were used for a new generation. For producing the new generation, the fitness function of new individual was compared with previous chromosomes attained from crossover-mutation-replacement and new generation was formed by replacing the worst chromosome with the better one in the population. Finally, the algorithm terminated when either number of generations exceeded a maximum acceptable number or fitness function was attained for the population [30].

In this replacement, namely elitism a number of best chromosomes passed to the next generation unchanged to take the place of the worst ones, meaning that the quality of solution obtained by the GA does not decrease from one generation to the next (Fig. 6).

Fig. 6
figure 6

The flowchart of the proposed method

The Proposed Approach

In this section, we explain our proposed approach and its implementation. First, we described the equivalent circuits performing the optimization step in all configurations of the proposed approach. Next, the qubits were partitioned by using a genetic algorithm to generate the DQC. In this regard, first, we sequentially applied the considered equivalent quantum circuits so that each equivalent circuit could be iterated for infinite times and applied to any set of initial quantum circuit. An equivalent circuit is defined as a set of elementary gates and qubits.

In this study, we proposed to replace the equivalent circuits with a given initial quantum circuit. These equivalent circuits were kept replacing until optimization was attained. The optimization process depended on the number of equivalent circuits described in the following figures. Finally, we managed to reduce the number of global gates by carefully replacing the equivalent circuits in the initial quantum circuit.

To verify the superiority of our approach to the previous ones, we assessed the proposed approach in several types of DQCs. In all cases, we focused on equivalent circuits to become useful in DQC. After partitioning the quantum circuit by genetic algorithm, we calculated the number of teleportations to show that they had been remarkably reduced.

Furthermore, to optimize the Hadamard gates, we used the equivalent circuits shown in Fig. 7 to make CNOT gates move towards each other because when CNOT gates are near each other, they could be easily canceled.

Fig. 7
figure 7

Hadamard gate reduction

The possibility of CNOT to commute with other CNOT gates can reduce the number of global CNOT gates. These commutations can especially optimize the number of CNOT gates in DQC that in turn leads to the reduction of global gates.

As shown by patterns in Fig. 8, CNOT can commute through a set of equivalent circuits. After replacing the equivalent circuits in the initial QC, we portioned the new QC by using a genetic algorithm. Finally, we calculated the teleportation cost in the DQC. This novel approach led to an optimized teleportation cost in the DQC.

Fig. 8
figure 8

CNOT gate permutation

The proposed algorithm was first presented with nt = 0. We used nt to calculate the number of teleportations in a DQC. The set of equivalent circuit, Ce, was also used in the optimization process for replacing the equivalent circuits. Moreover, the initial quantum circuit was stored in the QC. For each i, a numerator responsible to replace each equivalent quantum circuit in the initial QC in every calculation), the equivalent circuit was replaced. The proposed approach for optimization considered equivalent circuits corresponding to the number of their lines since all the equivalent circuits were considered with i number of lines beginning from i = 2. Also, the equivalent circuits overlapped with similar ones across the initial circuit until the optimization was completed. After setting i = 2, i was increased until all the equivalent circuits were replaced in the initial quantum circuit through running the proposed optimization process to reduce the number of global gates.

Moreover, the pseudo code started from the first set of equivalent circuit. The whole initial quantum circuit was also traced to make sure that all the equivalent circuits have been replaced.

After replacing the equivalent circuits in the quantum circuit, the quantum circuit was partitioned by a genetic algorithm in the following way;

The equivalent circuits were first replaced in the initial quantum circuit. Next, the new quantum circuit (NEWQC) was partitioned by genetic algorithm to generate N subsystems. The subsystems were composed of a number of qubits. Then, the number of qubits in each subsystem was balanced assuming that all of the subsystems in DQC had almost equal number of qubits. So, the proposed approach reduced global CNOT gates and optimized the teleportation cost in DQC.

figure a

Results and Discussion

In this paper, we implemented a new approach to optimize the number of teleportations in DQCs. The proposed approach resulted in reduced number of teleportations. We also found that optimization of DQCs can be applied in different quantum circuits. As a benchmark, we used RevLib website [9].

In quantum computing, evolutionary algorithms have been perfectly used and also on distributed quantum computing is surveyed. A genetic algorithm is a search-based algorithm that performs processes such as mutation, crossover, and the fitness function for optimization of a given problem. Possible solutions carry out the mutation and replacement for the optimization problem that help to reproduce new generations and the fitness function assigns the output of the solutions.

In [22], the authors proposed an approach based on genetic algorithms through which they tried to find a configuration of global gates for two subsystems with an optimized teleportation cost. In this paper, partitioning of qubits was applied by a genetic algorithm to optimize teleportation cost after replacing the equivalent circuits in the initial quantum circuit.

The proposed approach was tested to show the results on some circuits (Tables 3, 4, and 5). To achieve this goal, we presented an approach in which the equivalent circuits were first replaced in the initial quantum circuit, and then the teleportation cost was optimized by using a genetic algorithm, which partitioned the placement of qubits. We compared the result of our proposed approach with [22]. We performed the GA over different quantum circuits to show the performance of our proposed approach that partitioned quantum circuits to N subsystems and found the minimum number of teleportations.

Table 3 Result of partitioning 4gt5–76 circuit
Table 4 Result of partitioning sym9 circuit
Table 5 Result of partitioning rd73 circuit

Table 5 compares the results of our algorithm on DQCs with [22] and other quantum circuits in terms of the teleportation cost (TC).

We also implemented our proposed approach in MATLAB software on an Intel Celeron Dual Core 3 GHz with 2 GB of main memory to find an optimized number of teleportations in several DQCs. In this paper, the GA parameters had an important role in converging GA in much less time (Table 6).

Table 6 GA parameters

As seen in the table of results (Tables 3, 4, and 5), more partitions have increased the cost of teleportation. So, the number of partitions should not exceed a certain number to avoid higher cost function.

Moreover, we adjusted the GA parameters used in the DQCs related problems by performing different simulations and analyzing the results so that these parameters could be set in the best condition to produce better solutions. Besides, no termination condition was considered in the proposed algorithm; however, if no improvement was seen in the cost function for 100 iterations, GA would stop.

The obtained results show that GA can converge to a desire optimization. The probability of mutation should be set low to acquire the best solutions by using a genetic algorithm. In addition, based on the results, the proposed approach, compared to approach in [22], reduced the teleportation cost by approximately 40% (Table 7).

Table 7 Comparison the results with [22] in the term of teleportation cost (TC)

Conclusion

This paper proposed an approach based on the genetic algorithm to optimize distributed quantum circuits (DQCs) with a considered configuration of qubits. First, we tried to replace the equivalent circuits in the initial quantum circuit. Then, we partitioned the quantum circuit into N subsystems to optimize the number of teleportation by using a genetic algorithm. The obtained results showed that the proposed approach was executed in much less time and optimized the teleportation costs. Moreover, results also showed that GA could perfectly reduce teleportation cost; therefore, the application of GA as a useful tool for optimization was proved.