Skip to main content

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}
}

Metadata

Release files for HQGA 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for HQGA 0.4.0
File Size Uploaded Provenance Actions
hqga-0.4.0.tar.gz 12.2 kB Without provenance Details for hqga-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for HQGA 0.4.0
File Interpreter ABI Platform Actions
hqga-0.4.0-py3-none-any.whl Python 3 none any Details for hqga-0.4.0-py3-none-any.whl

Total release size: 25.5 kB

Release files / hqga-0.4.0.tar.gz

Download URL hqga-0.4.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bf2c1104aea167d33b2ae5d5dd74db709b97e46dd1e4fa576cea25f7d6e14003
BLAKE2b-256 checksum
How to use checksums
6f32237709a064c6701af7077966cd715bec11495575a927210c02966e5c2e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hqga-0.4.0-py3-none-any.whl

Download URL hqga-0.4.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2af09928648c274f92913d11f2b95c0785a847644f3fcacb5a1f2bb481b229c
BLAKE2b-256 checksum
How to use checksums
981e792dca4ac5a27a62b4cd7b179aa2ef7ba72951268e11725d7b9a00b83f30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for HQGA 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page