Skip to content

conniepaula/Evolving_Quantum_Circuits

 
 

Repository files navigation

Evolving Quantum Circuits

🚧 READ ME UNDER CONSTRUCTION 🚧


Logo

🧬 Application of genetic algorithm to quantum computing 🧬

Summary

About

This repository stores the scripts made to explore genetic algorithms (GA) as a tool to evolve quantum circuits. GA mimic the evolutionary process of natural selection displayed by nature to solve optimization problems.

For a project for my master's degree in Physics, I raised the question of whether genetic algorithms have the potential to solve problems in the context of quantum computing, where human intuition decreases as physical systems grow. Specifically, we focused on the evolution of quantum error-correcting codes (QECCs) within the stabilizer code formalism. By specifying an appropriate fitness function, we showed that we could evolve celebrated codes, such as the Perfect, Color, and Shor's code with respectively 5, 7, and 9 qubits, in addition to new unanticipated examples. Additionally, we compared it with a brute force random search and verified the supremacy of GA over it. Given the results, we foresee that genetic algorithms can become valuable tools to perform complex applications in quantum systems and produce tailored circuits that satisfy restrictions imposed by hardware.

This readme brings a brief starter guide of utilizing the scripts contained in the repository. For a more in-depth explanation, please refer to the dissertation. Feel free to contact me via e-mail; I will gladly answer your questions.

Publications

🚧 Soon links to the dissertation and the article. 🚧

Requirements

  • Python
  • numpy
  • qiskit
  • itertools
  • networkx
  • basic knowledge of quantum computation, stabilizer formalism and quantum error correction codes

This code is Python 2 compatible.

Tutorial

This is a brief tutorial on using the scripts of this repository to run an evolutionary search for QECCs. The algorithm observes the following flux:

🧬 Decision tree of the genetic algorithm. 🧬

Script-wise, the main.py script coordinates all the steps while the four auxiliary scripts (terminating with "_functions.py") contain the proper functions employed in each step. Thus, we focus here on how to use the main.py script.

There are eleven parameters to be set at the beginning:

  1. M - initial population size
  2. N - number of qubits
  3. T - N*T gates will be draw for random individuals
  4. adj_mat - adjacency matrix of the lattice of qubits
  5. mutation_density - probability density of times mutations are applied
  6. progenitors - number of progenitors to breed
  7. death_rate - percentage of population that is replaced by a new random set of individuals
  8. population_surplus - when the size of population is Mpopulation_surplus, it is reduced to M(1-death_rate) (keeping the best individuals) and Mdeath_rate are added
  9. acq_time - at multiples of acq_time data is recorded and the mutation/crossover rates are updated
  10. max_generations - maximum number of generations
  11. max_fitness_target - if the a circuit have fitness equal to max_fitness_target the simulation ends

List of functions

According to my classification, all functions are sorted into four different scripts for better organization. The following sub-sections are a comprehensive list of the functions with a brief description of their functionalities.

Stabilizer functions


randcirc

randcirc(N,T,adj_mat)

Input: a) N , number of qubits; b) T , number of gates per qubit; c) adj_mat , adjacency matrix of the lattice.

Output: a) circuit , a random Clifford circuit array.

Description: This function generates a random Clifford circuit over N qubits. CNOT gates satisfies the neighbour structure imposed by the adjacency matrix adj_mat. In T loops, a random Clifford gate (I, H, P, CNOT) is selected for each qubit in the crescent order of indexes, thus the final circuit has NT gates.


gene_express

gene_express(N,circ)

Input: a) N , number of qubits; b) circ , Clifford circuit array.

Output: a) circuit , qiskit QuantumCircuit object.

Description: This function translates a Clifford circuit array into its qiskit equivalent QuantumCircuit object.


final_state

final_state(N,circ)

Input: a) N , number of qubits; b) circ , Clifford circuit array.

Output: a) out_state , qiskit result state vector.

Description: This function returns the output state of the computation of the Clifford circuit circ to the initial state |0>^N.


Evolution functions

QECC functions

Utility functions

Author

Daniel Ribas Tandeitnik
Physicist and production engineer.

Feel free to get in touch with me.

Linkedin Badge Gmail Badge

About

Application of genetic algorithms to quantum computing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%