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 sped up with GPUs.

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-0.5.2.tar.gz (13.8 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-0.5.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ga_vqc-0.5.2.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/6.6.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for ga_vqc-0.5.2.tar.gz
Algorithm Hash digest
SHA256 f33d2cfb5a2dc68d0a708204eab2dbf643bb5cb7e31c7865d7fecbc21543925a
MD5 1cd663f35e0e3340a481e7d40bec01a2
BLAKE2b-256 fea8e3ace53a86c885185055dacaedbd5eac616a97789102ea705cce1f45c2ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ga_vqc-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/6.6.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.6

File hashes

Hashes for ga_vqc-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbaf2782e36306bdaabf1c631f3568e45aa2ba718ee85cb367276abd735754d8
MD5 08c72a1190127fa99d2264f36fe93f1e
BLAKE2b-256 f01c821102ca63ca1c390f50db62e52c136c778e1e57c7d6a65418de703aa9a2

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