A library for implementing Hybrid Quantum Genetic Algorithm (HQGA)
Project description
HQGA
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.''
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
Release history Release notifications | RSS feed
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.2.0.tar.gz
(11.5 kB
view details)
Built Distribution
HQGA-0.2.0-py3-none-any.whl
(12.9 kB
view details)
File details
Details for the file HQGA-0.2.0.tar.gz
.
File metadata
- Download URL: HQGA-0.2.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7b28387b75234284cda7aadaa5cecbae04302772c543cf5a9fa01be709e4b38 |
|
MD5 | cfd4670b7dec2f44e7c81459d7069235 |
|
BLAKE2b-256 | 324336efd6e5b56d1fb61b48fed9d0e9f0963841139243bf5a3da740f92fee4b |
File details
Details for the file HQGA-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: HQGA-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20847e47951e0472ce989dc4a9135292459ddfde2a034b41c8d298e3328cd38b |
|
MD5 | be42c4826326eb3629045068fbac5901 |
|
BLAKE2b-256 | 6f1ca4cfce81277cab6f62a72bcea0fa57d597ec6e6578ee309fdf5528427c4f |