Find the best ansatz for ground state energy using genetic algorithm. Able to run on any Qiskit V1 fake device with and without noise. Capable to search bigger hibert space compared to original implemention on the paper. Tested up to 12 qubits Hamiltonian run on the 16 qubits device.
-
install below packages
sudo apt install cmake sudo apt-get install libopenblas-dev
-
create python 3.11 environment
-
pip install -r requirements.txt
-
add your problem in the directory
hamiltonian/<new problem>.py
-
add your problem config file in the directory
conf/search/<new problem>.yaml
-
edit
config.yaml
file, change thesearch
value based on your problem -
run the search by
python main.py
-
output are stored at
outputs/<date>/<time>/*
circuit_selected.qpy
Ansatz found is stored in Qiskit binary serializer formatnas_result_sorted.txt
Best result is on the top, sorted in the format[subnet] (score, electric ground state value)
param_selected.txt
best parameters found
```
from qiskit import qpy
ansatz_custom = qpy.load(open(os.path.join('<path>/circuit_selected.qpy'), 'rb'))[0]
```
-
hamiltonian qubits < device qubits
supported,transpile_q_layout
can beNone
orList integer
-
hamiltonian qubits = device qubits
in config file, need to fill intranspile_q_layout
-
hamiltonian qubits = device qubits and transpile_q_layout = None
known issue, does not supported
@article{du2020quantum,
title={Quantum circuit architecture search: error mitigation and trainability enhancement for variational quantum solvers},
author={Du, Yuxuan and Huang, Tao and You, Shan and Hsieh, Min-Hsiu and Tao, Dacheng},
journal={arXiv preprint arXiv:2010.10217},
year={2020}
}
fork of https://github.com/yuxuan-du/Quantum_architecture_search