Skip to main content

A software package for nonconvex optimization with quantum devices.

Project description

QHDOPT

Unitary Fund
Python CI codecov
QHDOPT (QHD-based OPTimizer) is a software package for nonconvex optimization.

QHDOPT implements a quantum optimization algorithm named Quantum Hamiltonian Descent (QHD) on available quantum computers (such as the D-Wave systems). QHD is a quantum-upgraded version of gradient descent (GD). Unlike the classical GD, QHD demonstrates a significant advantage in solving nonconvex optimization problems.

QHDOPT Workflow

Why QHDOPT?

QHDOPT is for everyone!

QHDOPT aims to eliminate the technical barrier of using QHD for the broader operations research (OR) community. We do not assume users to have prior knowledge of quantum computing, while we allow expert users to specify advanced solver parameters for customized experience. Our target users include:

  • Professionals pursuing an off-the-shelf nonconvex optimization solver to tackle problems in operations research (e.g., power systems, supply chains, manufacturing, health care, etc.),
  • Researchers who hope to advance the theory and algorithms of optimization via quantum technologies,
  • Experts in quantum computation who want to experiment with hyperparameters and/or encodings in QHD to achieve even better practical performance.

Fast compilation empowered by SimuQ

QHDOPT has a built-in compiler powered by SimuQ, a framework for programming and compiling quantum Hamiltonian systems.

Automatic post-processing

QHDOPT automatically post-processes the results returned by the quantum machines. The post-processing includes decoding the raw measurement results and improving their precision (i.e., fine-tuning) via a classical local solver. Users may disable the fine-tuning if needed.

Installation

The dependency of simuq now requires you to install a specific version of SimuQ manually. Please install by running the following

git clone https://github.com/PicksPeng/SimuQ.git
cd SimuQ/
git checkout qhd-work
pip install ".[dwave, ionq, qutip]"

To install QHDOPT, you can clone this repo and install by

git clone https://github.com/jiaqileng/QHDOPT.git
cd QHDOPT/
pip install ".[all]"

Finally, run the following in your conda environment:

conda install -c conda-forge cyipopt

Usage

Two example notebooks for a jump start are examples/QP-example.ipynb and examples/PO-example.ipynb. The following illustrates the basic building blocks of QHDOPT and their functionalities briefly.

Import QHDOPT by running

from qhdopt import QHD

You can create a problem instance by directly constructing the function via SymPy.

from sympy import symbols, exp

x, y = symbols("x y")
f = y**1.5 - exp(4*x) * (y-0.75)
model = QHD.SymPy(f, [x, y], bounds=(0,1))

Then you need to setup the solver and the backend device (D-Wave in this example).

model.dwave_setup(resolution=8, api_key="API_key")

Here resolution represents the resolution of the QHD algorithm, and api_key represents the API key of the D-Wave account obtained at D-Wave Leap.

Now you can solve the target problem.

minimum = model.optimize()

The minimal value of $f$ found by QHDOPT is then stored in minimum. To print more details in the process, you can run model.optimize(verbose=1).

Contact

Jiaqi Leng jiaqil@umd.edu

Yuxiang Peng ypeng15@umd.edu

Contributors

Samuel Kushnir, Jiaqi Leng, Yuxiang Peng, Lei Fan

Citation

If you use QHDOPT in your work, please cite our paper

@article{kushnir2024qhdopt,
  title    = {QHDOPT: A Software for Nonlinear Optimization with Quantum Hamiltonian Decent},
  author   = {Kushnir, Sam and Leng, Jiaqi and Peng, Yuxiang and Fan, Lei and Wu, Xiaodi},
  journal  = {arXiv preprint arXiv:xxxx.xxxxx},
  year     = {2024}
}

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

qhdopt-0.0.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

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

qhdopt-0.0.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file qhdopt-0.0.1.tar.gz.

File metadata

  • Download URL: qhdopt-0.0.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for qhdopt-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c22c51d540fc74a8bc82ac2be3b51d6961f368854b0e9ed8019c78cd4d8e23fa
MD5 9857a0798e5b6289c153822098fe4948
BLAKE2b-256 5cc5a29bd23053d1f3c4d653b92d18340c1638bd97cf0dfee185f09dd251ac8d

See more details on using hashes here.

File details

Details for the file qhdopt-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: qhdopt-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for qhdopt-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08d1a715124dddd73958bf85fdb2e6475c5d752b73957891fe1f41bc1385ad8d
MD5 673fcf09aec15fce1768f9c075cb9497
BLAKE2b-256 893064e2b0e344c50dcbdebd392c44a311bf8c96e9243946f3353fbf9b6110bf

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