Skip to main content

Genetic Algorithm for VQC ansatz search.

Project description

GA for VQC Ansatz Search

This is a module to support Variational Quantum Circuits by optimizing the ansatz. The ansatz optimization is performed using a Genetic Algorithm, which can be parallelized with GPUs.

For a detailed example of using this package see the https://github.com/tcoulvert/QAE_4_HEP repository.

Installation

Run the following to install:

$ pip install ga-vqc

Contributors

This module was developed through the Caltech SURF program. Special thanks to my mentor at Caltech.

  • Jean-Roch (California Institute of Technology, Pasadena, CA 91125, USA)

Usage

import ga_vqc as gav

## Config (hyperparameters) for GA, see full list in example ##

vqc_main = <'Function that handles running your VQC optimization'>

# Example of allowed optimization gates, see Genepool.py for documentation
gates_dict = {"I": (1, 0), "RX": (1, 1), "CNOT": (2, 0)}
gates_probs = [0.35, 0.35, 0.3]
genepool = gav.Genepool(gates_dict, gates_probs)

vqc_config = {
    'num_qubits': 3,
    'etc': <'whatever config params your VQC model requires'>
}

ga_output_path = FILEPATH_FOR_GA_OUTPUT

config = gav.Config(vqc_main, vqc_config, genepool, ga_output_path)

# Create the GA with the given hyperparameters
ga = gav.setup(config)

# Evolve the GA and search for the best ansatz
ga.evolve()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ga_vqc-1.0.6.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ga_vqc-1.0.6-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file ga_vqc-1.0.6.tar.gz.

File metadata

  • Download URL: ga_vqc-1.0.6.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for ga_vqc-1.0.6.tar.gz
Algorithm Hash digest
SHA256 c996a6f459d4715697b0e0899abf66f66a419edd7acec4224ba19a15484d8fe7
MD5 7b2661582864c9c7f0694648e4089768
BLAKE2b-256 5637597666e121766a604fee8b523ef674520a5e3ec38f505c074ca356d141c9

See more details on using hashes here.

File details

Details for the file ga_vqc-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: ga_vqc-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for ga_vqc-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 400e4ffa9cbd16d61318b985f91aae6fc270833e05cbba49764005570448fc3f
MD5 541c8aaec5b286c8d942d095315fc78f
BLAKE2b-256 7f95d2a7314a73a1041aebf18ca29d4d336e45ae022ff7b2f32fadc8c8733781

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page