Skip to main content

A library for implementing Hybrid Quantum Genetic Algorithm (HQGA)

Project description

HQGA Made at Quasar! Made at Quasar! Made at Quasar!

This repo contains the code for executing Hybrid Quantum Genetic Algorithm (HQGA) proposed in:

''G. Acampora and A. Vitiello, "Implementing evolutionary optimization on actual quantum processors," in Information Sciences, 2021, doi: 10.1016/j.ins.2021.06.049.''

How to install

The package can be installed with Python's pip package manager.

pip install HQGA

Example

This is a basic example to use HQGA for solving Sphere problem on Qasm Simulator.

from HQGA import problems as p, hqga_utils, utils, hqga_algorithm
from HQGA.utils import computeHammingDistance

from qiskit import Aer
import math

simulator = Aer.get_backend('qasm_simulator')
device_features= hqga_utils.device(simulator, False)

params= hqga_utils.ReinforcementParameters(3, 5, math.pi / 16, math.pi / 16, 0.3)
params.draw_circuit=True

problem = p.SphereProblem(num_bit_code=5)

circuit = hqga_utils.setupCircuit(params.pop_size, problem.dim * problem.num_bit_code)

gBest, chromosome_evolution,bests = hqga_algorithm.runQGA(device_features, circuit, params,problem)

dist=computeHammingDistance(gBest.chr, problem)
print("The Hamming distance to the optimum value is: ", dist)
utils.writeBestsXls("Bests.xlsx", bests)
utils.writeChromosomeEvolutionXls("ChromosomeEvolution.xlsx", chromosome_evolution)

Credits

Please cite the work using the following Bibtex entry:

@article{ACAMPORA2021542,
title = {Implementing evolutionary optimization on actual quantum processors},
journal = {Information Sciences},
volume = {575},
pages = {542-562},
year = {2021},
issn = {0020-0255},
doi = {https://doi.org/10.1016/j.ins.2021.06.049},
url = {https://www.sciencedirect.com/science/article/pii/S002002552100640X},
author = {Giovanni Acampora and Autilia Vitiello}
}

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

hqga-0.3.3.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

HQGA-0.3.3-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file hqga-0.3.3.tar.gz.

File metadata

  • Download URL: hqga-0.3.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hqga-0.3.3.tar.gz
Algorithm Hash digest
SHA256 b91d623cbf51d3b37c9ddf552d3bdd5d0088ff1bca8e2f1d4129fb9cd17eb7a0
MD5 765a836e882e781540b7c0961ba5df4b
BLAKE2b-256 d8b246653158c80e1324b0b6807eba5a7e6ccd60eaffedd1c68eb5b5ec5f3b57

See more details on using hashes here.

File details

Details for the file HQGA-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: HQGA-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for HQGA-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5c47a9d989c9a73fd416208965a091d0bc4cd18dd63d5cb35bdb992248583fcf
MD5 c3cb60f4743d5fd913d9b9573707b179
BLAKE2b-256 663bd973557fb8e3cd64a4b028fd024540bc9b918eca1d7a91fa40748bcdc960

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